Commit 120b0686 authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: Override _setArgument property setter and use it to update other attributes

parent 8c7160b4
......@@ -83,9 +83,8 @@ class SQLMethod(XMLObject, ZSQL):
# Override manage and manage_main with ZSQL manage and manage_main respectively
manage = manage_main = ZSQL.manage
# View content list, Force /view, Standart option in python scripts
manage_options = ( XMLObject.manage_options[0],
{'icon':'', 'label':'View','action':'view'}) \
# View content list, Force /view, Standard option in SQLMethod
manage_options = ({'icon':'', 'label':'View','action':'view'},) \
+ ZSQL.manage_options
# Declarative properties
......@@ -96,11 +95,19 @@ class SQLMethod(XMLObject, ZSQL):
, PropertySheet.SQLMethod
)
# Inheritence conflicts solved
__call__ = ZSQL.__call__
__getitem__ = ZSQL.__getitem__
PUT = ZSQL.PUT
index_html = ZSQL.index_html
manage_FTPget = ZSQL.manage_FTPget
dav__init = ZSQL.dav__init
def __init__(self, id, title='',
connection_id = '',
arguments = '',
template = '',
*args, **kw):
template = ''
):
"""
Assign attributes to this class and override ZSQL init method to have
consistency with manage_edit(as ZSQL init also creates manage_edit)
......@@ -108,10 +115,17 @@ class SQLMethod(XMLObject, ZSQL):
# Add the properties as the attributes for the SQL Method objects
# Useful while migrating data from ZSQLMethods to ERP5 SQLMethod objects
self.id = id
self.title = title
self.connection_id = connection_id
self.arguments = arguments
self.template = template
# Do we really need to initialize XMLObject class ?
#XMLObject.__init__(self, *args, **kw)
# Initializing ZSQL class object is important as this will call manage_edit
# which will change database method properties
ZSQL.__init__(self, id, title, connection_id, arguments, template)
def _setArgument(self, value):
"""
We need to override this so as to generate _arg attribute for SQL Method.
"""
self._baseSetArgument(value)
self.manage_edit(self.title, self.connection_id, self.arguments_src,
self.src)
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