[FIX] some domains and contexts have leading or trailing slashes, need to strip them before evaluation

bzr revid: xmo@openerp.com-20110401094835-k1w7xlgdcyppt7io
This commit is contained in:
Xavier Morel 2011-04-01 11:48:35 +02:00
parent a806fe63cc
commit f40d778c2e
2 changed files with 4 additions and 4 deletions

View File

@ -408,7 +408,7 @@ class View(openerpweb.Controller):
:param session: Current OpenERP session
:type session: openerpweb.openerpweb.OpenERPSession
"""
domain = elem.get(attr_name)
domain = elem.get(attr_name, '').strip()
if domain:
try:
elem.set(
@ -433,7 +433,7 @@ class View(openerpweb.Controller):
"""
self.parse_domain(elem, 'domain', session)
self.parse_domain(elem, 'filter_domain', session)
context_string = elem.get('context')
context_string = elem.get('context', '').strip()
if context_string:
try:
elem.set('context',

View File

@ -32,7 +32,7 @@ class ViewTest(unittest2.TestCase):
def test_convert_literal_domain(self):
e = xml.etree.ElementTree.Element(
'field', domain="[('somefield', '=', 3)]")
'field', domain=" [('somefield', '=', 3)] ")
self.view.parse_domains_and_contexts(e, None)
self.assertEqual(
@ -75,7 +75,7 @@ class ViewTest(unittest2.TestCase):
def test_convert_literal_context(self):
e = xml.etree.ElementTree.Element(
'field', context="{'some_prop': 3}")
'field', context=" {'some_prop': 3} ")
self.view.parse_domains_and_contexts(e, None)
self.assertEqual(