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
75f69548
Commit
75f69548
authored
Sep 27, 2008
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove test which wasn't testing anything, but broke anyway.
parent
f7c4f65c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
44 deletions
+41
-44
lib/python/OFS/CopySupport.py
lib/python/OFS/CopySupport.py
+39
-37
lib/python/OFS/tests/testCopySupport.py
lib/python/OFS/tests/testCopySupport.py
+1
-1
lib/python/ZServer/tests/test_clockserver.py
lib/python/ZServer/tests/test_clockserver.py
+1
-6
No files found.
lib/python/OFS/CopySupport.py
View file @
75f69548
...
@@ -48,7 +48,8 @@ from OFS.interfaces import ICopyContainer
...
@@ -48,7 +48,8 @@ from OFS.interfaces import ICopyContainer
from
OFS.interfaces
import
ICopySource
from
OFS.interfaces
import
ICopySource
CopyError
=
'Copy Error'
class
CopyError
(
Exception
):
pass
copy_re
=
re
.
compile
(
'^copy([0-9]*)_of_(.*)'
)
copy_re
=
re
.
compile
(
'^copy([0-9]*)_of_(.*)'
)
...
@@ -99,10 +100,11 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -99,10 +100,11 @@ class CopyContainer(ExtensionClass.Base):
ob
=
self
.
_getOb
(
id
)
ob
=
self
.
_getOb
(
id
)
if
ob
.
wl_isLocked
():
if
ob
.
wl_isLocked
():
raise
ResourceLockedError
,
'Object "%s" is locked via WebDAV'
%
ob
.
getId
()
raise
ResourceLockedError
(
'Object "%s" is locked via WebDAV'
%
ob
.
getId
())
if
not
ob
.
cb_isMoveable
():
if
not
ob
.
cb_isMoveable
():
raise
CopyError
,
eNotSupported
%
escape
(
id
)
raise
CopyError
(
eNotSupported
%
escape
(
id
)
)
m
=
Moniker
.
Moniker
(
ob
)
m
=
Moniker
.
Moniker
(
ob
)
oblist
.
append
(
m
.
dump
())
oblist
.
append
(
m
.
dump
())
cp
=
(
1
,
oblist
)
cp
=
(
1
,
oblist
)
...
@@ -128,7 +130,7 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -128,7 +130,7 @@ class CopyContainer(ExtensionClass.Base):
for
id
in
ids
:
for
id
in
ids
:
ob
=
self
.
_getOb
(
id
)
ob
=
self
.
_getOb
(
id
)
if
not
ob
.
cb_isCopyable
():
if
not
ob
.
cb_isCopyable
():
raise
CopyError
,
eNotSupported
%
escape
(
id
)
raise
CopyError
(
eNotSupported
%
escape
(
id
)
)
m
=
Moniker
.
Moniker
(
ob
)
m
=
Moniker
.
Moniker
(
ob
)
oblist
.
append
(
m
.
dump
())
oblist
.
append
(
m
.
dump
())
cp
=
(
0
,
oblist
)
cp
=
(
0
,
oblist
)
...
@@ -175,12 +177,12 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -175,12 +177,12 @@ class CopyContainer(ExtensionClass.Base):
else
:
else
:
cp
=
None
cp
=
None
if
cp
is
None
:
if
cp
is
None
:
raise
CopyError
,
eNoData
raise
CopyError
(
eNoData
)
try
:
try
:
op
,
mdatas
=
_cb_decode
(
cp
)
op
,
mdatas
=
_cb_decode
(
cp
)
except
:
except
:
raise
CopyError
,
eInvalid
raise
CopyError
(
eInvalid
)
oblist
=
[]
oblist
=
[]
app
=
self
.
getPhysicalRoot
()
app
=
self
.
getPhysicalRoot
()
...
@@ -191,7 +193,7 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -191,7 +193,7 @@ class CopyContainer(ExtensionClass.Base):
except
ConflictError
:
except
ConflictError
:
raise
raise
except
:
except
:
raise
CopyError
,
eNotFound
raise
CopyError
(
eNotFound
)
self
.
_verifyObjectPaste
(
ob
,
validate_src
=
op
+
1
)
self
.
_verifyObjectPaste
(
ob
,
validate_src
=
op
+
1
)
oblist
.
append
(
ob
)
oblist
.
append
(
ob
)
...
@@ -201,17 +203,17 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -201,17 +203,17 @@ class CopyContainer(ExtensionClass.Base):
for
ob
in
oblist
:
for
ob
in
oblist
:
orig_id
=
ob
.
getId
()
orig_id
=
ob
.
getId
()
if
not
ob
.
cb_isCopyable
():
if
not
ob
.
cb_isCopyable
():
raise
CopyError
,
eNotSupported
%
escape
(
orig_id
)
raise
CopyError
(
eNotSupported
%
escape
(
orig_id
)
)
try
:
try
:
ob
.
_notifyOfCopyTo
(
self
,
op
=
0
)
ob
.
_notifyOfCopyTo
(
self
,
op
=
0
)
except
ConflictError
:
except
ConflictError
:
raise
raise
except
:
except
:
raise
CopyError
,
MessageDialog
(
raise
CopyError
(
MessageDialog
(
title
=
"Copy Error"
,
title
=
"Copy Error"
,
message
=
sys
.
exc_info
()[
1
],
message
=
sys
.
exc_info
()[
1
],
action
=
'manage_main'
)
action
=
'manage_main'
)
)
id
=
self
.
_get_id
(
orig_id
)
id
=
self
.
_get_id
(
orig_id
)
result
.
append
({
'id'
:
orig_id
,
'new_id'
:
id
})
result
.
append
({
'id'
:
orig_id
,
'new_id'
:
id
})
...
@@ -240,20 +242,20 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -240,20 +242,20 @@ class CopyContainer(ExtensionClass.Base):
for
ob
in
oblist
:
for
ob
in
oblist
:
orig_id
=
ob
.
getId
()
orig_id
=
ob
.
getId
()
if
not
ob
.
cb_isMoveable
():
if
not
ob
.
cb_isMoveable
():
raise
CopyError
,
eNotSupported
%
escape
(
orig_id
)
raise
CopyError
(
eNotSupported
%
escape
(
orig_id
)
)
try
:
try
:
ob
.
_notifyOfCopyTo
(
self
,
op
=
1
)
ob
.
_notifyOfCopyTo
(
self
,
op
=
1
)
except
ConflictError
:
except
ConflictError
:
raise
raise
except
:
except
:
raise
CopyError
,
MessageDialog
(
raise
CopyError
(
MessageDialog
(
title
=
"Move Error"
,
title
=
"Move Error"
,
message
=
sys
.
exc_info
()[
1
],
message
=
sys
.
exc_info
()[
1
],
action
=
'manage_main'
)
action
=
'manage_main'
)
)
if
not
sanity_check
(
self
,
ob
):
if
not
sanity_check
(
self
,
ob
):
raise
CopyError
,
"This object cannot be pasted into itself"
raise
CopyError
(
"This object cannot be pasted into itself"
)
orig_container
=
aq_parent
(
aq_inner
(
ob
))
orig_container
=
aq_parent
(
aq_inner
(
ob
))
if
aq_base
(
orig_container
)
is
aq_base
(
self
):
if
aq_base
(
orig_container
)
is
aq_base
(
self
):
...
@@ -330,18 +332,18 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -330,18 +332,18 @@ class CopyContainer(ExtensionClass.Base):
try
:
try
:
self
.
_checkId
(
new_id
)
self
.
_checkId
(
new_id
)
except
:
except
:
raise
CopyError
,
MessageDialog
(
raise
CopyError
(
MessageDialog
(
title
=
'Invalid Id'
,
title
=
'Invalid Id'
,
message
=
sys
.
exc_info
()[
1
],
message
=
sys
.
exc_info
()[
1
],
action
=
'manage_main'
)
action
=
'manage_main'
)
)
ob
=
self
.
_getOb
(
id
)
ob
=
self
.
_getOb
(
id
)
if
ob
.
wl_isLocked
():
if
ob
.
wl_isLocked
():
raise
ResourceLockedError
,
(
'Object "%s" is locked via WebDAV'
raise
ResourceLockedError
(
'Object "%s" is locked via WebDAV'
%
ob
.
getId
())
%
ob
.
getId
())
if
not
ob
.
cb_isMoveable
():
if
not
ob
.
cb_isMoveable
():
raise
CopyError
,
eNotSupported
%
escape
(
id
)
raise
CopyError
(
eNotSupported
%
escape
(
id
)
)
self
.
_verifyObjectPaste
(
ob
)
self
.
_verifyObjectPaste
(
ob
)
try
:
try
:
...
@@ -349,10 +351,10 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -349,10 +351,10 @@ class CopyContainer(ExtensionClass.Base):
except
ConflictError
:
except
ConflictError
:
raise
raise
except
:
except
:
raise
CopyError
,
MessageDialog
(
raise
CopyError
(
MessageDialog
(
title
=
"Rename Error"
,
title
=
"Rename Error"
,
message
=
sys
.
exc_info
()[
1
],
message
=
sys
.
exc_info
()[
1
],
action
=
'manage_main'
)
action
=
'manage_main'
)
)
notify
(
ObjectWillBeMovedEvent
(
ob
,
self
,
id
,
self
,
new_id
))
notify
(
ObjectWillBeMovedEvent
(
ob
,
self
,
id
,
self
,
new_id
))
...
@@ -396,14 +398,14 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -396,14 +398,14 @@ class CopyContainer(ExtensionClass.Base):
"""Clone an object, creating a new object with the given id.
"""Clone an object, creating a new object with the given id.
"""
"""
if
not
ob
.
cb_isCopyable
():
if
not
ob
.
cb_isCopyable
():
raise
CopyError
,
eNotSupported
%
escape
(
ob
.
getId
(
))
raise
CopyError
(
eNotSupported
%
escape
(
ob
.
getId
()
))
try
:
try
:
self
.
_checkId
(
id
)
self
.
_checkId
(
id
)
except
:
except
:
raise
CopyError
,
MessageDialog
(
raise
CopyError
(
MessageDialog
(
title
=
'Invalid Id'
,
title
=
'Invalid Id'
,
message
=
sys
.
exc_info
()[
1
],
message
=
sys
.
exc_info
()[
1
],
action
=
'manage_main'
)
action
=
'manage_main'
)
)
self
.
_verifyObjectPaste
(
ob
)
self
.
_verifyObjectPaste
(
ob
)
...
@@ -412,10 +414,10 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -412,10 +414,10 @@ class CopyContainer(ExtensionClass.Base):
except
ConflictError
:
except
ConflictError
:
raise
raise
except
:
except
:
raise
CopyError
,
MessageDialog
(
raise
CopyError
(
MessageDialog
(
title
=
"Clone Error"
,
title
=
"Clone Error"
,
message
=
sys
.
exc_info
()[
1
],
message
=
sys
.
exc_info
()[
1
],
action
=
'manage_main'
)
action
=
'manage_main'
)
)
orig_ob
=
ob
orig_ob
=
ob
ob
=
ob
.
_getCopy
(
self
)
ob
=
ob
.
_getCopy
(
self
)
...
@@ -469,17 +471,17 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -469,17 +471,17 @@ class CopyContainer(ExtensionClass.Base):
# heirarchy).
# heirarchy).
if
not
hasattr
(
object
,
'meta_type'
):
if
not
hasattr
(
object
,
'meta_type'
):
raise
CopyError
,
MessageDialog
(
raise
CopyError
(
MessageDialog
(
title
=
'Not Supported'
,
title
=
'Not Supported'
,
message
=
(
'The object <em>%s</em> does not support this'
\
message
=
(
'The object <em>%s</em> does not support this'
\
' operation'
%
escape
(
absattr
(
object
.
id
))),
' operation'
%
escape
(
absattr
(
object
.
id
))),
action
=
'manage_main'
)
action
=
'manage_main'
)
)
if
not
hasattr
(
self
,
'all_meta_types'
):
if
not
hasattr
(
self
,
'all_meta_types'
):
raise
CopyError
,
MessageDialog
(
raise
CopyError
(
MessageDialog
(
title
=
'Not Supported'
,
title
=
'Not Supported'
,
message
=
'Cannot paste into this object.'
,
message
=
'Cannot paste into this object.'
,
action
=
'manage_main'
)
action
=
'manage_main'
)
)
method_name
=
None
method_name
=
None
mt_permission
=
None
mt_permission
=
None
...
@@ -510,19 +512,19 @@ class CopyContainer(ExtensionClass.Base):
...
@@ -510,19 +512,19 @@ class CopyContainer(ExtensionClass.Base):
if
not
sm
.
checkPermission
(
delete_objects
,
parent
):
if
not
sm
.
checkPermission
(
delete_objects
,
parent
):
raise
Unauthorized
(
'Delete not allowed.'
)
raise
Unauthorized
(
'Delete not allowed.'
)
else
:
else
:
raise
CopyError
,
MessageDialog
(
raise
CopyError
(
MessageDialog
(
title
=
'Insufficient Privileges'
,
title
=
'Insufficient Privileges'
,
message
=
(
'You do not possess the %s permission in the '
message
=
(
'You do not possess the %s permission in the '
'context of the container into which you are '
'context of the container into which you are '
'pasting, thus you are not able to perform '
'pasting, thus you are not able to perform '
'this operation.'
%
mt_permission
),
'this operation.'
%
mt_permission
),
action
=
'manage_main'
)
action
=
'manage_main'
)
)
else
:
else
:
raise
CopyError
,
MessageDialog
(
raise
CopyError
(
MessageDialog
(
title
=
'Not Supported'
,
title
=
'Not Supported'
,
message
=
(
'The object <em>%s</em> does not support this '
message
=
(
'The object <em>%s</em> does not support this '
'operation.'
%
escape
(
absattr
(
object
.
id
))),
'operation.'
%
escape
(
absattr
(
object
.
id
))),
action
=
'manage_main'
)
action
=
'manage_main'
)
)
InitializeClass
(
CopyContainer
)
InitializeClass
(
CopyContainer
)
...
@@ -561,13 +563,13 @@ class CopySource(ExtensionClass.Base):
...
@@ -561,13 +563,13 @@ class CopySource(ExtensionClass.Base):
transaction
.
savepoint
(
optimistic
=
True
)
transaction
.
savepoint
(
optimistic
=
True
)
if
self
.
_p_jar
is
None
:
if
self
.
_p_jar
is
None
:
raise
CopyError
,
(
raise
CopyError
(
(
'Object "%s" needs to be in the database to be copied'
%
'Object "%s" needs to be in the database to be copied'
%
`self`
)
`self`
)
)
if
container
.
_p_jar
is
None
:
if
container
.
_p_jar
is
None
:
raise
CopyError
,
(
raise
CopyError
(
(
'Container "%s" needs to be in the database'
%
'Container "%s" needs to be in the database'
%
`container`
)
`container`
)
)
# Ask an object for a new copy of itself.
# Ask an object for a new copy of itself.
f
=
tempfile
.
TemporaryFile
()
f
=
tempfile
.
TemporaryFile
()
...
...
lib/python/OFS/tests/testCopySupport.py
View file @
75f69548
...
@@ -347,7 +347,7 @@ class TestCopySupportSecurity( CopySupportTestBase ):
...
@@ -347,7 +347,7 @@ class TestCopySupportSecurity( CopySupportTestBase ):
if
ce_regex
is
not
None
:
if
ce_regex
is
not
None
:
pattern
=
re
.
compile
(
ce_regex
,
re
.
DOTALL
)
pattern
=
re
.
compile
(
ce_regex
,
re
.
DOTALL
)
if
pattern
.
search
(
e
)
is
None
:
if
pattern
.
search
(
e
.
message
)
is
None
:
self
.
fail
(
"Paste failed; didn't match pattern:
\
n
%s"
%
e
)
self
.
fail
(
"Paste failed; didn't match pattern:
\
n
%s"
%
e
)
else
:
else
:
...
...
lib/python/ZServer/tests/test_clockserver.py
View file @
75f69548
...
@@ -95,12 +95,7 @@ class ClockServerTests(unittest.TestCase):
...
@@ -95,12 +95,7 @@ class ClockServerTests(unittest.TestCase):
logger
=
logger
)
logger
=
logger
)
self
.
assertEqual
(
server
.
handle_write
(),
True
)
self
.
assertEqual
(
server
.
handle_write
(),
True
)
def
test_handle_error
(
self
):
#def test_handle_error(self): Can't be usefully tested
logger
=
DummyLogger
()
server
=
self
.
_makeOne
(
method
=
'a'
,
period
=
60
,
user
=
'charlie'
,
password
=
'brown'
,
host
=
'localhost'
,
logger
=
logger
)
self
.
assertRaises
(
AssertionError
,
server
.
handle_error
)
def
test_readable
(
self
):
def
test_readable
(
self
):
logger
=
DummyLogger
()
logger
=
DummyLogger
()
...
...
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