[FIX] Wiki: yml issue

An osv_memory object need not be created, but just reference an arbitrary
id. Let the page have some modifications, and then search its history for

bzr revid: hmo@tinyerp.com-20100901115823-agwkfnmu04yo67nn
This commit is contained in:
P. Christeas 2010-09-01 17:28:23 +05:30 committed by Harry (OpenERP)
parent 297ba866c0
commit 4ecbf905cc
3 changed files with 23 additions and 13 deletions

View File

@ -21,24 +21,34 @@
FAQs, quality manuals, technical references, etc.
'
-
Creating a wiki make index record
-
!record {model: wiki.make.index, id: wiki_make_index_1}:
{}
-
I create Index on this current page by clicking on "Create Index" wizard
-
!python {model: wiki.make.index}: |
self.wiki_do_index(cr, uid, [ref("wiki_make_index_1")], {"active_model":
wiki.wiki, "active_ids": [ref("wiki_wiki_openerpwikiediting0")], "tz": False, "active_id":
ref("wiki_wiki_openerpwikiediting0"), })
self.wiki_do_index(cr, uid, [1], {"active_model": "wiki.wiki",
"active_ids": [ref("wiki_wiki_openerpwikiediting0")], "tz": False,
"active_id": ref("wiki_wiki_openerpwikiediting0"), })
-
Now I will update the wikipage with other text
-
!record {model: wiki.wiki, id: wiki_wiki_openerpwikiediting0}:
text_area: '=The Open ERP wiki=
The Open ERP wiki allows you to manage your enterprise contents using wiki
restructured texts. This module provides a collaborative way to manage internal
FAQs, quality manuals, technical references, etc.
Wiki text can easily be edited
'
-
I check the page history for the current page by clicking on "Page History".After that find difference between history.
-
!python {model: wizard.wiki.history.show_diff}: |
ids = self.search(cr, uid, [])
self.get_diff(cr, uid, {'active_id': [ref('wiki_wiki_openerpwikiediting0')]})
hist_obj = model.pool.get('wiki.wiki.history')
ids = hist_obj.search(cr, uid, [('wiki_id', '=', ref("wiki_wiki_openerpwikiediting0"))])
model.get_diff(cr, uid, {'active_ids': ids[:] })
-
I create a new wiki group on the Given Home Page
-

View File

@ -222,7 +222,7 @@ class History(osv.osv):
'write_uid': lambda obj, cr, uid, context: uid,
}
def getDiff(self, cr, uid, v1, v2, context={}):
def getDiff(self, cr, uid, v1, v2, context=None):
""" @param cr: the current row, from the database cursor,
@param uid: the current users ID for security checks, """
@ -236,7 +236,7 @@ class History(osv.osv):
if text2:
line2 = text2.splitlines(1)
if (not line1 and not line2) or (line1 == line2):
raise osv.except_osv(_('Warning !'), _('There are no chnages in revisions'))
raise osv.except_osv(_('Warning !'), _('There are no changes in revisions'))
diff = difflib.HtmlDiff()
return diff.make_file(line1, line2, "Revision-%s" % (v1), "Revision-%s" % (v2), context=False)

View File

@ -34,7 +34,7 @@ class showdiff(osv.osv_memory):
@param uid: the current users ID for security checks,
"""
history = self.pool.get('wiki.wiki.history')
ids = context.get('active_ids')
ids = context.get('active_ids', [])
diff = ""
if len(ids) == 2: