[Erp5-report] r33377 daniele - in /erp5/trunk/products/ERP5: ERP5Site.py Tool/IdTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Thu Mar 4 13:33:36 CET 2010
Author: daniele
Date: Thu Mar 4 13:33:36 2010
New Revision: 33377
URL: http://svn.erp5.org?rev=33377&view=rev
Log:
Move zsql methods of portal ids,
this is the compatibility, it's temporary before new API of IdTool
Modified:
erp5/trunk/products/ERP5/ERP5Site.py
erp5/trunk/products/ERP5/Tool/IdTool.py
Modified: erp5/trunk/products/ERP5/ERP5Site.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/ERP5Site.py?rev=33377&r1=33376&r2=33377&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/ERP5Site.py [utf8] (original)
+++ erp5/trunk/products/ERP5/ERP5Site.py [utf8] Thu Mar 4 13:33:36 2010
@@ -1833,7 +1833,10 @@
portal_catalog = p.portal_catalog
# Clear portal ids sql table, like this we do not take
# ids for a previously created web site
- portal_catalog.getSQLCatalog().z0_drop_portal_ids()
+ # XXX It's temporary, a New API will be implemented soon
+ # the code will be change
+ p.IdTool_zDropTable()
+ p.IdTool_zCreateTable()
# Then clear the catalog and reindex it
portal_catalog.manage_catalogClear()
# Calling ERP5Site_reindexAll is useless.
Modified: erp5/trunk/products/ERP5/Tool/IdTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/IdTool.py?rev=33377&r1=33376&r2=33377&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/IdTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/IdTool.py [utf8] Thu Mar 4 13:33:36 2010
@@ -124,8 +124,13 @@
"""
Store persistently data from SQL table portal_ids.
"""
- portal_catalog = getToolByName(self, 'portal_catalog').getSQLCatalog()
- query = getattr(portal_catalog, 'z_portal_ids_dump')
+ # XXX It's temporary, a New API will be implemented soon
+ # the code will be change
+ portal = self.getPortalObject()
+ query = getattr(portal, 'IdTool_zDump', None)
+ if query is None:
+ portal_catalog = getToolByName(self, 'portal_catalog').getSQLCatalog()
+ query = getattr(portal_catalog, 'z_portal_ids_dump')
dict_length_ids = getattr(aq_base(self), 'dict_length_ids', None)
if dict_length_ids is None:
dict_length_ids = self.dict_length_ids = PersistentMapping()
@@ -157,11 +162,16 @@
if last_id is not None:
return last_id.value - 1
# otherwise check in mysql
- portal_catalog = getToolByName(self, 'portal_catalog').getSQLCatalog()
- query = getattr(portal_catalog, 'z_portal_ids_get_last_id', None)
+ # XXX It's temporary, a New API will be implemented soon
+ # the code will be change
+ portal = self.getPortalObject()
+ query = getattr(portal, 'IdTool_zGetLastId', None)
+ if query is None:
+ portal_catalog = getToolByName(self, 'portal_catalog').getSQLCatalog()
+ query = getattr(portal_catalog, 'z_portal_ids_get_last_id')
if query is None:
raise AttributeError, 'Error while getting last Id: ' \
- 'z_portal_ids_get_last_id could not ' \
+ 'IdTool_zGetLastId could not ' \
'be found.'
result = query(id_group=id_group)
if len(result):
@@ -195,12 +205,18 @@
# FIXME: A skin folder should be used to contain ZSQLMethods instead of
# default catalog, like activity tool (anyway, it uses activity tool
# ZSQLConnection, so hot reindexing is not helping here).
- portal_catalog = getToolByName(self, 'portal_catalog').getSQLCatalog()
- query = getattr(portal_catalog, 'z_portal_ids_generate_id')
- commit = getattr(portal_catalog, 'z_portal_ids_commit')
+ # XXX It's temporary, a New API will be implemented soon
+ # the code will be change
+ portal = self.getPortalObject()
+ query = getattr(portal, 'IdTool_zGenerateId', None)
+ commit = getattr(portal, 'IdTool_zCommit', None)
+ if query is None or commit is None:
+ portal_catalog = getToolByName(self, 'portal_catalog').getSQLCatalog()
+ query = getattr(portal_catalog, 'z_portal_ids_generate_id')
+ commit = getattr(portal_catalog, 'z_portal_ids_commit')
if None in (query, commit):
raise AttributeError, 'Error while generating Id: ' \
- 'z_portal_ids_generate_id and/or z_portal_ids_commit could not ' \
+ 'idTool_zGenerateId and/or idTool_zCommit could not ' \
'be found.'
try:
result = query(id_group=id_group, id_count=id_count, default=default)
More information about the Erp5-report
mailing list