[snowy] Return full HTTP URLs in the REST API.
- From: Sanford Armstrong <sharm src gnome org>
- To: svn-commits-list gnome org
- Subject: [snowy] Return full HTTP URLs in the REST API.
- Date: Mon, 29 Jun 2009 15:34:04 +0000 (UTC)
commit 8efea193feb949a045fc1f357b453c47e011fa3c
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date: Sat Jun 27 10:17:31 2009 -0700
Return full HTTP URLs in the REST API.
Requires setting DOMAIN_NAME correctly in local_settings.py.
api/handlers.py | 10 +++++-----
local_settings.py.in | 1 +
2 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/api/handlers.py b/api/handlers.py
index efc746c..360aeaa 100644
--- a/api/handlers.py
+++ b/api/handlers.py
@@ -59,8 +59,8 @@ class UserHandler(AnonymousBaseHandler):
'first-name': user.first_name,
'last-name': user.last_name,
'notes-ref': {
- 'api-ref': reverse('note_api_index', kwargs=reverse_args),
- 'href': reverse('note_index', kwargs=reverse_args),
+ 'api-ref': 'http://%s%s' % (settings.DOMAIN_NAME, reverse('note_api_index', kwargs=reverse_args)),
+ 'href': 'http://%s%s' % (settings.DOMAIN_NAME, reverse('note_index', kwargs=reverse_args)),
},
'latest-sync-revision' : profile.latest_sync_rev,
'current-sync-guid' : profile.current_sync_uuid
@@ -185,11 +185,11 @@ def simple_describe_note(note):
return {
'guid': note.guid,
'ref': {
- 'api-ref': reverse('note_api_detail', kwargs={
+ 'api-ref': 'http://%s%s' % (settings.DOMAIN_NAME, reverse('note_api_detail', kwargs={
'username': note.author.username,
'note_id': note.pk,
- }),
- 'href': note.get_absolute_url(),
+ })),
+ 'href': 'http://%s%s' % (settings.DOMAIN_NAME, note.get_absolute_url()),
},
'title': note.title
}
diff --git a/local_settings.py.in b/local_settings.py.in
index fb07c6c..8578ce3 100644
--- a/local_settings.py.in
+++ b/local_settings.py.in
@@ -7,3 +7,4 @@ DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', '
DATABASE_NAME = 'snowy.db' # Or path to database file if using sqlite3.
OAUTH_AUTH_VIEW = "notes.views.note_oauth_auth_view"
+DOMAIN_NAME = 'localhost:8000'
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]