Commit b11840d6 authored by Yusei Tahara's avatar Yusei Tahara

Fixed a bug that Proxyfield.getTemplateField raise error when proxyfield does...

Fixed a bug that Proxyfield.getTemplateField raise error when proxyfield does not have template field.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16514 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent b575837a
...@@ -593,4 +593,6 @@ class ProxyField(ZMIField): ...@@ -593,4 +593,6 @@ class ProxyField(ZMIField):
getTransactionalVariable(self)[self._getCacheId()] = field getTransactionalVariable(self)[self._getCacheId()] = field
def _getTemplateFieldCache(self): def _getTemplateFieldCache(self):
if self.aq_parent:
raise KeyError
return getTransactionalVariable(self)[self._getCacheId()].__of__(self.aq_parent) return getTransactionalVariable(self)[self._getCacheId()].__of__(self.aq_parent)
...@@ -129,6 +129,8 @@ class TestProxyField(unittest.TestCase): ...@@ -129,6 +129,8 @@ class TestProxyField(unittest.TestCase):
self.container.Base_view.manage_addField( self.container.Base_view.manage_addField(
'my_title', 'Not Title', 'ProxyField') 'my_title', 'Not Title', 'ProxyField')
proxy_field = self.container.Base_view.my_title proxy_field = self.container.Base_view.my_title
self.assertEquals(None, proxy_field.getTemplateField())
proxy_field.manage_edit_xmlrpc(dict(form_id='Base_viewProxyFieldLibrary', proxy_field.manage_edit_xmlrpc(dict(form_id='Base_viewProxyFieldLibrary',
field_id='my_title',)) field_id='my_title',))
self.assertEquals(original_field, proxy_field.getTemplateField()) self.assertEquals(original_field, proxy_field.getTemplateField())
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment