[Zope-Checkins] CVS: Zope/lib/python/OFS -
ObjectManager.py:1.163.12.8
Stuart Bishop
zen at shangri-la.dropbear.id.au
Tue Mar 23 01:04:08 EST 2004
Update of /cvs-repository/Zope/lib/python/OFS
In directory cvs.zope.org:/tmp/cvs-serv17853/lib/python/OFS
Modified Files:
Tag: Zope-2_7-branch
ObjectManager.py
Log Message:
ObjectManager no longer raises string exceptions
=== Zope/lib/python/OFS/ObjectManager.py 1.163.12.7 => 1.163.12.8 ===
--- Zope/lib/python/OFS/ObjectManager.py:1.163.12.7 Wed Mar 17 17:48:10 2004
+++ Zope/lib/python/OFS/ObjectManager.py Tue Mar 23 01:04:05 2004
@@ -48,8 +48,6 @@
bad_id=re.compile(r'[^a-zA-Z0-9-_~,.$\(\)# ]').search #TS
-BadRequestException = 'Bad Request'
-
def checkValidId(self, id, allow_dup=0):
# If allow_dup is false, an error will be raised if an object
# with the given id already exists. If allow_dup is true,
@@ -59,17 +57,17 @@
if not id or not isinstance(id, StringType):
if isinstance(id, UnicodeType): id = escape(id)
- raise BadRequestException, ('Empty or invalid id specified', id)
+ raise BadRequest, ('Empty or invalid id specified', id)
if bad_id(id) is not None:
- raise BadRequestException, (
+ raise BadRequest, (
'The id "%s" contains characters illegal in URLs.' % escape(id))
- if id in ('.', '..'): raise BadRequestException, (
+ if id in ('.', '..'): raise BadRequest, (
'The id "%s" is invalid because it is not traversable.' % id)
- if id.startswith('_'): raise BadRequestException, (
+ if id.startswith('_'): raise BadRequest, (
'The id "%s" is invalid because it begins with an underscore.' % id)
- if id.startswith('aq_'): raise BadRequestException, (
+ if id.startswith('aq_'): raise BadRequest, (
'The id "%s" is invalid because it begins with "aq_".' % id)
- if id.endswith('__'): raise BadRequestException, (
+ if id.endswith('__'): raise BadRequest, (
'The id "%s" is invalid because it ends with two underscores.' % id)
if not allow_dup:
obj = getattr(self, id, None)
@@ -80,16 +78,16 @@
if hasattr(aq_base(self), id):
# The object is located in this ObjectManager.
if not flags & REPLACEABLE:
- raise BadRequestException, (
+ raise BadRequest, (
'The id "%s" is invalid - it is already in use.' % id)
# else the object is replaceable even if the UNIQUE
# flag is set.
elif flags & UNIQUE:
- raise BadRequestException, ('The id "%s" is reserved.' % id)
+ raise BadRequest, ('The id "%s" is reserved.' % id)
if id == 'REQUEST':
- raise BadRequestException, 'REQUEST is a reserved name.'
+ raise BadRequest, 'REQUEST is a reserved name.'
if '/' in id:
- raise BadRequestException, (
+ raise BadRequest, (
'The id "%s" contains characters illegal in URLs.' % id)
class BeforeDeleteException( Exception ): pass # raise to veto deletion
@@ -527,7 +525,7 @@
"""Import an object from a file"""
dirname, file=os.path.split(file)
if dirname:
- raise BadRequestException, 'Invalid file name %s' % escape(file)
+ raise BadRequest, 'Invalid file name %s' % escape(file)
cfg = getConfiguration()
for impath in (cfg.instancehome, cfg.zopehome):
@@ -535,7 +533,7 @@
if os.path.exists(filepath):
break
else:
- raise BadRequestException, 'File does not exist: %s' % escape(file)
+ raise BadRequest, 'File does not exist: %s' % escape(file)
self._importObjectFromFile(filepath, verify=not not REQUEST,
set_owner=set_owner)
More information about the Zope-Checkins
mailing list