Commit 2c0a145b authored by Jérome Perrin's avatar Jérome Perrin

Add API on ProxyField to edit surcharged values, similar to manage_edit_xmlrpc


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@17670 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 05a385b3
......@@ -219,6 +219,21 @@ class ProxyField(ZMIField):
return self.manage_main(self, REQUEST,
manage_tabs_message=message)
def manage_edit_surcharged_xmlrpc(self, mapping):
"""Edit surcharged properties
This method is similar to manage_edit_xmlrpc, and it marks the properties
as not delegated.
"""
self._surcharged_edit(mapping, mapping.keys())
def manage_tales_surcharged_xmlrpc(self, mapping):
"""Edit surcharged TALES
This method is similar to manage_tales_xmlrpc, and it marks the TALES
properties as not delegated.
"""
self._surcharged_tales(mapping, mapping.keys())
def _surcharged_edit(self, result, surcharge_list):
# first check for any changes
values = self.values
......
......@@ -270,6 +270,25 @@ class TestProxyField(unittest.TestCase):
# and validate
self.container.Base_view.validate_all_to_request(dict())
def test_manage_edit_surcharged_xmlrpc(self):
# manage_edit_surcharged_xmlrpc is a method to edit proxyfields
# programmatically
original_field = self.addField(self.container.Base_viewProxyFieldLibrary,
'my_string', 'String', 'StringField')
proxy_field = self.addField(self.container.Base_view,
'my_String', '', 'ProxyField')
proxy_field.manage_edit_xmlrpc(dict(form_id='Base_viewProxyFieldLibrary',
field_id='my_date',))
proxy_field.manage_edit_surcharged_xmlrpc(dict(title='Title'))
self.assertFalse(proxy_field.is_delegated('title'))
self.assertEquals('Title', proxy_field.get_value('title'))
# beware that all values that are not passed in the mapping will be
# delegated again, regardless of the old state.
proxy_field.manage_edit_surcharged_xmlrpc(dict())
self.assertTrue(proxy_field.is_delegated('title'))
class TestFieldValueCache(unittest.TestCase):
"""Tests field value caching system
......
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