realms-wiki/realms/modules/search/hooks.py
2014-11-17 11:25:26 -06:00

24 lines
558 B
Python

from realms.modules.wiki.models import Wiki
from realms import search
@Wiki.after('write_page')
def wiki_write_page(name, content, message=None, username=None, email=None, **kwargs):
if not hasattr(search, 'index_wiki'):
# using simple search or none
return
body = dict(name=name,
content=content,
message=message,
email=email,
username=username)
return search.index_wiki(name, body)
@Wiki.after('rename_page')
def wiki_rename_page(*args, **kwargs):
pass