def update(cls, data, title, slug, text): data.title = title data.slug = slug data.text = text data.html = markdown.markdown(text) data.put() keys = ['p/'+data.slug, 'p$all', 'html$page/'+data.slug] memcache.delete_multi(keys) return data
def add(cls, title, slug, text): key = 'p/' + slug data = memcache.get(key) if data is not None: return data data = cls(title=title, slug=slug, text=text, html=markdown.markdown(text)) data.put() memcache.set(key, data) keys = ['p$all'] memcache.delete_multi(keys) return data
def update(cls, data, title, slug, text, draft, keyword=''): data.title = title data.slug = slug data.text = text data.draft = draft data.keyword = keyword data.html = markdown.markdown(text) data.put() keys = ['a/'+data.slug, 'a$ten', 'a$archive', 'xml$atom', 'xml$rss', 'xml$sitemap', 'html/index', 'html/mobile'] for tag in data.keyword.split(): keys.append('a$keyword/' + tag) memcache.delete_multi(keys) return data
def add(cls, title, slug, text, draft, keyword='nokeyword'): key = 'a/' + slug data = memcache.get(key) if data is not None: return data data = cls( title=title, slug=slug, text=text, draft=draft, keyword=keyword, html=markdown.markdown(text), ) data.put() memcache.set(key, data) keys = ['a$ten', 'a$archive','xml$atom', 'xml$rss', 'xml$sitemap', 'html/mobile', 'html/index'] for tag in data.keyword.split(): keys.append('a$keyword/' + tag) memcache.delete_multi(keys) return data
def markitdown(eval_ctx, value): return markdown.markdown(value)