def __init__(self): HasTags.__init__(self) # dictionary of user_ids for taggers that # have so much negative tag feedback that we want # to hide their tags from the public. self.naughty_taggers = {}
def __init__(self): GenericDB.__init__(self) HasOwnership.__init__(self) HasTags.__init__(self) self.email_db = GenericDB() self.hit_db = HitDB() self.retired_users = OOBTree.OOBTree()
def tag_item(self, user_id, item_oid, tags, comment): if not tags: return # update this tag container to hold these tags for this item HasTags.tag_item(self, user_id, item_oid, tags, comment) # update the reverse mapping with the new tag attributes # for any tag, get the new attributes object new_attributes = self.tags[tags[0]][item_oid][user_id] tidb = get_tagged_item_database() tidb.add_item(item_oid, user_id, new_attributes)
def remove_tags(self, tags, item_oid, user_id): if not tags: return tidb = get_tagged_item_database() # what tags does this item,user have before removal? item_tags = tidb.get_tags(item_oid, user_id) HasTags.remove_tags(self, tags, item_oid, user_id) remaining_tags = [tag for tag in item_tags if tag not in tags] if remaining_tags: atag = remaining_tags[0] # an arbitrary tag if 1: # atag in self.tags and item_oid in self.tags[atag] and user_id in self.tags[atag][item_oid]: new_attributes = self.tags[atag][item_oid][user_id] tidb.add_item(item_oid, user_id, new_attributes) else: # if all attributes are gone, remove this item,user from the tidb tidb.remove_item_user(item_oid, user_id)
def upgradeToVersion2(self): HasTags.__init__(self) self.version_upgrade_done()