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