def get_titles(cls, user=None): email = user.email() if user is not None else u"None" titles = cache.get_titles(email) if titles is None: titles = set([page.title for page in cls.get_index(user)]) cache.set_titles(email, titles) return titles
def get_titles(cls, user=None): email = user.email() if user is not None else u'None' titles = cache.get_titles(email) if titles is not None: titles = json.loads(titles) else: titles = [page.title for page in cls.get_index(user)] cache.set_titles(email, json.dumps(titles)) return titles