Re: Google Contacts Problem



On Mon, Sep 1, 2008 at 1:23 AM, Fabio Rafael da Rosa
<fabiorafael rosa gmail com> wrote:
> I have another suggestion, and I wanna know what do you think.
> I sync my contacts with a folder, and it creates a new file, with all
> the contacts.

So the first patch works without any problems? If you can confirm that
i'll commit to SVN at once.

> But, it does not have an extension (vcf).
> Many applications can recognize that it's a vCard, but some can't (like
> my cell phone if I try to send it via bluetooth without adding .vcf to
> the file).
> So, as it's a vcf file, can't with append an extension to the file
> name ?

Attached is a 2nd (don't revert the other patch!) patch to add a vcf
extension to files that conduit creates from a VCard. Again,
completely untested. If it doesn't work, it should give you some clues
on how to proceed with this further...

John
Index: conduit/datatypes/File.py
===================================================================
--- conduit/datatypes/File.py	(revision 1713)
+++ 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 1713)
+++ 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):


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