Re: Google Contacts Problem



Hi Roumano

Thanks very much for the feedback. I've attached a corrected version
of the patch (note it includes add-vcf-extension.diff as well so be
sure to revert before trying it out).

John: Do you have any thoughts on the add-vcf-extensions part of this
patch? Will it break things in ways i can't imagine?

John

On Wed, Sep 3, 2008 at 11:21 AM, Roumano :) <roumano gmail com> wrote:
> Hello,
> The add-vcf-extension.diff works great for me.
>
> The first is not working, after patching lunching conduit :
> [Module              ][WARNING] Error loading the file:
> /work/perso/conduit/1716/conduit/modules/GoogleModule/GoogleModule.py
> Traceback (most recent call last):
>  File "/work/perso/conduit/1716/conduit/Module.py", line 173, in
> _load_modules_in_file
>    mod = self._import_file(filename)
>  File "/work/perso/conduit/1716/conduit/Module.py", line 154, in _import_file
>    mods = pydoc.importfile (filename)
>  File "/usr/lib/python2.5/pydoc.py", line 259, in importfile
>    raise ErrorDuringImport(path, sys.exc_info())
> ErrorDuringImport: problem in
> /work/perso/conduit/1716/conduit/modules/GoogleModule/GoogleModule.py
> - <type 'exceptions.SyntaxError'>: invalid syntax (GoogleModule.py,
> line 945)
>  (Module.py:201)
>
> Regards.
>
>
Index: conduit/datatypes/File.py
===================================================================
--- conduit/datatypes/File.py	(revision 1716)
+++ conduit/datatypes/File.py	(working copy)
@@ -454,9 +454,9 @@
     """
     Creates a file in the system temp directory with the given contents.
     """
-    def __init__(self, contents, **kwargs):
+    def __init__(self, contents, suffix=None, **kwargs):
         #create the file containing contents
-        fd, name = tempfile.mkstemp(prefix="conduit")
+        fd, name = tempfile.mkstemp(prefix="conduit", suffix=suffix)
         os.write(fd, contents)
         os.close(fd)
         File.__init__(self, name, **kwargs)
Index: conduit/modules/ConverterModule.py
===================================================================
--- conduit/modules/ConverterModule.py	(revision 1716)
+++ conduit/modules/ConverterModule.py	(working copy)
@@ -112,7 +112,7 @@
                             
     def contact_to_file(self, contact, **kwargs):
         #get vcard data
-        f = Utils.new_tempfile(contact.get_vcard_string())
+        f = Utils.new_tempfile(contact.get_vcard_string(), suffix=".vcf")
         return f
 
     def contact_to_text(self, contact, **kwargs):
Index: conduit/modules/GoogleModule/GoogleModule.py
===================================================================
--- conduit/modules/GoogleModule/GoogleModule.py	(revision 1716)
+++ conduit/modules/GoogleModule/GoogleModule.py	(working copy)
@@ -933,7 +933,19 @@
         feed = self.service.GetContactsFeed()
         if not feed.entry:
             return []
-        return [str(contact.id.text) for contact in feed.entry]
+
+        # the only examples of GetNextLink do this, don't know if we need it
+        # contacts_service.auth_token = authsub_token
+        # contacts_service.UpgradeToSessionToken()
+
+	contacts = []
+	contacts.extend([str(contact.id.text) for contact in feed.entry])
+	next = feed.GetNextLink()
+	while next:
+            feed = self.service.GetContactsFeed(uri=next.href)
+	    contacts.extend([str(contact.id.text) for contact in feed.entry])
+	    next = feed.GetNextLink()
+        return contacts
         
     def refresh(self):
         DataProvider.TwoWay.refresh(self)


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