Commit 47e1c43e authored by Vincent Pelletier's avatar Vincent Pelletier

Use the final name for zsql methods.

Cleanup docstring.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9897 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 682ad706
...@@ -172,12 +172,9 @@ class IdTool(UniqueObject, Folder): ...@@ -172,12 +172,9 @@ class IdTool(UniqueObject, Folder):
persistant mapping to be persistent. persistant mapping to be persistent.
We use MySQL to generate an ID, because it is atomic and we don't want We use MySQL to generate an ID, because it is atomic and we don't want
to generate any conflict at zope level. The possible downfall is that to generate any conflict at zope level. The possible downfall is that
some IDs might be skipped because of failed transactions (MySQL is not some IDs might be skipped because of failed transactions.
and must not be rolled back). "Length" is because the id is stored in a python object inspired by
2 ZSQL methods are required for this method to work : BTrees.Length. It doesn't have to be a length.
-
"Length" because the id is stored in a BTrees.Length. It doesn't have
to be a length.
""" """
if getattr(self, 'dict_length_ids', None) is None: if getattr(self, 'dict_length_ids', None) is None:
self.dict_length_ids = PersistentMapping() self.dict_length_ids = PersistentMapping()
...@@ -187,8 +184,9 @@ class IdTool(UniqueObject, Folder): ...@@ -187,8 +184,9 @@ class IdTool(UniqueObject, Folder):
if not isinstance(id_group, str): if not isinstance(id_group, str):
id_group = repr(id_group) id_group = repr(id_group)
default = isinstance(default, int) and default or 1 default = isinstance(default, int) and default or 1
query = getattr(self, 'Base_zGenerateId') portal_catalog = self.getPortalObject().portal_catalog['erp5_mysql']
commit = getattr(self, 'Base_zCommit') query = getattr(portal_catalog, 'z_portal_ids_generate_id')
commit = getattr(portal_catalog, 'z_portal_ids_commit')
if None not in (query, commit): if None not in (query, commit):
result = query(id_group=id_group, default=default) result = query(id_group=id_group, default=default)
commit() commit()
......
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