From 4ecbf905cc2710e742eae491f0f3c833f303cb1b Mon Sep 17 00:00:00 2001 From: "P. Christeas" Date: Wed, 1 Sep 2010 17:28:23 +0530 Subject: [PATCH] [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 --- addons/wiki/test/wiki_test00.yml | 30 ++++++++++++++++++---------- addons/wiki/wiki.py | 4 ++-- addons/wiki/wizard/wiki_show_diff.py | 2 +- 3 files changed, 23 insertions(+), 13 deletions(-) diff --git a/addons/wiki/test/wiki_test00.yml b/addons/wiki/test/wiki_test00.yml index c77e714b961..d5a9cbc4bbb 100755 --- a/addons/wiki/test/wiki_test00.yml +++ b/addons/wiki/test/wiki_test00.yml @@ -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 - diff --git a/addons/wiki/wiki.py b/addons/wiki/wiki.py index 2cf22170cec..ab19dc8f4eb 100644 --- a/addons/wiki/wiki.py +++ b/addons/wiki/wiki.py @@ -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 user’s 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) diff --git a/addons/wiki/wizard/wiki_show_diff.py b/addons/wiki/wizard/wiki_show_diff.py index 7654ce3e153..43f3f698611 100644 --- a/addons/wiki/wizard/wiki_show_diff.py +++ b/addons/wiki/wizard/wiki_show_diff.py @@ -34,7 +34,7 @@ class showdiff(osv.osv_memory): @param uid: the current user’s 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: