Commit 162f20b0 authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: Initialize ZSQLMethod class from SQLMethod __init__

parent 0e05c4e1
...@@ -44,6 +44,9 @@ manage_addSQLMethodForm = DTMLFile('../dtml/addSQLMethod', globals()) ...@@ -44,6 +44,9 @@ manage_addSQLMethodForm = DTMLFile('../dtml/addSQLMethod', globals())
# New ZSQLMethod addition function # New ZSQLMethod addition function
def manage_addSQLMethod(self, id, title='', def manage_addSQLMethod(self, id, title='',
connection_id = '',
arguments = '',
template = '',
REQUEST=None, REQUEST=None,
*args, *args,
**kw): **kw):
...@@ -53,7 +56,9 @@ def manage_addSQLMethod(self, id, title='', ...@@ -53,7 +56,9 @@ def manage_addSQLMethod(self, id, title='',
id = str(id) id = str(id)
title = str(title) title = str(title)
c = SQLMethod(id, self) # Create SQLMethod object container
c = SQLMethod(id, title, connection_id, arguments, template, self)
self._setObject(id, c) self._setObject(id, c)
c = self._getOb(id) c = self._getOb(id)
if REQUEST is not None: if REQUEST is not None:
...@@ -75,6 +80,9 @@ class SQLMethod(XMLObject, ZSQL): ...@@ -75,6 +80,9 @@ class SQLMethod(XMLObject, ZSQL):
# Add constructor methods # Add constructor methods
constructors = (manage_addSQLMethodForm, manage_addSQLMethod) constructors = (manage_addSQLMethodForm, manage_addSQLMethod)
# 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 # View content list, Force /view, Standart option in python scripts
manage_options = ( XMLObject.manage_options[0], manage_options = ( XMLObject.manage_options[0],
{'icon':'', 'label':'View','action':'view'}) \ {'icon':'', 'label':'View','action':'view'}) \
...@@ -88,8 +96,22 @@ class SQLMethod(XMLObject, ZSQL): ...@@ -88,8 +96,22 @@ class SQLMethod(XMLObject, ZSQL):
, PropertySheet.SQLMethod , PropertySheet.SQLMethod
) )
def __init__(self, id, *args, **kw): def __init__(self, id, title='',
connection_id = '',
arguments = '',
template = '',
*args, **kw):
"""
Assign attributes to this class and override ZSQL init method to have
consistency with manage_edit(as ZSQL init also creates manage_edit)
"""
# 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.id = id
self.title = title
self.connection_id = connection_id
self.arguments = arguments
self.template = template
# Do we really need to initialize XMLObject class ? # Do we really need to initialize XMLObject class ?
#XMLObject.__init__(self, *args, **kw) #XMLObject.__init__(self, *args, **kw)
ZSQL.__init__(self, id, title, connection_id, arguments, template)
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