Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
2710c406
Commit
2710c406
authored
Feb 02, 2003
by
Andreas Jung
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Collector #695: Object IDs "." and ".." are no longer permitted.
parent
0f37e816
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
12 deletions
+20
-12
doc/CHANGES.txt
doc/CHANGES.txt
+2
-0
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+18
-12
No files found.
doc/CHANGES.txt
View file @
2710c406
...
@@ -43,6 +43,8 @@ Zope Changes
...
@@ -43,6 +43,8 @@ Zope Changes
Bugs Fixed
Bugs Fixed
- Collector #695: Object IDs "." and ".." are no longer permitted.
- Collector #771: ZCatalog failed to index DTML Document if the name
- Collector #771: ZCatalog failed to index DTML Document if the name
of a catalog metadata was identical with the name of an acquired
of a catalog metadata was identical with the name of an acquired
object.
object.
...
...
lib/python/OFS/ObjectManager.py
View file @
2710c406
...
@@ -12,9 +12,9 @@
...
@@ -12,9 +12,9 @@
##############################################################################
##############################################################################
__doc__
=
"""Object Manager
__doc__
=
"""Object Manager
$Id: ObjectManager.py,v 1.1
59 2003/01/06 13:40:34
andreasjung Exp $"""
$Id: ObjectManager.py,v 1.1
60 2003/02/02 12:19:07
andreasjung Exp $"""
__version__
=
'$Revision: 1.1
59
$'
[
11
:
-
2
]
__version__
=
'$Revision: 1.1
60
$'
[
11
:
-
2
]
import
App.Management
,
Acquisition
,
Globals
,
CopySupport
,
Products
import
App.Management
,
Acquisition
,
Globals
,
CopySupport
,
Products
import
os
,
App
.
FactoryDispatcher
,
re
,
Products
import
os
,
App
.
FactoryDispatcher
,
re
,
Products
...
@@ -27,6 +27,7 @@ from webdav.NullResource import NullResource
...
@@ -27,6 +27,7 @@ from webdav.NullResource import NullResource
from
webdav.Collection
import
Collection
from
webdav.Collection
import
Collection
from
Acquisition
import
aq_base
from
Acquisition
import
aq_base
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
webdav.Lockable
import
ResourceLockedError
from
urllib
import
quote
from
urllib
import
quote
from
cStringIO
import
StringIO
from
cStringIO
import
StringIO
import
marshal
import
marshal
...
@@ -59,12 +60,14 @@ def checkValidId(self, id, allow_dup=0):
...
@@ -59,12 +60,14 @@ def checkValidId(self, id, allow_dup=0):
if
bad_id
(
id
)
is
not
None
:
if
bad_id
(
id
)
is
not
None
:
raise
BadRequestException
,
(
raise
BadRequestException
,
(
'The id "%s" contains characters illegal in URLs.'
%
escape
(
id
))
'The id "%s" contains characters illegal in URLs.'
%
escape
(
id
))
if
id
[
0
]
==
'_'
:
raise
BadRequestException
,
(
if
id
in
(
'.'
,
'..'
):
raise
BadRequestException
,
(
'The id "%s" is invalid - it begins with an underscore.'
%
id
)
'The id "%s" is invalid because it is not traversable.'
%
id
)
if
id
[:
3
]
==
'aq_'
:
raise
BadRequestException
,
(
if
id
.
startswith
(
'_'
):
raise
BadRequestException
,
(
'The id "%s" is invalid - it begins with "aq_".'
%
id
)
'The id "%s" is invalid because it begins with an underscore.'
%
id
)
if
id
[
-
2
:]
==
'__'
:
raise
BadRequestException
,
(
if
id
.
startswith
(
'aq_'
):
raise
BadRequestException
,
(
'The id "%s" is invalid - it ends with two underscores.'
%
id
)
'The id "%s" is invalid because it begins with "aq_".'
%
id
)
if
id
.
endswith
(
'__'
):
raise
BadRequestException
,
(
'The id "%s" is invalid because it ends with two underscores.'
%
id
)
if
not
allow_dup
:
if
not
allow_dup
:
obj
=
getattr
(
self
,
id
,
None
)
obj
=
getattr
(
self
,
id
,
None
)
if
obj
is
not
None
:
if
obj
is
not
None
:
...
@@ -74,8 +77,8 @@ def checkValidId(self, id, allow_dup=0):
...
@@ -74,8 +77,8 @@ def checkValidId(self, id, allow_dup=0):
if
hasattr
(
aq_base
(
self
),
id
):
if
hasattr
(
aq_base
(
self
),
id
):
# The object is located in this ObjectManager.
# The object is located in this ObjectManager.
if
not
flags
&
REPLACEABLE
:
if
not
flags
&
REPLACEABLE
:
raise
BadRequestException
,
(
'The id "%s" is invalid--'
raise
BadRequestException
,
(
'
it is already in use.'
%
id
)
'The id "%s" is invalid -
it is already in use.'
%
id
)
# else the object is replaceable even if the UNIQUE
# else the object is replaceable even if the UNIQUE
# flag is set.
# flag is set.
elif
flags
&
UNIQUE
:
elif
flags
&
UNIQUE
:
...
@@ -84,8 +87,7 @@ def checkValidId(self, id, allow_dup=0):
...
@@ -84,8 +87,7 @@ def checkValidId(self, id, allow_dup=0):
raise
BadRequestException
,
'REQUEST is a reserved name.'
raise
BadRequestException
,
'REQUEST is a reserved name.'
if
'/'
in
id
:
if
'/'
in
id
:
raise
BadRequestException
,
(
raise
BadRequestException
,
(
'The id "%s" contains characters illegal in URLs.'
%
id
'The id "%s" contains characters illegal in URLs.'
%
id
)
)
class
BeforeDeleteException
(
Exception
):
pass
# raise to veto deletion
class
BeforeDeleteException
(
Exception
):
pass
# raise to veto deletion
class
BreakoutException
(
Exception
):
pass
# raised to break out of loops
class
BreakoutException
(
Exception
):
pass
# raised to break out of loops
...
@@ -440,6 +442,10 @@ class ObjectManager(
...
@@ -440,6 +442,10 @@ class ObjectManager(
while
ids
:
while
ids
:
id
=
ids
[
-
1
]
id
=
ids
[
-
1
]
v
=
self
.
_getOb
(
id
,
self
)
v
=
self
.
_getOb
(
id
,
self
)
if
v
.
wl_isLocked
():
raise
ResourceLockedError
,
'Object "%s" is locked via WebDAV'
%
v
.
getId
()
if
v
is
self
:
if
v
is
self
:
raise
'BadRequest'
,
'%s does not exist'
%
escape
(
ids
[
-
1
])
raise
'BadRequest'
,
'%s does not exist'
%
escape
(
ids
[
-
1
])
self
.
_delObject
(
id
)
self
.
_delObject
(
id
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment