def remove_page(self, target): target = decode_from_binary(target) if isinstance(target, PageInfo): key = target.id else: key = PageInfo.url_to_id(target) try: self.__class__.storage.remove(key) except KeyError as exc: return False else: return True
def get_page(self, target_url): return encode_to_binary( self.__class__.storage.get( PageInfo.url_to_id(target_url), default=None))
def has_key(self, target_url): result = PageInfo.url_to_id(target_url) in self.__class__.storage return result