示例#1
0
文件: pyforce.py 项目: naoyak/pyforce
    def queryMore(self, queryLocator):
        if self.cacheTypeDescriptions:
            typeDescs = self.typeDescs
        else:
            typeDescs = {}

        locator = queryLocator
        res = BaseClient.queryMore(self, locator)
        # calculate the union of the sets of record types from each record
        types = reduce(lambda a,b: a|b, [getRecordTypes(r) for r in res[_tPartnerNS.records:]], set())
        new_types = types - set(typeDescs.keys())
        if new_types:
            typeDescs.update(self.queryTypesDescriptions(new_types))
        data = QueryRecordSet(records=[self._extractRecord(r, typeDescs) for r in res[_tPartnerNS.records:]],
                              done=_bool(res[_tPartnerNS.done]),
                              size=int(str(res[_tPartnerNS.size])),
                              queryLocator = str(res[_tPartnerNS.queryLocator]))
        return data
示例#2
0
    def queryMore(self, queryLocator):
        if self.cacheTypeDescriptions:
            typeDescs = self.typeDescs
        else:
            typeDescs = {}

        locator = queryLocator
        res = BaseClient.queryMore(self, locator)
        # calculate the union of the sets of record types from each record
        types = reduce(lambda a, b: a | b, [getRecordTypes(r) for r in
                       res[_tPartnerNS.records,]], set())
        new_types = types - set(typeDescs.keys())
        if new_types:
            typeDescs.update(self.queryTypesDescriptions(new_types))
        data = QueryRecordSet(
            records=[self._extractRecord(r, typeDescs) for r in
                     res[_tPartnerNS.records,]],
            done=_bool(res[_tPartnerNS.done]),
            size=int(str(res[_tPartnerNS.size])),
            queryLocator=str(res[_tPartnerNS.queryLocator])
        )
        return data