conduit r1550 - in trunk: . conduit/modules



Author: johncarr
Date: Tue Jul 15 12:35:52 2008
New Revision: 1550
URL: http://svn.gnome.org/viewvc/conduit?rev=1550&view=rev

Log:
Convert name from vcard to XML foo

Modified:
   trunk/   (props changed)
   trunk/conduit/modules/SynceModule.py

Modified: trunk/conduit/modules/SynceModule.py
==============================================================================
--- trunk/conduit/modules/SynceModule.py	(original)
+++ trunk/conduit/modules/SynceModule.py	Tue Jul 15 12:35:52 2008
@@ -285,8 +285,7 @@
       v = data.vcard
       doc = xml.dom.minidom.Document()
       node = doc.createElement("contact")
-
-      for chunk in v.contents:
+      for chunk, value in v.contents.iteritems():
           if chunk == "account":
               pass
           elif chunk == "tel":
@@ -294,7 +293,21 @@
           elif chunk == "bday":
               pass
           elif chunk == "n":
-              pass
+              v = value[0]
+              n = doc.createElement("Name")
+              f = doc.createElement("FirstName")
+              f.appendChild(doc.createTextNode(v.value.given))
+              n.appendChild(f)
+              l = doc.createElement("LastName")
+              l.appendChild(doc.createTextNode(v.value.family))
+              n.appendChild(l)
+              a = doc.createElement("Additional")
+              n.appendChild(a)
+              p = doc.createElement("Prefix")
+              n.appendChild(p)
+              s = doc.createElement("Suffix")
+              n.appendChild(s)
+              node.appendChild(n)
           elif chunk == "version":
               pass
           elif chunk == "org":



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