Commit afc2e4d2 authored by Ayush Tiwari's avatar Ayush Tiwari

erp5_catalog: Add ERP5 SQL Methods objects

ERP5 SQL Methods would be the next step in shifting from Zope base catalog
to ERP5 Catalog. ZSQLMethods are used extensively inside the catalog,
so the better option would be to make an ERP5 object for them.
parent d0824633
##############################################################################
#
# Copyright (c) 2010 Nexedi SARL and Contributors. All Rights Reserved.
# Sebastien Robin <seb@nexedi.com>
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
# consequences resulting from its eventual inadequacies and bugs
# End users who are looking for a ready-to-use solution with commercial
# garantees and support are strongly adviced to contract a Free Software
# Service Company
#
# This program is Free Software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#
##############################################################################
from AccessControl import ClassSecurityInfo
from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type import Permissions, PropertySheet
from App.special_dtml import HTMLFile
from Products.ERP5Type.XMLObject import XMLObject
from Products.PythonScripts.PythonScript import \
PythonScript as ZopePythonScript
from Products.ZSQLMethods.SQL import SQL as ZSQL
# Migration function
def migrateSQLMethodToERP5Object(self, id, title=''):
pass
# New ZSQLMethod addition function
def addSQLMethod(self, id, title=''):
pass
class SQLMethod(XMLObject, ZSQL):
"""SQLMethod for ERP5.
"""
meta_type = 'ERP5 SQL Method'
portal_type = 'SQL Method'
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
#View content list, Force /view, Standart option in python scripts
manage_options = ( XMLObject.manage_options[0],
{'icon':'', 'label':'View','action':'view'}) \
+ ZSQL.manage_options
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.SQLMethod
)
def __init__(self, *args, **kw):
"""
Override to initialize ZSQLMethod
"""
XMLObject.__init__(self, *args, **kw)
ZSQL.__init__(self, *args, **kw)
InitializeClass(SQLMethod)
\ No newline at end of file
......@@ -5,4 +5,7 @@
<portal_type id="Catalog Tool">
<item>CatalogTool</item>
</portal_type>
<portal_type id="SQL Method">
<item>SQLMethod</item>
</portal_type>
</property_sheet_list>
\ No newline at end of file
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Base Type" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>content_icon</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>SQL Method</string> </value>
</item>
<item>
<key> <string>init_script</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>permission</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Base Type</string> </value>
</item>
<item>
<key> <string>type_interface</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>type_mixin</string> </key>
<value>
<tuple/>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
Catalog
Catalog Tool
\ No newline at end of file
Catalog Tool
SQL Method
\ No newline at end of file
Catalog Tool | CatalogTool
Catalog | Catalog
\ No newline at end of file
Catalog | Catalog
SQL Method | SQLMethod
\ No newline at end of file
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