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
f1023cfb
Commit
f1023cfb
authored
May 08, 2011
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added forward compatibility with DateTime 3 by backporting c121602 and c121606 from trunk
parent
e215a9d1
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
16 additions
and
11 deletions
+16
-11
doc/CHANGES.rst
doc/CHANGES.rst
+2
-0
src/App/PersistentExtra.py
src/App/PersistentExtra.py
+3
-3
src/ZPublisher/Converters.py
src/ZPublisher/Converters.py
+5
-4
src/ZPublisher/tests/testHTTPRequest.py
src/ZPublisher/tests/testHTTPRequest.py
+3
-3
src/ZPublisher/xmlrpc.py
src/ZPublisher/xmlrpc.py
+3
-1
No files found.
doc/CHANGES.rst
View file @
f1023cfb
...
...
@@ -15,6 +15,8 @@ Bugs Fixed
Features Added
++++++++++++++
- Added forward compatibility with DateTime 3.
- ZPublisher: HTTPResponse.appendHeader now keeps header values to a single
line by default to avoid causing problems for proxy servers which do not
correctly handle multi-line headers.
...
...
src/App/PersistentExtra.py
View file @
f1023cfb
...
...
@@ -18,14 +18,14 @@ from DateTime.DateTime import DateTime
class
PersistentUtil
:
def
bobobase_modification_time
(
self
):
jar
=
self
.
_p_jar
oid
=
self
.
_p_oid
jar
=
self
.
_p_jar
oid
=
self
.
_p_oid
if
jar
is
None
or
oid
is
None
:
return
DateTime
()
try
:
t
=
self
.
_p_mtime
except
:
except
AttributeError
:
t
=
0
return
DateTime
(
t
)
...
...
src/ZPublisher/Converters.py
View file @
f1023cfb
...
...
@@ -14,6 +14,7 @@
import
re
from
types
import
ListType
,
TupleType
,
UnicodeType
from
DateTime
import
DateTime
from
DateTime.interfaces
import
SyntaxError
from
cgi
import
escape
# This may get overwritten during configuration
...
...
@@ -106,16 +107,16 @@ def field2date(v):
v
=
field2string
(
v
)
try
:
v
=
DateTime
(
v
)
except
DateTime
.
SyntaxError
,
e
:
raise
DateTime
.
SyntaxError
,
"Invalid DateTime "
+
escape
(
`v`
)
except
SyntaxError
:
raise
SyntaxError
(
"Invalid DateTime "
+
escape
(
repr
(
v
))
)
return
v
def
field2date_international
(
v
):
v
=
field2string
(
v
)
try
:
v
=
DateTime
(
v
,
datefmt
=
"international"
)
except
DateTime
.
SyntaxError
,
e
:
raise
DateTime
.
SyntaxError
,
"Invalid DateTime "
+
escape
(
`v`
)
except
SyntaxError
:
raise
SyntaxError
(
"Invalid DateTime "
+
escape
(
repr
(
v
))
)
return
v
def
field2boolean
(
v
):
...
...
src/ZPublisher/tests/testHTTPRequest.py
View file @
f1023cfb
...
...
@@ -573,15 +573,15 @@ class HTTPRequestTests(unittest.TestCase):
def
test_processInputs_w_tainted_values_cleans_exceptions
(
self
):
# Feed tainted garbage to the conversion methods, and any exception
# returned should be HTML safe
from
DateTime.
DateTime
import
DateTime
from
DateTime.
interfaces
import
SyntaxError
from
ZPublisher.Converters
import
type_converters
for
type
,
convert
in
type_converters
.
items
():
try
:
convert
(
'<html garbage>'
)
except
Exception
,
e
:
except
Exception
as
e
:
self
.
assertFalse
(
'<'
in
e
.
args
,
'%s converter does not quote unsafe value!'
%
type
)
except
DateTime
.
SyntaxError
,
e
:
except
SyntaxError
as
e
:
self
.
assertFalse
(
'<'
in
e
,
'%s converter does not quote unsafe value!'
%
type
)
...
...
src/ZPublisher/xmlrpc.py
View file @
f1023cfb
...
...
@@ -32,7 +32,7 @@ from ZPublisher.HTTPResponse import HTTPResponse
# Make DateTime.DateTime marshallable via XML-RPC
# http://www.zope.org/Collectors/Zope/2109
from
DateTime.DateTime
import
DateTime
WRAPPERS
=
xmlrpclib
.
WRAPPERS
+
(
DateTime
,)
WRAPPERS
=
xmlrpclib
.
WRAPPERS
+
(
DateTime
,
)
def
dump_instance
(
self
,
value
,
write
):
# Check for special wrappers
...
...
@@ -50,6 +50,8 @@ def dump_instance(self, value, write):
self
.
dump_struct
(
value
,
write
)
xmlrpclib
.
Marshaller
.
dispatch
[
types
.
InstanceType
]
=
dump_instance
xmlrpclib
.
Marshaller
.
dispatch
[
DateTime
]
=
dump_instance
def
parse_input
(
data
):
"""Parse input data and return a method path and argument tuple
...
...
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