[snowy] If there are no changes being pushed, return to avoid erroneously incrementing user's global sync re



commit 01ffd2e912365ef9a9c2792701515993fbfb9cdb
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date:   Mon May 18 13:48:38 2009 -0700

    If there are no changes being pushed, return to avoid erroneously incrementing user's global sync rev.
---
 api/handlers.py |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/api/handlers.py b/api/handlers.py
index 0f69aa4..e34f584 100644
--- a/api/handlers.py
+++ b/api/handlers.py
@@ -101,6 +101,9 @@ class NotesHandler(BaseHandler):
             return rc.FORBIDDEN
 
         update = json.loads(request.raw_post_data)
+        changes = update['note-changes']
+        if len(changes) == 0:
+            return
 
         current_sync_rev = user.get_profile().latest_sync_rev
         new_sync_rev = current_sync_rev + 1
@@ -112,7 +115,7 @@ class NotesHandler(BaseHandler):
             # TODO: Return a more useful error response?
             return rc.BAD_REQUEST
 
-        for c in update['note-changes']:
+        for c in changes:
             note, created = Note.objects.get_or_create(author=user,
                                                        guid=c['guid'])
 



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