Commit 8d3d26b2 authored by Vincent Pelletier's avatar Vincent Pelletier

Make default value None. Previous code had a bad behaviour if the default...

Make default value None. Previous code had a bad behaviour if the default value was a long (it should be valid, but isinstance(long, int) is obviously False, so default fell back to "1"). Anyway, if default is an invalid value, ZSQLMethod will complain.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@16687 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 75ac8d41
...@@ -169,7 +169,7 @@ class IdTool(UniqueObject, Folder): ...@@ -169,7 +169,7 @@ class IdTool(UniqueObject, Folder):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'generateNewLengthIdList') 'generateNewLengthIdList')
def generateNewLengthIdList(self, id_group=None, id_count=1, default=1): def generateNewLengthIdList(self, id_group=None, id_count=1, default=None):
""" """
Generates a list of Ids. Generates a list of Ids.
The ids are generated using mysql and then stored in a Length object in a The ids are generated using mysql and then stored in a Length object in a
...@@ -190,7 +190,7 @@ class IdTool(UniqueObject, Folder): ...@@ -190,7 +190,7 @@ class IdTool(UniqueObject, Folder):
raise ValueError, '%s is not a valid group Id.' % (repr(id_group), ) raise ValueError, '%s is not a valid group Id.' % (repr(id_group), )
if not isinstance(id_group, str): if not isinstance(id_group, str):
id_group = repr(id_group) id_group = repr(id_group)
if not isinstance(default, int): if default is None:
default = 1 default = 1
# FIXME: A skin folder should be used to contain ZSQLMethods instead of # FIXME: A skin folder should be used to contain ZSQLMethods instead of
# default catalog, like activity tool (anyway, it uses activity tool # default catalog, like activity tool (anyway, it uses activity tool
......
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