Create WikiPage class to encapsulate wiki page functions
This commit is contained in:
parent
ac79d186ec
commit
d50cf54072
5 changed files with 252 additions and 242 deletions
|
@ -31,9 +31,9 @@ def rebuild_index():
|
|||
name = filename_to_cname(page['path'])
|
||||
# TODO add email?
|
||||
body = dict(name=name,
|
||||
content=page['data'],
|
||||
message=page['info']['message'],
|
||||
username=page['info']['author'],
|
||||
content=page.data,
|
||||
message=page.info['message'],
|
||||
username=page.info['author'],
|
||||
updated_on=entry['mtime'],
|
||||
created_on=entry['ctime'])
|
||||
search.index_wiki(name, body)
|
||||
|
|
|
@ -47,7 +47,7 @@ class SimpleSearch(BaseSearch):
|
|||
|
||||
# this can be None, not sure how
|
||||
if page:
|
||||
res.append(dict(name=name, content=page['data']))
|
||||
res.append(dict(name=name, content=page.data))
|
||||
return res
|
||||
|
||||
def users(self, query):
|
||||
|
@ -129,7 +129,7 @@ class WhooshSearch(BaseSearch):
|
|||
res = []
|
||||
for hit in results:
|
||||
name = hit["path"]
|
||||
page_data = g.current_wiki.get_page(name)["data"].decode("utf-8")
|
||||
page_data = g.current_wiki.get_page(name).data.decode("utf-8")
|
||||
content = hit.highlights('body', text=page_data)
|
||||
|
||||
res.append(dict(name=name, content=content))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue