[snowy] Add support for processing tags when uploading note changes.



commit a073221d80324a121f7fbcce58f7be53c2e484b9
Author: Sandy Armstrong <sanfordarmstrong gmail com>
Date:   Mon May 18 13:49:37 2009 -0700

    Add support for processing tags when uploading note changes.
---
 api/handlers.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/api/handlers.py b/api/handlers.py
index e34f584..1176274 100644
--- a/api/handlers.py
+++ b/api/handlers.py
@@ -28,6 +28,7 @@ from datetime import datetime
 from dateutil import parser
 
 from snowy.notes.models import Note
+from snowy.notes.models import NoteTag
 from snowy import settings
 
 import json, pytz
@@ -133,6 +134,13 @@ class NotesHandler(BaseHandler):
                 note.modified = datetime.now()
             if c.has_key('create-date'): note.created = clean_date(c['create-date'])
             if c.has_key('open-on-startup'): note.open_on_startup = (c['open-on-startup'] == 'true')
+            if c.has_key('tags'):
+                for tagName in c['tags']:
+                    is_notebook = tagName.startswith('system:notebook:')
+                    tag, created = NoteTag.objects.get_or_create(author=user,
+                                                                 name=tagName,
+                                                                 is_notebook=is_notebook)
+                    note.tags.add(tag)
 
             note.last_sync_rev = new_sync_rev
 



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