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
992f73e2
Commit
992f73e2
authored
Aug 06, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
flake8
parent
bcaeb4ae
Changes
24
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
544 additions
and
512 deletions
+544
-512
src/OFS/Image.py
src/OFS/Image.py
+226
-191
src/OFS/ObjectManager.py
src/OFS/ObjectManager.py
+1
-1
src/OFS/PropertySheets.py
src/OFS/PropertySheets.py
+161
-141
src/OFS/SimpleItem.py
src/OFS/SimpleItem.py
+2
-1
src/OFS/Traversable.py
src/OFS/Traversable.py
+1
-1
src/OFS/dtml/documentEdit.dtml
src/OFS/dtml/documentEdit.dtml
+2
-2
src/OFS/dtml/fileEdit.dtml
src/OFS/dtml/fileEdit.dtml
+2
-2
src/OFS/dtml/imageEdit.dtml
src/OFS/dtml/imageEdit.dtml
+2
-2
src/OFS/tests/testApplication.py
src/OFS/tests/testApplication.py
+0
-5
src/OFS/tests/testCopySupportEvents.py
src/OFS/tests/testCopySupportEvents.py
+6
-6
src/OFS/tests/testCopySupportHooks.py
src/OFS/tests/testCopySupportHooks.py
+6
-6
src/OFS/tests/testFileAndImage.py
src/OFS/tests/testFileAndImage.py
+55
-50
src/OFS/tests/testFolder.py
src/OFS/tests/testFolder.py
+0
-6
src/OFS/tests/testOrderedFolder.py
src/OFS/tests/testOrderedFolder.py
+0
-6
src/OFS/tests/testProperties.py
src/OFS/tests/testProperties.py
+13
-16
src/OFS/tests/testRanges.py
src/OFS/tests/testRanges.py
+1
-1
src/OFS/tests/test_DTMLDocument.py
src/OFS/tests/test_DTMLDocument.py
+1
-6
src/OFS/tests/test_DTMLMethod.py
src/OFS/tests/test_DTMLMethod.py
+1
-7
src/Products/PageTemplates/tests/testZopePageTemplate.py
src/Products/PageTemplates/tests/testZopePageTemplate.py
+42
-41
src/Products/PageTemplates/www/ptEdit.zpt
src/Products/PageTemplates/www/ptEdit.zpt
+2
-2
src/Products/SiteAccess/www/manage_edit.dtml
src/Products/SiteAccess/www/manage_edit.dtml
+1
-1
src/Testing/ZopeTestCase/testFunctional.py
src/Testing/ZopeTestCase/testFunctional.py
+1
-1
src/ZPublisher/BaseRequest.py
src/ZPublisher/BaseRequest.py
+2
-1
src/webdav/tests/testPUT_factory.py
src/webdav/tests/testPUT_factory.py
+16
-16
No files found.
src/OFS/Image.py
View file @
992f73e2
This diff is collapsed.
Click to expand it.
src/OFS/ObjectManager.py
View file @
992f73e2
...
...
@@ -773,7 +773,7 @@ class ObjectManager(CopyContainer,
if
(
request
.
maybe_webdav_client
and
method
not
in
(
'GET'
,
'POST'
)):
return
NullResource
(
self
,
key
,
request
).
__of__
(
self
)
raise
KeyError
,
key
raise
KeyError
(
key
)
def
__setitem__
(
self
,
key
,
value
):
return
self
.
_setObject
(
key
,
value
)
...
...
src/OFS/PropertySheets.py
View file @
992f73e2
This diff is collapsed.
Click to expand it.
src/OFS/SimpleItem.py
View file @
992f73e2
...
...
@@ -18,6 +18,7 @@ This module can also be used as a simple template for implementing new
item types.
"""
import
logging
import
marshal
import
re
import
sys
...
...
@@ -59,9 +60,9 @@ from OFS.CopySupport import CopySource
from
OFS.role
import
RoleManager
from
OFS.Traversable
import
Traversable
import
logging
logger
=
logging
.
getLogger
()
class
Item
(
Base
,
Resource
,
CopySource
,
...
...
src/OFS/Traversable.py
View file @
992f73e2
...
...
@@ -204,7 +204,7 @@ class Traversable:
if
name
[
0
]
==
'_'
:
# Never allowed in a URL.
raise
NotFound
,
name
raise
NotFound
(
name
)
if
name
==
'..'
:
next
=
aq_parent
(
obj
)
...
...
src/OFS/dtml/documentEdit.dtml
View file @
992f73e2
...
...
@@ -42,7 +42,7 @@ the <em>browse</em> button to select a local file to upload.
<td align="left" valign="top" colspan="2">
<div class="form-element">
<dtml-if wl_isLocked>
<em>Locked
by WebDAV
</em>
<em>Locked</em>
<dtml-else>
<input class="form-element" type="submit" name="SUBMIT" value="Save Changes">
</dtml-if>
...
...
@@ -74,7 +74,7 @@ the <em>browse</em> button to select a local file to upload.
<td align="left" valign="top">
<div class="form-element">
<dtml-if wl_isLocked>
<em>Locked
by WebDAV
</em>
<em>Locked</em>
<dtml-else>
<input class="form-element" type="submit" value="Upload File">
</dtml-if>
...
...
src/OFS/dtml/fileEdit.dtml
View file @
992f73e2
...
...
@@ -87,7 +87,7 @@ text type and small enough to be edited in a text area.
<td align="left" valign="top">
<div class="form-element">
<dtml-if wl_isLocked>
<em>Locked
by WebDAV
</em>
<em>Locked</em>
<dtml-else>
<input class="form-element" type="submit" name="manage_edit:method"
value="Save Changes">
...
...
@@ -114,7 +114,7 @@ text type and small enough to be edited in a text area.
<td align="left" valign="top">
<div class="form-element">
<dtml-if wl_isLocked>
<em>Locked
by WebDAV
</em>
<em>Locked</em>
<dtml-else>
<input class="form-element" type="submit" name="manage_upload:method"
value="Upload">
...
...
src/OFS/dtml/imageEdit.dtml
View file @
992f73e2
...
...
@@ -70,7 +70,7 @@ button and click <em>upload</em> to update the contents of the &dtml-kind;.
<td align="left" valign="top">
<div class="form-element">
<dtml-if wl_isLocked>
<em>Locked
by WebDAV
</em>
<em>Locked</em>
<dtml-else>
<input class="form-element" type="submit" name="submit"
value="Save Changes">
...
...
@@ -103,7 +103,7 @@ button and click <em>upload</em> to update the contents of the &dtml-kind;.
<td align="left" valign="top">
<div class="form-element">
<dtml-if wl_isLocked>
<em>Locked
by WebDAV
</em>
<em>Locked</em>
<dtml-else>
<input class="form-element" type="submit" name="submit"
value="Upload">
...
...
src/OFS/tests/testApplication.py
View file @
992f73e2
...
...
@@ -105,8 +105,3 @@ class ApplicationTests(unittest.TestCase):
def
_noWay
(
self
,
key
,
default
=
None
):
raise
KeyError
(
key
)
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
ApplicationTests
),
))
src/OFS/tests/testCopySupportEvents.py
View file @
992f73e2
...
...
@@ -150,7 +150,7 @@ class TestCopySupport(EventTest):
)
def
test_5_COPY
(
self
):
# Test
webdav
COPY
# Test COPY
req
=
self
.
app
.
REQUEST
req
.
environ
[
'HTTP_DEPTH'
]
=
'infinity'
req
.
environ
[
'HTTP_DESTINATION'
]
=
(
'%s/subfolder/mydoc'
...
...
@@ -165,7 +165,7 @@ class TestCopySupport(EventTest):
)
def
test_6_MOVE
(
self
):
# Test
webdav
MOVE
# Test MOVE
req
=
self
.
app
.
REQUEST
req
.
environ
[
'HTTP_DEPTH'
]
=
'infinity'
req
.
environ
[
'HTTP_DESTINATION'
]
=
(
'%s/subfolder/mydoc'
...
...
@@ -179,7 +179,7 @@ class TestCopySupport(EventTest):
)
def
test_7_DELETE
(
self
):
# Test
webdav
DELETE
# Test DELETE
req
=
self
.
app
.
REQUEST
req
[
'URL'
]
=
'%s/mydoc'
%
self
.
folder
.
absolute_url
()
self
.
folder
.
mydoc
.
DELETE
(
req
,
req
.
RESPONSE
)
...
...
@@ -274,7 +274,7 @@ class TestCopySupportSublocation(EventTest):
)
def
test_5_COPY
(
self
):
# Test
webdav
COPY
# Test COPY
req
=
self
.
app
.
REQUEST
req
.
environ
[
'HTTP_DEPTH'
]
=
'infinity'
req
.
environ
[
'HTTP_DESTINATION'
]
=
(
'%s/subfolder/myfolder'
...
...
@@ -293,7 +293,7 @@ class TestCopySupportSublocation(EventTest):
)
def
test_6_MOVE
(
self
):
# Test
webdav
MOVE
# Test MOVE
req
=
self
.
app
.
REQUEST
req
.
environ
[
'HTTP_DEPTH'
]
=
'infinity'
req
.
environ
[
'HTTP_DESTINATION'
]
=
(
'%s/subfolder/myfolder'
...
...
@@ -309,7 +309,7 @@ class TestCopySupportSublocation(EventTest):
)
def
test_7_DELETE
(
self
):
# Test
webdav
DELETE
# Test DELETE
req
=
self
.
app
.
REQUEST
req
[
'URL'
]
=
'%s/myfolder'
%
self
.
folder
.
absolute_url
()
self
.
folder
.
myfolder
.
DELETE
(
req
,
req
.
RESPONSE
)
...
...
src/OFS/tests/testCopySupportHooks.py
View file @
992f73e2
...
...
@@ -148,7 +148,7 @@ class TestCopySupport(HookTest):
)
def
test_5_COPY
(
self
):
# Test
webdav
COPY
# Test COPY
req
=
self
.
app
.
REQUEST
req
.
environ
[
'HTTP_DEPTH'
]
=
'infinity'
req
.
environ
[
'HTTP_DESTINATION'
]
=
'%s/subfolder/mydoc'
%
self
.
folder
.
absolute_url
()
...
...
@@ -159,7 +159,7 @@ class TestCopySupport(HookTest):
)
def
test_6_MOVE
(
self
):
# Test
webdav
MOVE
# Test MOVE
req
=
self
.
app
.
REQUEST
req
.
environ
[
'HTTP_DEPTH'
]
=
'infinity'
req
.
environ
[
'HTTP_DESTINATION'
]
=
'%s/subfolder/mydoc'
%
self
.
folder
.
absolute_url
()
...
...
@@ -170,7 +170,7 @@ class TestCopySupport(HookTest):
)
def
test_7_DELETE
(
self
):
# Test
webdav
DELETE
# Test DELETE
req
=
self
.
app
.
REQUEST
req
[
'URL'
]
=
'%s/mydoc'
%
self
.
folder
.
absolute_url
()
self
.
folder
.
mydoc
.
DELETE
(
req
,
req
.
RESPONSE
)
...
...
@@ -243,7 +243,7 @@ class TestCopySupportSublocation(HookTest):
)
def
test_5_COPY
(
self
):
# Test
webdav
COPY
# Test COPY
req
=
self
.
app
.
REQUEST
req
.
environ
[
'HTTP_DEPTH'
]
=
'infinity'
req
.
environ
[
'HTTP_DESTINATION'
]
=
'%s/subfolder/myfolder'
%
self
.
folder
.
absolute_url
()
...
...
@@ -256,7 +256,7 @@ class TestCopySupportSublocation(HookTest):
)
def
test_6_MOVE
(
self
):
# Test
webdav
MOVE
# Test MOVE
req
=
self
.
app
.
REQUEST
req
.
environ
[
'HTTP_DEPTH'
]
=
'infinity'
req
.
environ
[
'HTTP_DESTINATION'
]
=
'%s/subfolder/myfolder'
%
self
.
folder
.
absolute_url
()
...
...
@@ -269,7 +269,7 @@ class TestCopySupportSublocation(HookTest):
)
def
test_7_DELETE
(
self
):
# Test
webdav
DELETE
# Test DELETE
req
=
self
.
app
.
REQUEST
req
[
'URL'
]
=
'%s/myfolder'
%
self
.
folder
.
absolute_url
()
self
.
folder
.
myfolder
.
DELETE
(
req
,
req
.
RESPONSE
)
...
...
src/OFS/tests/testFileAndImage.py
View file @
992f73e2
...
...
@@ -2,9 +2,9 @@ import unittest
import
Testing
import
Zope2
Zope2
.
startup
()
import
os
,
sys
import
os
import
sys
import
time
from
cStringIO
import
StringIO
...
...
@@ -35,24 +35,28 @@ except:
imagedata
=
os
.
path
.
join
(
here
,
'test.gif'
)
filedata
=
os
.
path
.
join
(
here
,
'test.gif'
)
Zope2
.
startup
()
def
makeConnection
():
import
ZODB
from
ZODB.DemoStorage
import
DemoStorage
s
=
DemoStorage
()
return
ZODB
.
DB
(
s
).
open
()
return
ZODB
.
DB
(
s
).
open
()
def
aputrequest
(
file
,
content_type
):
resp
=
HTTPResponse
(
stdout
=
sys
.
stdout
)
environ
=
{}
environ
[
'SERVER_NAME'
]
=
'foo'
environ
[
'SERVER_PORT'
]
=
'80'
environ
[
'SERVER_NAME'
]
=
'foo'
environ
[
'SERVER_PORT'
]
=
'80'
environ
[
'REQUEST_METHOD'
]
=
'PUT'
environ
[
'CONTENT_TYPE'
]
=
content_type
req
=
HTTPRequest
(
stdin
=
file
,
environ
=
environ
,
response
=
resp
)
return
req
class
DummyCache
:
def
__init__
(
self
):
self
.
clear
()
...
...
@@ -71,8 +75,8 @@ class DummyCache:
self
.
invalidated
=
ob
def
clear
(
self
):
self
.
set
=
None
self
.
get
=
None
self
.
set
=
None
self
.
get
=
None
self
.
invalidated
=
None
self
.
si
=
None
...
...
@@ -80,60 +84,61 @@ class DummyCache:
self
.
si
=
si
ADummyCache
=
DummyCache
()
ADummyCache
=
DummyCache
()
class
DummyCacheManager
(
SimpleItem
):
def
ZCacheManager_getCache
(
self
):
return
ADummyCache
class
EventCatcher
(
object
):
def
__init__
(
self
):
self
.
created
=
[]
self
.
modified
=
[]
self
.
setUp
()
def
setUp
(
self
):
from
zope.component
import
provideHandler
provideHandler
(
self
.
handleCreated
)
provideHandler
(
self
.
handleModified
)
def
tearDown
(
self
):
from
zope.component
import
getSiteManager
getSiteManager
().
unregisterHandler
(
self
.
handleCreated
)
getSiteManager
().
unregisterHandler
(
self
.
handleModified
)
def
reset
(
self
):
self
.
created
=
[]
self
.
modified
=
[]
@
adapter
(
IObjectCreatedEvent
)
def
handleCreated
(
self
,
event
):
if
isinstance
(
event
.
object
,
OFS
.
Image
.
File
):
self
.
created
.
append
(
event
)
@
adapter
(
IObjectModifiedEvent
)
def
handleModified
(
self
,
event
):
if
isinstance
(
event
.
object
,
OFS
.
Image
.
File
):
self
.
modified
.
append
(
event
)
class
FileTests
(
unittest
.
TestCase
):
data
=
open
(
filedata
,
'rb'
).
read
()
content_type
=
'application/octet-stream'
factory
=
'manage_addFile'
def
setUp
(
self
):
def
setUp
(
self
):
self
.
connection
=
makeConnection
()
self
.
eventCatcher
=
EventCatcher
()
try
:
r
=
self
.
connection
.
root
()
a
=
Application
()
r
[
'Application'
]
=
a
self
.
root
=
a
responseOut
=
self
.
responseOut
=
StringIO
()
self
.
app
=
makerequest
(
self
.
root
,
stdout
=
responseOut
)
self
.
app
=
makerequest
(
self
.
root
,
stdout
=
responseOut
)
self
.
app
.
dcm
=
DummyCacheManager
()
factory
=
getattr
(
self
.
app
,
self
.
factory
)
factory
(
'file'
,
...
...
@@ -148,18 +153,20 @@ class FileTests(unittest.TestCase):
self
.
connection
.
close
()
raise
transaction
.
begin
()
self
.
file
=
getattr
(
self
.
app
,
'file'
)
self
.
file
=
getattr
(
self
.
app
,
'file'
)
# Since we do the create here, let's test the events here too
self
.
assertEquals
(
1
,
len
(
self
.
eventCatcher
.
created
))
self
.
assertTrue
(
aq_base
(
self
.
eventCatcher
.
created
[
0
].
object
)
is
aq_base
(
self
.
file
))
self
.
assertTrue
(
aq_base
(
self
.
eventCatcher
.
created
[
0
].
object
)
is
aq_base
(
self
.
file
))
self
.
assertEquals
(
1
,
len
(
self
.
eventCatcher
.
modified
))
self
.
assertTrue
(
aq_base
(
self
.
eventCatcher
.
created
[
0
].
object
)
is
aq_base
(
self
.
file
))
self
.
assertTrue
(
aq_base
(
self
.
eventCatcher
.
created
[
0
].
object
)
is
aq_base
(
self
.
file
))
self
.
eventCatcher
.
reset
()
def
tearDown
(
self
):
def
tearDown
(
self
):
del
self
.
file
transaction
.
abort
()
self
.
connection
.
close
()
...
...
@@ -168,7 +175,6 @@ class FileTests(unittest.TestCase):
del
self
.
root
del
self
.
connection
ADummyCache
.
clear
()
self
.
eventCatcher
.
tearDown
()
def
testViewImageOrFile
(
self
):
...
...
@@ -227,7 +233,9 @@ class FileTests(unittest.TestCase):
def
testIfModSince
(
self
):
now
=
time
.
time
()
e
=
{
'SERVER_NAME'
:
'foo'
,
'SERVER_PORT'
:
'80'
,
'REQUEST_METHOD'
:
'GET'
}
e
=
{
'SERVER_NAME'
:
'foo'
,
'SERVER_PORT'
:
'80'
,
'REQUEST_METHOD'
:
'GET'
}
# not modified since
t_notmod
=
rfc1123_date
(
now
)
...
...
@@ -235,7 +243,7 @@ class FileTests(unittest.TestCase):
out
=
StringIO
()
resp
=
HTTPResponse
(
stdout
=
out
)
req
=
HTTPRequest
(
sys
.
stdin
,
e
,
resp
)
data
=
self
.
file
.
index_html
(
req
,
resp
)
data
=
self
.
file
.
index_html
(
req
,
resp
)
self
.
assertEqual
(
resp
.
getStatus
(),
304
)
self
.
assertEqual
(
data
,
''
)
...
...
@@ -245,7 +253,7 @@ class FileTests(unittest.TestCase):
out
=
StringIO
()
resp
=
HTTPResponse
(
stdout
=
out
)
req
=
HTTPRequest
(
sys
.
stdin
,
e
,
resp
)
data
=
self
.
file
.
index_html
(
req
,
resp
)
data
=
self
.
file
.
index_html
(
req
,
resp
)
self
.
assertEqual
(
resp
.
getStatus
(),
200
)
self
.
assertEqual
(
data
,
str
(
self
.
file
.
data
))
...
...
@@ -271,12 +279,12 @@ class FileTests(unittest.TestCase):
self
.
assertEqual
(
str
(
self
.
file
.
data
),
s
)
def
testIndexHtmlWithPdata
(
self
):
self
.
file
.
manage_upload
(
'a'
*
(
2
<<
16
))
# 128K
self
.
file
.
manage_upload
(
'a'
*
(
2
<<
16
))
# 128K
self
.
file
.
index_html
(
self
.
app
.
REQUEST
,
self
.
app
.
REQUEST
.
RESPONSE
)
self
.
assert_
(
self
.
app
.
REQUEST
.
RESPONSE
.
_wrote
)
def
testIndexHtmlWithString
(
self
):
self
.
file
.
manage_upload
(
'a'
*
100
)
# 100 bytes
self
.
file
.
manage_upload
(
'a'
*
100
)
# 100 bytes
self
.
file
.
index_html
(
self
.
app
.
REQUEST
,
self
.
app
.
REQUEST
.
RESPONSE
)
self
.
assert_
(
not
self
.
app
.
REQUEST
.
RESPONSE
.
_wrote
)
...
...
@@ -313,10 +321,11 @@ class FileTests(unittest.TestCase):
def
testUnicode
(
self
):
val
=
u'some unicode string here'
self
.
assertRaises
(
TypeError
,
self
.
file
.
manage_edit
,
'foobar'
,
'text/plain'
,
filedata
=
val
)
class
ImageTests
(
FileTests
):
data
=
open
(
filedata
,
'rb'
).
read
()
content_type
=
'image/gif'
...
...
@@ -332,19 +341,22 @@ class ImageTests(FileTests):
self
.
assertTrue
(
ADummyCache
.
set
)
def
testStr
(
self
):
self
.
assertEqual
(
str
(
self
.
file
),
(
'<img src="http://foo/file" alt="" title="" height="16" width="16" />'
))
self
.
assertEqual
(
str
(
self
.
file
),
(
'<img src="http://foo/file" '
'alt="" title="" height="16" width="16" />'
))
def
testTag
(
self
):
tag_fmt
=
'<img src="http://foo/file" alt="%s" title="%s" height="16" width="16" />'
self
.
assertEqual
(
self
.
file
.
tag
(),
(
tag_fmt
%
(
''
,
''
)))
tag_fmt
=
(
'<img src="http://foo/file" '
'alt="%s" title="%s" height="16" width="16" />'
)
self
.
assertEqual
(
self
.
file
.
tag
(),
(
tag_fmt
%
(
''
,
''
)))
self
.
file
.
manage_changeProperties
(
title
=
'foo'
)
self
.
assertEqual
(
self
.
file
.
tag
(),
(
tag_fmt
%
(
''
,
'foo'
)))
self
.
assertEqual
(
self
.
file
.
tag
(),
(
tag_fmt
%
(
''
,
'foo'
)))
self
.
file
.
manage_changeProperties
(
alt
=
'bar'
)
self
.
assertEqual
(
self
.
file
.
tag
(),
(
tag_fmt
%
(
'bar'
,
'foo'
)))
self
.
assertEqual
(
self
.
file
.
tag
(),
(
tag_fmt
%
(
'bar'
,
'foo'
)))
def
testViewImageOrFile
(
self
):
pass
# dtml method,screw it
pass
# dtml method,screw it
def
test_interfaces
(
self
):
from
zope.interface.verify
import
verifyClass
...
...
@@ -355,6 +367,7 @@ class ImageTests(FileTests):
class
ImagePublishTests
(
Testing
.
ZopeTestCase
.
FunctionalTestCase
):
def
testTagSafe
(
self
):
self
.
app
.
manage_addImage
(
"image"
,
""
)
res
=
self
.
publish
(
...
...
@@ -363,12 +376,4 @@ class ImagePublishTests(Testing.ZopeTestCase.FunctionalTestCase):
"%3E%3Cdiv%20class%3D%22"
)
self
.
assertFalse
(
'<script type="text/javascript">alert(
\
'
evil
\
'
);</script>'
in
res
.
getBody
())
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
FileTests
),
unittest
.
makeSuite
(
ImageTests
),
unittest
.
makeSuite
(
ImagePublishTests
)
))
in
res
.
getBody
())
src/OFS/tests/testFolder.py
View file @
992f73e2
...
...
@@ -11,9 +11,3 @@ class TestFolder(unittest.TestCase):
verifyClass
(
IFolder
,
Folder
)
verifyClass
(
IWriteLock
,
Folder
)
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
TestFolder
),
))
src/OFS/tests/testOrderedFolder.py
View file @
992f73e2
...
...
@@ -13,9 +13,3 @@ class TestOrderedFolder(unittest.TestCase):
verifyClass
(
IOrderedContainer
,
OrderedFolder
)
verifyClass
(
IOrderedFolder
,
OrderedFolder
)
verifyClass
(
IWriteLock
,
OrderedFolder
)
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
TestOrderedFolder
),
))
src/OFS/tests/testProperties.py
View file @
992f73e2
...
...
@@ -17,7 +17,6 @@ import unittest
class
TestPropertyManager
(
unittest
.
TestCase
):
"""Property management tests."""
def
_getTargetClass
(
self
):
from
OFS.PropertyManager
import
PropertyManager
...
...
@@ -33,24 +32,24 @@ class TestPropertyManager(unittest.TestCase):
verifyClass
(
IPropertyManager
,
PropertyManager
)
def
testLinesPropertyIsTuple
(
self
):
def
testLinesPropertyIsTuple
(
self
):
inst
=
self
.
_makeOne
()
inst
.
_setProperty
(
'prop'
,
[
'xxx'
,
'yyy'
],
'lines'
)
self
.
assertTrue
(
type
(
inst
.
getProperty
(
'prop'
))
==
type
(()
))
self
.
assertTrue
(
type
(
inst
.
prop
)
==
type
(()
))
self
.
assertTrue
(
isinstance
(
inst
.
getProperty
(
'prop'
),
tuple
))
self
.
assertTrue
(
isinstance
(
inst
.
prop
,
tuple
))
inst
.
_setPropValue
(
'prop'
,
[
'xxx'
,
'yyy'
])
self
.
assertTrue
(
type
(
inst
.
getProperty
(
'prop'
))
==
type
(()
))
self
.
assertTrue
(
type
(
inst
.
prop
)
==
type
(()
))
self
.
assertTrue
(
isinstance
(
inst
.
getProperty
(
'prop'
),
tuple
))
self
.
assertTrue
(
isinstance
(
inst
.
prop
,
tuple
))
inst
.
_updateProperty
(
'prop'
,
[
'xxx'
,
'yyy'
])
self
.
assertTrue
(
type
(
inst
.
getProperty
(
'prop'
))
==
type
(()
))
self
.
assertTrue
(
type
(
inst
.
prop
)
==
type
(()
))
self
.
assertTrue
(
isinstance
(
inst
.
getProperty
(
'prop'
),
tuple
))
self
.
assertTrue
(
isinstance
(
inst
.
prop
,
tuple
))
inst
.
manage_addProperty
(
'prop2'
,
[
'xxx'
,
'yyy'
],
'lines'
)
self
.
assertTrue
(
type
(
inst
.
getProperty
(
'prop2'
))
==
type
(()
))
self
.
assertTrue
(
type
(
inst
.
prop2
)
==
type
(()
))
self
.
assertTrue
(
isinstance
(
inst
.
getProperty
(
'prop2'
),
tuple
))
self
.
assertTrue
(
isinstance
(
inst
.
prop2
,
tuple
))
def
test_propertyLabel_no_label_falls_back_to_id
(
self
):
class
NoLabel
(
self
.
_getTargetClass
()):
...
...
@@ -88,23 +87,21 @@ class TestPropertyManager(unittest.TestCase):
class
TestPropertySheet
(
unittest
.
TestCase
):
"""Property management tests."""
def
_makeOne
(
self
,
*
args
,
**
kw
):
from
OFS.PropertySheets
import
PropertySheet
return
PropertySheet
(
*
args
,
**
kw
)
def
testPropertySheetLinesPropertyIsTuple
(
self
):
inst
=
self
.
_makeOne
(
'foo'
)
inst
.
_setProperty
(
'prop'
,
[
'xxx'
,
'yyy'
],
'lines'
)
self
.
assertTrue
(
type
(
inst
.
getProperty
(
'prop'
))
==
type
(()
))
self
.
assertTrue
(
type
(
inst
.
prop
)
==
type
(()
))
self
.
assertTrue
(
isinstance
(
inst
.
getProperty
(
'prop'
),
tuple
))
self
.
assertTrue
(
isinstance
(
inst
.
prop
,
tuple
))
inst
.
_updateProperty
(
'prop'
,
[
'xxx'
,
'yyy'
])
self
.
assertTrue
(
type
(
inst
.
getProperty
(
'prop'
))
==
type
(()
))
self
.
assertTrue
(
type
(
inst
.
prop
)
==
type
(()
))
self
.
assertTrue
(
isinstance
(
inst
.
getProperty
(
'prop'
),
tuple
))
self
.
assertTrue
(
isinstance
(
inst
.
prop
,
tuple
))
inst
.
manage_addProperty
(
'prop2'
,
[
'xxx'
,
'yyy'
],
'lines'
)
self
.
assertTrue
(
type
(
inst
.
getProperty
(
'prop2'
))
==
type
(()))
...
...
src/OFS/tests/testRanges.py
View file @
992f73e2
...
...
@@ -109,7 +109,7 @@ class TestRequestRange(unittest.TestCase):
return
body
+
rv
def
createLastModifiedDate
(
self
,
offset
=
0
):
from
webdav.c
ommon
import
rfc1123_date
from
App.C
ommon
import
rfc1123_date
return
rfc1123_date
(
self
.
file
.
_p_mtime
+
offset
)
def
expectUnsatisfiable
(
self
,
range
):
...
...
src/OFS/tests/test_DTMLDocument.py
View file @
992f73e2
import
unittest
class
DTMLDocumentTests
(
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
...
...
@@ -36,9 +37,3 @@ class DummyDispatcher:
def
_setObject
(
self
,
key
,
value
):
self
.
_set
[
key
]
=
value
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
DTMLDocumentTests
),
unittest
.
makeSuite
(
FactoryTests
),
))
src/OFS/tests/test_DTMLMethod.py
View file @
992f73e2
import
unittest
class
DTMLMethodTests
(
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
...
...
@@ -45,10 +46,3 @@ class DummyDispatcher:
def
_setObject
(
self
,
key
,
value
):
self
.
_set
[
key
]
=
value
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
DTMLMethodTests
),
unittest
.
makeSuite
(
FactoryTests
),
))
src/Products/PageTemplates/tests/testZopePageTemplate.py
View file @
992f73e2
This diff is collapsed.
Click to expand it.
src/Products/PageTemplates/www/ptEdit.zpt
View file @
992f73e2
...
...
@@ -64,7 +64,7 @@
<tr>
<td align="left" valign="top" colspan="4">
<div class="form-element">
<em tal:condition="context/wl_isLocked">Locked
by WebDAV
</em>
<em tal:condition="context/wl_isLocked">Locked</em>
<input tal:condition="not:context/wl_isLocked"
class="form-element" type="submit"
name="pt_editAction:method" value="Save Changes"/>
...
...
@@ -110,7 +110,7 @@ context</a> to view or download the current text.</p>
<td></td>
<td align="left" valign="top">
<div class="form-element">
<em tal:condition="context/wl_isLocked">Locked
by WebDAV
</em>
<em tal:condition="context/wl_isLocked">Locked</em>
<input tal:condition="not:context/wl_isLocked"
class="form-element" type="submit" value="Upload File" />
</div>
...
...
src/Products/SiteAccess/www/manage_edit.dtml
View file @
992f73e2
...
...
@@ -40,7 +40,7 @@ probably need to manage Zope using its raw IP address to fix things.
<td align="left" valign="top" colspan="2">
<div class="form-element">
<dtml-if wl_isLocked>
<em>Locked
by WebDAV
</em>
<em>Locked</em>
<dtml-else>
<input class="form-element" type="submit" name="SUBMIT" value="Save Changes">
</dtml-if>
...
...
src/Testing/ZopeTestCase/testFunctional.py
View file @
992f73e2
...
...
@@ -132,7 +132,7 @@ class TestFunctional(ZopeTestCase.FunctionalTestCase):
self
.
assertEqual
(
self
.
folder
.
index_html
(),
'foo'
)
def
testPUTNew
(
self
):
# Create a new object via
FTP or WebDAV
# Create a new object via
PUT
self
.
setPermissions
([
add_documents_images_and_files
])
put_data
=
StringIO
(
'foo'
)
...
...
src/ZPublisher/BaseRequest.py
View file @
992f73e2
...
...
@@ -34,7 +34,8 @@ from zope.publisher.interfaces.browser import IBrowserPublisher
from
zope.traversing.namespace
import
namespaceLookup
from
zope.traversing.namespace
import
nsParse
UNSPECIFIED_ROLES
=
''
UNSPECIFIED_ROLES
=
''
def
quote
(
text
):
# quote url path segments, but leave + and @ intact
...
...
src/webdav/tests/testPUT_factory.py
View file @
992f73e2
import
base64
import
unittest
import
Zope2
Zope2
.
startup
()
import
transaction
from
Products.SiteAccess.VirtualHostMonster
import
VirtualHostMonster
from
Testing.makerequest
import
makerequest
import
transaction
import
base64
import
Zope2
auth_info
=
'Basic %s'
%
base64
.
encodestring
(
'manager:secret'
).
rstrip
()
Zope2
.
startup
()
class
TestPUTFactory
(
unittest
.
TestCase
):
...
...
@@ -46,25 +48,29 @@ class TestPUTFactory(unittest.TestCase):
def
testSimpleVirtualHosting
(
self
):
request
=
self
.
app
.
REQUEST
put
=
request
.
traverse
(
'/VirtualHostBase/http/foo.com:80/VirtualHostRoot/folder/doc'
)
put
=
request
.
traverse
(
'/VirtualHostBase/http/foo.com:80/'
'VirtualHostRoot/folder/doc'
)
put
(
request
,
request
.
RESPONSE
)
self
.
assertTrue
(
'doc'
in
self
.
folder
.
objectIds
())
def
testSubfolderVirtualHosting
(
self
):
request
=
self
.
app
.
REQUEST
put
=
request
.
traverse
(
'/VirtualHostBase/http/foo.com:80/folder/VirtualHostRoot/doc'
)
put
=
request
.
traverse
(
'/VirtualHostBase/http/foo.com:80/'
'folder/VirtualHostRoot/doc'
)
put
(
request
,
request
.
RESPONSE
)
self
.
assertTrue
(
'doc'
in
self
.
folder
.
objectIds
())
def
testInsideOutVirtualHosting
(
self
):
request
=
self
.
app
.
REQUEST
put
=
request
.
traverse
(
'/VirtualHostBase/http/foo.com:80/VirtualHostRoot/_vh_foo/folder/doc'
)
put
=
request
.
traverse
(
'/VirtualHostBase/http/foo.com:80/'
'VirtualHostRoot/_vh_foo/folder/doc'
)
put
(
request
,
request
.
RESPONSE
)
self
.
assertTrue
(
'doc'
in
self
.
folder
.
objectIds
())
def
testSubfolderInsideOutVirtualHosting
(
self
):
request
=
self
.
app
.
REQUEST
put
=
request
.
traverse
(
'/VirtualHostBase/http/foo.com:80/folder/VirtualHostRoot/_vh_foo/doc'
)
put
=
request
.
traverse
(
'/VirtualHostBase/http/foo.com:80/'
'folder/VirtualHostRoot/_vh_foo/doc'
)
put
(
request
,
request
.
RESPONSE
)
self
.
assertTrue
(
'doc'
in
self
.
folder
.
objectIds
())
...
...
@@ -79,13 +85,7 @@ class TestPUTFactory(unittest.TestCase):
put
=
request
.
traverse
(
'/A/B/a'
)
put
(
request
,
request
.
RESPONSE
)
# PUT should no acquire A.a
self
.
assertEqual
(
str
(
self
.
app
.
A
.
a
),
'I am file a'
,
'PUT factory should not acquire content'
)
self
.
assertEqual
(
str
(
self
.
app
.
A
.
a
),
'I am file a'
,
'PUT factory should not acquire content'
)
# check for the newly created file
self
.
assertEqual
(
str
(
self
.
app
.
A
.
B
.
a
),
'bar'
)
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
TestPUTFactory
),
))
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