NameChooser in zope.app.container.contained sometimes doesn't choose a valid name and raises an exception
Bug #227617 reported by
Christian Zagrodnick
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 3 |
Won't Fix
|
Medium
|
Christophe Combelles | ||
zope.container |
Fix Released
|
Medium
|
Christophe Combelles |
Bug Description
The INameChooser interface isn't very explicit about chooseName's behaviour:
def chooseName(name, object):
"""Choose a unique valid name for the object
The given name and object may be taken into account when
choosing the name.
"""
For me this reads: choose a name which I can use and never raise an exception. Currently chooseName can raise a UserError: "Names cannot begin with '+' or '@' or contain '/'"
I suggest letting chooseName remove + and @ at the beginning and replace / by - to prevent that and to generate a valid name.
Changed in zope3: | |
assignee: | nobody → zagy |
importance: | Undecided → Low |
Changed in zope.container: | |
status: | Confirmed → Fix Committed |
To post a comment you must log in.
discussed here: mail.zope. org/pipermail/ zope3-dev/ 2007-October/ 024141. html mail.zope. org/pipermail/ zope-dev/ 2008-February/ 030920. html
http://
and here:
http://
I also believe that chooseName should just choose a name, and not raise an exception.
chooseName should be implemented so that it agrees with checkName: if checkName does not allow some characters, chooseName should remove these characters in the generated name.
And the INameChooser interface should talk about this failsafe behaviour.