Index: conduit/datatypes/Contact.py =================================================================== --- conduit/datatypes/Contact.py (revision 838) +++ conduit/datatypes/Contact.py (working copy) @@ -35,3 +35,14 @@ def __str__(self): return self.get_vcard_string() + @property + def email(self): + """ + Returns the full name of this contact, if available. Returns None if unavailable or an error occured + """ + try: + return self.vCard.contents['email'][0].value + except: + # FIXME list the exceptions here + return None + Index: conduit/datatypes/File.py =================================================================== --- conduit/datatypes/File.py (revision 838) +++ conduit/datatypes/File.py (working copy) @@ -171,19 +171,27 @@ @type newURIString: C{string} """ + logd( "begining file transfer" ) if self._newFilename == None: newURI = gnomevfs.URI(newURIString) else: newURI = gnomevfs.URI(newURIString) - #if it exists and its a directory then transfer into that dir - #with the new filename + # if it exists and its a directory then transfer into that dir + # with the new filename + # if it's a temporary file then it already has a filename and most + # likely there won't be a file in the destination directory with + # the same name if gnomevfs.exists(newURI): info = gnomevfs.get_file_info(newURI, gnomevfs.FILE_INFO_DEFAULT) if info.type == gnomevfs.FILE_TYPE_DIRECTORY: #append the new filename newURI = newURI.append_file_name(self._newFilename) - logd("Using deferred filename in transfer") + if isinstance(self, TempFile): + # TODO check the file exists? + newURI = newURI.parent.append_file_name(self._newFilename) + logd( "Using deferred filename in transfer of temporary file" ) + if overwrite: mode = gnomevfs.XFER_OVERWRITE_MODE_REPLACE Index: conduit/dataproviders/ConverterModule.py =================================================================== --- conduit/dataproviders/ConverterModule.py (revision 838) +++ conduit/dataproviders/ConverterModule.py (working copy) @@ -103,7 +103,14 @@ def contact_to_file(self, contact): #get vcard data - f = Utils.new_tempfile(contact.get_vcard_string()) + f = Utils.new_tempfile(contents=contact.get_vcard_string()) + full_name = contact.full_name + if full_name: + # TODO check for characters in full_name that might be forbidden in + # filenames, eg on linux's ext3 '/', on fat32, '?' etc + # Suggest just stripping out those offending characters. This + # should probably be done in a file class or somesuch + f.force_new_filename( "%s.vcf" % full_name ) return f def contact_to_text(self, contact):