[conduit/syncml: 101/244] Add a _mime_ property. Move _store_ defaults to Event and Contacts mixins



commit eb5ea3a406168b8d36915e6add73a1dc46caa81e
Author: John Carr <john carr unrouted co uk>
Date:   Mon Apr 27 03:50:57 2009 -0700

    Add a _mime_ property. Move _store_ defaults to Event and Contacts mixins
---
 conduit/modules/SyncmlModule/SyncmlModule.py |   21 +++++++++++++++------
 test/python-tests/syncml-server.sh           |    2 +-
 2 files changed, 16 insertions(+), 7 deletions(-)

diff --git a/conduit/modules/SyncmlModule/SyncmlModule.py b/conduit/modules/SyncmlModule/SyncmlModule.py
index 5134ef3..196e3d6 100644
--- a/conduit/modules/SyncmlModule/SyncmlModule.py
+++ b/conduit/modules/SyncmlModule/SyncmlModule.py
@@ -113,9 +113,12 @@ class SyncmlDataProvider(DataProvider.TwoWay):
             LUID = str(uuid.uuid4())
             self.mapping[LUID] = uid
 
+        log.debug("Got change: %s (LUID: %s)" % (uid, LUID))
+
         self._changes[LUID] = (type, data[:size])
 
         if self._session_type == enums.SML_SESSION_TYPE_CLIENT:
+            log.debug("Adding mapping")
             err = pysyncml.Error()
             self.syncobj.add_mapping(source, uid, uid, pysyncml.byref(err))
 
@@ -352,9 +355,12 @@ class ContactsProvider(SyncmlDataProvider):
     _icon_ = "contact-new"
     _configurable_ = False
 
+    _store_ = "Contacts"
+    _mime_ = "text/x-vcard"
+
     def _setup_datastore(self):
         err = pysyncml.Error()
-        self.syncobj.add_datastore("text/x-vcard", None, self._store_, pysyncml.byref(err))
+        self.syncobj.add_datastore(self._mime_, None, self._store_, pysyncml.byref(err))
 
     def _blob_to_obj(self, uid, data):
         c = Contact.Contact()
@@ -376,9 +382,12 @@ class EventsProvider(SyncmlDataProvider):
     _icon_ = "x-office-calendar"
     _configurable_ = False
 
+    _store_ = "Calendar"
+    _mime_ = "text/x-calendar"
+
     def _setup_datastore(self):
         err = pysyncml.Error()
-        self.syncobj.add_datastore("text/x-vcalendar", None, self._store_, pysyncml.byref(err))
+        self.syncobj.add_datastore(self._mime_, None, self._store_, pysyncml.byref(err))
 
     def _blob_to_obj(self, uid, data):
         e = Event.Event()
@@ -400,13 +409,11 @@ CATEGORY_SYNCMLTEST = DataProviderCategory.DataProviderCategory("Syncml Test")
 
 class SyncmlContactsTwoWay(HttpClient, ContactsProvider):
     _address_ = "http://localhost:1234";
-    _store_ = "Contacts"
     _category_ = CATEGORY_SYNCMLTEST
 MODULES['SyncmlContactsTwoWay'] = {"type":"dataprovider"}
 
 class SyncmlEventsTwoWay(HttpClient, EventsProvider):
     _address_ = "http://localhost:1234";
-    _store_ = "Calendar"
     _category_ = CATEGORY_SYNCMLTEST
 MODULES['SyncmlEventsTwoWay'] = {"type":"dataprovider"}
 
@@ -414,13 +421,15 @@ CATEGORY_SCHEDULEWORLD = DataProviderCategory.DataProviderCategory("ScheduleWorl
 
 class ScheduleWorldContacts(HttpClient, ContactsProvider):
     _address_ = "http://sync.scheduleworld.com/funambol/ds";
-    _store_ = "card"
+    _store_ = "card3"
+    _mime_ = "text/vcard"
     _category_ = CATEGORY_SCHEDULEWORLD
 MODULES['ScheduleWorldContacts'] = {"type":"dataprovider"}
 
 class ScheduleWorldCalendar(HttpClient, EventsProvider):
     _address_ = "http://sync.scheduleworld.com/funambol/ds";
-    _store_ = "cal"
+    _store_ = "cal2"
+    _mime_ = "text/calendar"
     _category_ = CATEGORY_SCHEDULEWORLD
 MODULES['ScheduleWorldCalendar'] = {"type":"dataprovider"}
 
diff --git a/test/python-tests/syncml-server.sh b/test/python-tests/syncml-server.sh
index b90de6d..318c14c 100755
--- a/test/python-tests/syncml-server.sh
+++ b/test/python-tests/syncml-server.sh
@@ -2,5 +2,5 @@
 killall syncml-ds-tool
 while [ 1 -ne 0 ]
 do
-  syncml-ds-tool --username test --password test --http-server 1234 --sync $1 $2 $3
+  syncml-ds-tool --remoteWinsConflicts --username test --password test --http-server 1234 --sync $1 $2 $3
 done



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