def main (argv=None): print 'Command line: ', sys.argv print confn_src if os.path.exists(user_dir): logging.debug('Clearing user directory: %s', user_dir) shutil.rmtree(user_dir) else: logging.debug('Creating user directory: %s', user_dir) os.makedirs(user_dir) shutil.copyfile(state_src, state_dest) shutil.copyfile(confn_src, confn_dest) global config config = Config(asynk_base_dir=asynk_base_dir, user_dir=user_dir) data = None with open(sys.argv[1], "r") as f: data = f.read() print print data vco = vobject.readOne(data) print vco print vco.prettyPrint() con = CDContact(None, vco=vobject.readOne(data), debug_vcf=True) print unicode(con) print "Display Name: ", con.get_disp_name() print "VCO: ", con.init_vco_from_props().serialize()
def find_item(self, itemid): """See the documentation in folder.Folder""" sess = self.get_db().session() result = sess.readData(URL(path=itemid)) if not result: return None data, _ignore_etag = result cd = CDContact(self, vco=vobject.readOne(data), itemid=itemid) return cd
def find_item (self, itemid): """See the documentation in folder.Folder""" sess = self.get_db().session() result = sess.readData(URL(path=itemid)) if not result: return None data, _ignore_etag = result cd = CDContact(self, vco=vobject.readOne(data), itemid=itemid) return cd
def find_item(self, itemid): """See the documentation in folder.Folder""" sess = self.get_db().session() result = sess.readData(URL(path=itemid)) if not result: return None data, _ignore_etag = result try: return CDContact(self, vco=vobject.readOne(data), itemid=itemid) except Exception, e: logging.error('Error (%s) parsing vCard object for %s', e, itemid) raise
def find_item (self, itemid): """See the documentation in folder.Folder""" sess = self.get_db().session() result = sess.readData(URL(path=itemid)) if not result: return None data, _ignore_etag = result try: return CDContact(self, vco=vobject.readOne(data), itemid=itemid) except Exception, e: logging.error('Error (%s) parsing vCard object for %s', e, itemid) raise
def find_items (self, itemids): """See the documentation in folder.Folder""" sess = self.get_db().session() results = sess.multiGet(URL(path=self.get_itemid()), itemids, (davxml.getetag, carddavxml.address_data)) ret = [] for key, item in results.iteritems(): etag = item.getNodeProperties()[davxml.getetag] vcf = item.getNodeProperties()[carddavxml.address_data] vco = vobject.readOne(vcf.text) cd = CDContact(self, vco=vco, itemid=key) cd.set_etag(etag.text) ret.append(cd) return ret
def find_items(self, itemids): """See the documentation in folder.Folder""" sess = self.get_db().session() results = sess.multiGet(URL(path=self.get_itemid()), itemids, (davxml.getetag, carddavxml.address_data)) ret = [] for key, item in results.iteritems(): etag = item.getNodeProperties()[davxml.getetag] vcf = item.getNodeProperties()[carddavxml.address_data] vco = vobject.readOne(vcf.text) cd = CDContact(self, vco=vco, itemid=key) cd.set_etag(etag.text) ret.append(cd) return ret
def find_items(self, itemids): """See the documentation in folder.Folder""" sess = self.get_db().session() results = sess.multiGet(URL(path=self.get_itemid()), itemids, (davxml.getetag, carddavxml.address_data)) ret = [] for key, item in results.iteritems(): etag = item.getNodeProperties()[davxml.getetag] vcf = item.getNodeProperties()[carddavxml.address_data] try: cd = CDContact(self, vco=vobject.readOne(vcf.text), itemid=key) except Exception, e: logging.error('Error (%s) parsing vCard object for %s', e, key) raise cd.set_etag(etag.text) ret.append(cd)
def find_items (self, itemids): """See the documentation in folder.Folder""" sess = self.get_db().session() results = sess.multiGet(URL(path=self.get_itemid()), itemids, (davxml.getetag, carddavxml.address_data)) ret = [] for key, item in results.iteritems(): etag = item.getNodeProperties()[davxml.getetag] vcf = item.getNodeProperties()[carddavxml.address_data] try: cd = CDContact(self, vco=vobject.readOne(vcf.text), itemid=key) except Exception, e: logging.error('Error (%s) parsing vCard object for %s', e, key) raise cd.set_etag(etag.text) ret.append(cd)