[conduit/tracker: 147/179] More PEBKAC fixing, return a Rid from put() call



commit c590d630196a40bf258b464693c51f04f223c76d
Author: John Carr <john carr unrouted co uk>
Date:   Thu May 14 10:39:36 2009 +0100

    More PEBKAC fixing, return a Rid from put() call
---
 conduit/modules/TrackerModule/TrackerModule.py |   21 ++++++++++++---------
 1 files changed, 12 insertions(+), 9 deletions(-)

diff --git a/conduit/modules/TrackerModule/TrackerModule.py b/conduit/modules/TrackerModule/TrackerModule.py
index cb16f3b..5957a2f 100644
--- a/conduit/modules/TrackerModule/TrackerModule.py
+++ b/conduit/modules/TrackerModule/TrackerModule.py
@@ -7,6 +7,7 @@ import conduit.dataproviders.DataProvider as DataProvider
 import conduit.utils as Utils
 import conduit.Exceptions as Exceptions
 import conduit.datatypes.Contact as Contact
+from conduit.datatypes import Rid
 
 Utils.dataprovider_add_dir_to_path(__file__)
 import tralchemy
@@ -52,6 +53,7 @@ class TrackerContacts(DataProvider.TwoWay):
             self.delete(LUID)
         c = self._vcard_to_tracker(obj)
         c.commit()
+        return Rid(c.uri, mtime=None, hash=None)
 
     def delete(self, LUID):
         if LUID in self.contacts:
@@ -64,9 +66,9 @@ class TrackerContacts(DataProvider.TwoWay):
     def _vcard_to_tracker(self, data):
         vcard = data.vcard
 
-        c = PersonContact()
+        c = PersonContact.create()
 
-        for k, v in vcard.iteritems():
+        for k, v in vcard.contents.iteritems():
             if k == "account":
                 pass
             elif k == "tel":
@@ -74,21 +76,22 @@ class TrackerContacts(DataProvider.TwoWay):
             elif k == "bday":
                 pass
             elif k == "n":
-                c.namefamily = v.value.family
-                c.namegiven = v.value.given
-                c.nameadditional = v.value.additional
-                c.namehonorificprefix = v.value.prefix
-                c.namehonorificsuffix = v.value.suffix
+                x = v[0].value
+                c.namefamily = x.family
+                c.namegiven = x.given
+                c.nameadditional = x.additional
+                c.namehonorificprefix = x.prefix
+                c.namehonorificsuffix = x.suffix
             elif k == "version":
                 pass
             elif k == "org":
                 pass
             elif k == "nickname":
-                c.nickname = v.value
+                c.nickname = v[0].value
             elif k == "email":
                 pass
             elif k == "fn":
-                c.fullname = v.value
+                c.fullname = v[0].value
             else:
                 log.warning("Unhandled key: %s" % k)
 



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