Beispiel #1
0
def do_getitemestimates(as_conn, curs, collection_ids, gie_options):
    getitemestimate_xmldoc_req = GetItemEstimate.build(
        storage.get_synckeys_dict(curs), collection_ids, gie_options)
    getitemestimate_xmldoc_res = as_request(as_conn, "GetItemEstimate",
                                            getitemestimate_xmldoc_req)

    getitemestimate_res = GetItemEstimate.parse(getitemestimate_xmldoc_res)
    return getitemestimate_res
Beispiel #2
0
def do_sync(as_conn, curs, collections, emails_out):

    as_sync_xmldoc_req = Sync.build(storage.get_synckeys_dict(curs), collections)
    #print "\r\nSync Request:"
    #print as_sync_xmldoc_req
    res = as_conn.post("Sync", parser.encode(as_sync_xmldoc_req))
    #print "\r\nSync Response:"
    if res == '':
        #print "Nothing to Sync!"
        pass
    else:
        collectionid_to_type_dict = storage.get_serverid_to_type_dict()
        as_sync_xmldoc_res = parser.decode(res)
        #print type(as_sync_xmldoc_res), dir(as_sync_xmldoc_res), as_sync_xmldoc_res

        _parse_for_emails(as_sync_xmldoc_res, emails_out)

        sync_res = Sync.parse(as_sync_xmldoc_res, collectionid_to_type_dict)
        storage.update_items(sync_res)
        return sync_res