From 31834b04bc4f74dcbd465ae93c0b16abdfc17691 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 6 Dec 2018 15:17:43 +0000 Subject: [PATCH] wiki: Always render live Since we have loads of references to other pages, these pages need to be updated every time a linked page is being updated and that is quite hard to find out those references now. Signed-off-by: Michael Tremer --- src/backend/base.py | 1 - src/backend/wiki.py | 26 +------------------------- 2 files changed, 1 insertion(+), 26 deletions(-) diff --git a/src/backend/base.py b/src/backend/base.py index 70182ca6..c1088282 100644 --- a/src/backend/base.py +++ b/src/backend/base.py @@ -89,7 +89,6 @@ class Backend(object): def run_task(self, task, *args, **kwargs): tasks = { "cleanup-messages" : self.messages.queue.cleanup, - "rebake-wiki" : self.wiki.rebake, "scan-files" : self.releases.scan_files, "send-all-messages" : self.messages.queue.send_all, "update-blog-feeds" : self.blog.update_feeds, diff --git a/src/backend/wiki.py b/src/backend/wiki.py index 72383672..746d1f3e 100644 --- a/src/backend/wiki.py +++ b/src/backend/wiki.py @@ -66,9 +66,6 @@ class Wiki(misc.Object): page = self._get_page("INSERT INTO wiki(page, author_uid, markdown, changes, address) \ VALUES(%s, %s, %s, %s, %s) RETURNING *", page, author.uid, content or None, changes, address) - # Render markdown - page.bake() - # Send email to all watchers page._send_watcher_emails(excludes=[author]) @@ -82,19 +79,6 @@ class Wiki(misc.Object): # Just creates a blank last version of the page self.create_page(page, author=author, content=None, **kwargs) - @tornado.gen.coroutine - def rebake(self): - """ - Re-renders all wiki pages - """ - pages = self._get_pages("SELECT * FROM wiki ORDER BY timestamp DESC") - - for page in pages: - logging.info("Baking %s from %s" % (page.page, page.timestamp)) - - with self.db.transaction(): - page.bake() - def make_breadcrumbs(self, url): # Split and strip all empty elements (double slashes) parts = list(e for e in url.split("/") if e) @@ -341,15 +325,7 @@ class Page(misc.Object): @property def html(self): - return self.data.html or self._render(self.markdown) - - def bake(self): - """ - Renders the page's markdown to HTML and stores - it in the database. - """ - self.db.execute("UPDATE wiki SET html = %s WHERE id = %s", - self._render(self.markdown), self.id) + return self._render(self.markdown) @property def timestamp(self): -- 2.39.2