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
e9b5dde3
Commit
e9b5dde3
authored
Oct 04, 2005
by
Florent Guillaume
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The '@' character is now allowed in object ids (RFC 1738 allows it).
Expanded tests for _checkId.
parent
17065825
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
1 deletion
+38
-1
doc/CHANGES.txt
doc/CHANGES.txt
+2
-0
lib/python/OFS/ObjectManager.py
lib/python/OFS/ObjectManager.py
+1
-1
lib/python/OFS/tests/testObjectManager.py
lib/python/OFS/tests/testObjectManager.py
+35
-0
No files found.
doc/CHANGES.txt
View file @
e9b5dde3
...
...
@@ -29,6 +29,8 @@ Zope Changes
- Collector #1118: Added syntax to dtml-sqlgroup to support flexible
generation of 'UPDATE' statements (bounty sponsored by Logicalware).
- The '@' character is now allowed in object ids (RFC 1738 allows it).
Bugs Fixed
- Collector #1863: Prevent possibly sensitive information to leak via
...
...
lib/python/OFS/ObjectManager.py
View file @
e9b5dde3
...
...
@@ -49,7 +49,7 @@ customImporters={
XMLExportImport
.
magic
:
XMLExportImport
.
importXML
,
}
bad_id
=
re
.
compile
(
r'[^a-zA-Z0-9-_~,.$\
(
\)#
]'
).
search
#TS
bad_id
=
re
.
compile
(
r'[^a-zA-Z0-9-_~,.$\
(
\)#
@]'
).
search
def
checkValidId
(
self
,
id
,
allow_dup
=
0
):
# If allow_dup is false, an error will be raised if an object
...
...
lib/python/OFS/tests/testObjectManager.py
View file @
e9b5dde3
...
...
@@ -303,6 +303,41 @@ class ObjectManagerTests( unittest.TestCase ):
om2
.
_setObject
(
ob
.
getId
(),
ob
)
self
.
assertRaises
(
DeleteFailed
,
om1
.
_delObject
,
'om2'
)
def
test_setObject_checkId_ok
(
self
):
om
=
self
.
_makeOne
()
si
=
SimpleItem
(
'1'
)
om
.
_setObject
(
'AB-dash_under0123'
,
si
)
si
=
SimpleItem
(
'2'
)
om
.
_setObject
(
'ho.bak~'
,
si
)
si
=
SimpleItem
(
'3'
)
om
.
_setObject
(
'dot.comma,dollar$(hi)hash# space'
,
si
)
si
=
SimpleItem
(
'4'
)
om
.
_setObject
(
'b@r'
,
si
)
si
=
SimpleItem
(
'5'
)
om
.
_setObject
(
'..haha'
,
si
)
si
=
SimpleItem
(
'6'
)
om
.
_setObject
(
'.bashrc'
,
si
)
def
test_setObject_checkId_bad
(
self
):
from
zExceptions
import
BadRequest
om
=
self
.
_makeOne
()
si
=
SimpleItem
(
'111'
)
om
.
_setObject
(
'111'
,
si
)
si
=
SimpleItem
(
'2'
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
123
,
si
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
'a
\
x01
b'
,
si
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
'a
\
\
b'
,
si
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
'a:b'
,
si
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
'a;b'
,
si
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
'.'
,
si
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
'..'
,
si
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
'_foo'
,
si
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
'aq_me'
,
si
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
'bah__'
,
si
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
'111'
,
si
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
'REQUEST'
,
si
)
self
.
assertRaises
(
BadRequest
,
om
.
_setObject
,
'/'
,
si
)
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
ObjectManagerTests
)
)
...
...
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