コード例 #1
0
ファイル: test_cd_read.py プロジェクト: Sts0mrg0/ASynK
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()
コード例 #2
0
ファイル: folder_cd.py プロジェクト: slaanesh/ASynK
    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
コード例 #3
0
ファイル: folder_cd.py プロジェクト: cyril-bouthors/ASynK
    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
コード例 #4
0
    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
コード例 #5
0
ファイル: folder_cd.py プロジェクト: mmaker/ASynK
    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
コード例 #6
0
ファイル: folder_cd.py プロジェクト: cyril-bouthors/ASynK
    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
コード例 #7
0
ファイル: folder_cd.py プロジェクト: slaanesh/ASynK
    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
コード例 #8
0
    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)
コード例 #9
0
ファイル: folder_cd.py プロジェクト: mmaker/ASynK
    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)