Remove WikiPage.info refs #148
This commit is contained in:
parent
242e317e65
commit
0bcfaba807
|
@ -30,10 +30,12 @@ def rebuild_index():
|
||||||
continue
|
continue
|
||||||
name = filename_to_cname(page['path'])
|
name = filename_to_cname(page['path'])
|
||||||
# TODO add email?
|
# TODO add email?
|
||||||
|
# TODO I have concens about indexing the commit info from latest revision, see #148
|
||||||
|
info = next(page.history)
|
||||||
body = dict(name=name,
|
body = dict(name=name,
|
||||||
content=page.data,
|
content=page.data,
|
||||||
message=page.info['message'],
|
message=info['message'],
|
||||||
username=page.info['author'],
|
username=info['author'],
|
||||||
updated_on=entry['mtime'],
|
updated_on=entry['mtime'],
|
||||||
created_on=entry['ctime'])
|
created_on=entry['ctime'])
|
||||||
search.index_wiki(name, body)
|
search.index_wiki(name, body)
|
||||||
|
|
|
@ -89,17 +89,6 @@ class WikiPage(object):
|
||||||
cache.set(cache_key, data)
|
cache.set(cache_key, data)
|
||||||
return data
|
return data
|
||||||
|
|
||||||
@property
|
|
||||||
def info(self):
|
|
||||||
cache_key = self._cache_key('info')
|
|
||||||
cached = cache.get(cache_key)
|
|
||||||
if cached:
|
|
||||||
return cached
|
|
||||||
|
|
||||||
info = next(self.history)
|
|
||||||
cache.set(cache_key, info)
|
|
||||||
return info
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def history(self):
|
def history(self):
|
||||||
"""Get page history.
|
"""Get page history.
|
||||||
|
|
|
@ -41,7 +41,7 @@ class WikiTest(WikiBaseTest):
|
||||||
self.assert_200(rv)
|
self.assert_200(rv)
|
||||||
|
|
||||||
self.assert_context('name', 'test')
|
self.assert_context('name', 'test')
|
||||||
eq_(self.get_context_variable('page').info['message'], 'test message')
|
eq_(next(self.get_context_variable('page').history)['message'], 'test message')
|
||||||
eq_(self.get_context_variable('page').data, 'testing')
|
eq_(self.get_context_variable('page').data, 'testing')
|
||||||
|
|
||||||
def test_history(self):
|
def test_history(self):
|
||||||
|
|
|
@ -96,7 +96,8 @@ def edit(name):
|
||||||
return render_template('wiki/edit.html',
|
return render_template('wiki/edit.html',
|
||||||
name=cname,
|
name=cname,
|
||||||
content=page.data,
|
content=page.data,
|
||||||
info=page.info,
|
# TODO: Remove this? See #148
|
||||||
|
info=next(page.history),
|
||||||
sha=page.sha,
|
sha=page.sha,
|
||||||
partials=page.partials)
|
partials=page.partials)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue