Mercurial > wikked
view wikked/tasks.py @ 239:0e87dc411fe9
Better way to manage updating the wiki.
* Make the difference between updating just a single page, and updating the
whole wiki.
* Properly resolve a just-updated page, but postpone resolving all the rest
if we're using background updates.
* Don't flatten single metas for the web UI.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Tue, 25 Mar 2014 22:09:14 -0700 |
parents | a4a64d6b66cb |
children | 68d6524a8333 |
line wrap: on
line source
import logging from celery import Celery from wiki import Wiki, WikiParameters logger = logging.getLogger(__name__) #TODO: Make those settings configurable! app = Celery( 'wikked', broker='amqp://', backend='amqp://', include=['wikked.tasks']) class wiki_session(object): def __init__(self, wiki_root): self.wiki_root = wiki_root self.wiki = None def __enter__(self): params = WikiParameters(root=self.wiki_root) self.wiki = Wiki(params) self.wiki.start(False) return self.wiki def __exit__(self, type, value, traceback): if self.wiki.db.session: self.wiki.db.session.remove() return False @app.task def update_wiki(wiki_root): with wiki_session(wiki_root) as wiki: wiki._postSetPageUpdate()