[Snowy] Some patches



Hello!

I tried to run Snowy with mod_python and ran into some issues. I
hereby attach the patches I made to make it work for me. Also I'll try
to document my efforts with .htaccess and configuring mod_python to
work with Snowy tomorrow.

Note that those patched do not solve all the problems -- only those I
was able to solve/I actually ran into. Hope that some of you would
test them and fix the remaining (if any) bugs.

-- 
Cheers,
Piotr Gaczkowski
From 87f37bfeb4b47a01b491e6e11b2e4db41916ed07 Mon Sep 17 00:00:00 2001
From: Piotr Gaczkowski <doomhammerng gmail com>
Date: Sun, 21 Jun 2009 16:54:38 +0200
Subject: [PATCH] Don't assume we own the root.

---
 settings.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/settings.py b/settings.py
index ef7ec1e..bc22de9 100644
--- a/settings.py
+++ b/settings.py
@@ -43,7 +43,7 @@ MEDIA_ROOT = os.path.join(PROJECT_ROOT, 'site_media')
 # URL that handles the media served from MEDIA_ROOT. Make sure to use a
 # trailing slash if there is a path component (optional in other cases).
 # Examples: "http://media.lawrence.com";, "http://example.com/media/";
-MEDIA_URL = '/site_media/'
+MEDIA_URL = 'site_media/'
 
 # URL prefix for admin media -- CSS, JavaScript and images. Make sure to use a
 # trailing slash.
-- 
1.6.0.4

From e658b49efbb7fb620d1d9aac7f20fa6ea38b6121 Mon Sep 17 00:00:00 2001
From: Piotr Gaczkowski <doomhammerng gmail com>
Date: Sun, 21 Jun 2009 17:16:46 +0200
Subject: [PATCH] Now it works with MySQL too

---
 notes/models.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/notes/models.py b/notes/models.py
index 8aa48e0..993963f 100644
--- a/notes/models.py
+++ b/notes/models.py
@@ -38,7 +38,7 @@ class Note(models.Model):
     modified = models.DateTimeField(auto_now_add=True)
     user_modified = models.DateTimeField(auto_now_add=True)
 
-    title = models.TextField(blank=True)
+    title = models.SlugField(blank=True)
     slug = AutoSlugField(unique_with='author', populate_from='title',
                          editable=True)
     content = models.TextField(blank=True)
-- 
1.6.0.4

From 124e943389271ca5e3d4ce1b46ec620e8d1a2be7 Mon Sep 17 00:00:00 2001
From: Piotr Gaczkowski <doomhammerng gmail com>
Date: Sun, 21 Jun 2009 20:47:22 +0200
Subject: [PATCH] Allow POSTing notes.

---
 api/handlers.py |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/api/handlers.py b/api/handlers.py
index efc746c..a395412 100644
--- a/api/handlers.py
+++ b/api/handlers.py
@@ -69,7 +69,7 @@ class UserHandler(AnonymousBaseHandler):
 
 # http://domain/api/1.0/user/notes
 class NotesHandler(BaseHandler):
-    allow_methods = ('GET', 'PUT')
+    allow_methods = ('GET', 'PUT', 'POST')
 
     @catch_and_return(ObjectDoesNotExist, rc.NOT_HERE)
     def read(self, request, username):
@@ -89,6 +89,13 @@ class NotesHandler(BaseHandler):
     @catch_and_return(ObjectDoesNotExist, rc.NOT_HERE)
     @catch_and_return(KeyError, rc.BAD_REQUEST)
     @transaction.commit_on_success
+    def create(self, request, username):
+        return self.update(request, username)
+
+
+    @catch_and_return(ObjectDoesNotExist, rc.NOT_HERE)
+    @catch_and_return(KeyError, rc.BAD_REQUEST)
+    @transaction.commit_on_success
     def update(self, request, username):
         def clean_date(date):
             return parser.parse(date).astimezone(pytz.timezone(settings.TIME_ZONE))
-- 
1.6.0.4

From 1f72c2abc7abee5cf12a0e30d462c6db3c0316da Mon Sep 17 00:00:00 2001
From: Piotr Gaczkowski <doomhammerng gmail com>
Date: Sun, 21 Jun 2009 21:03:10 +0200
Subject: [PATCH] Make it work with Snowy in subdirectory and with Apache.

---
 Tomboy/Addins/WebSyncService/Api/UserInfo.cs  |    3 ++-
 Tomboy/Addins/WebSyncService/Api/WebHelper.cs |    2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Tomboy/Addins/WebSyncService/Api/UserInfo.cs b/Tomboy/Addins/WebSyncService/Api/UserInfo.cs
index 4a264ce..e9f99bc 100644
--- a/Tomboy/Addins/WebSyncService/Api/UserInfo.cs
+++ b/Tomboy/Addins/WebSyncService/Api/UserInfo.cs
@@ -35,6 +35,7 @@ namespace Tomboy.WebSync.Api
 		public static UserInfo GetUser (string serverUrl, string userName, IAuthProvider auth)
 		{
 			// TODO: Clean this up
+			Uri ServerUrl = new Uri(serverUrl);
 			string baseUrl = serverUrl + "/api/1.0/";
 			string uri = baseUrl + userName;
 			
@@ -43,7 +44,7 @@ namespace Tomboy.WebSync.Api
 			string jsonString = helper.Get (uri, null, auth);
 			UserInfo user = ParseJson (jsonString);
 			user.AuthProvider = auth;
-			user.BaseUrl = baseUrl;
+			user.BaseUrl = ServerUrl.GetLeftPart(UriPartial.Authority);
 			return user;
 		}
 
diff --git a/Tomboy/Addins/WebSyncService/Api/WebHelper.cs b/Tomboy/Addins/WebSyncService/Api/WebHelper.cs
index 6f86ff8..7428de2 100644
--- a/Tomboy/Addins/WebSyncService/Api/WebHelper.cs
+++ b/Tomboy/Addins/WebSyncService/Api/WebHelper.cs
@@ -49,7 +49,7 @@ namespace Tomboy.WebSync.Api
 		public string PutJson (string uri, IDictionary<string, string> queryParameters, string postValue, IAuthProvider auth)
 		{
 			HttpWebRequest request = BuildRequest (uri, queryParameters);
-			request.Method = "PUT";
+			request.Method = "POST"; // Apache chokes on large PUT requests
 
 			// TODO: Set ContentLength, UserAgent, Timeout, KeepAlive, Proxy, ContentType?
 			//       (May only be available if we cast back to HttpWebRequest)
-- 
1.6.0.4



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]