def add_collection_item(self, item, count): item_name = item[1:] if item[:1] == '@' else item coll_items = self.get_collection_items() coll_count = obj2dict(coll_items).get(item_name, 0) + count self.get_state().collectionItems.__setattr__(item_name, coll_count)
def send(self, data): data = obj2dict(data) assert 'type' in data request = self.factory.create_request(data) return dict2obj(request.send(self.connection))