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
51ca8043
Commit
51ca8043
authored
Aug 14, 2016
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Start using six and canonicalize version_info check.
parent
3f9d9434
Changes
22
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
46 additions
and
37 deletions
+46
-37
setup.py
setup.py
+1
-0
src/App/Extensions.py
src/App/Extensions.py
+3
-1
src/OFS/Image.py
src/OFS/Image.py
+1
-1
src/OFS/SimpleItem.py
src/OFS/SimpleItem.py
+3
-1
src/OFS/Uninstalled.py
src/OFS/Uninstalled.py
+3
-2
src/Products/Five/fiveconfigure.py
src/Products/Five/fiveconfigure.py
+1
-1
src/Products/PageTemplates/Expressions.py
src/Products/PageTemplates/Expressions.py
+1
-1
src/Products/PageTemplates/ZRPythonExpr.py
src/Products/PageTemplates/ZRPythonExpr.py
+1
-1
src/Products/PageTemplates/ZopePageTemplate.py
src/Products/PageTemplates/ZopePageTemplate.py
+1
-1
src/Products/PageTemplates/tests/testExpressions.py
src/Products/PageTemplates/tests/testExpressions.py
+1
-1
src/Products/PageTemplates/tests/testHTMLTests.py
src/Products/PageTemplates/tests/testHTMLTests.py
+1
-1
src/Products/PageTemplates/tests/testZopePageTemplate.py
src/Products/PageTemplates/tests/testZopePageTemplate.py
+1
-1
src/Products/PageTemplates/unicodeconflictresolver.py
src/Products/PageTemplates/unicodeconflictresolver.py
+1
-1
src/Products/PageTemplates/utils.py
src/Products/PageTemplates/utils.py
+1
-1
src/Shared/DC/Scripts/Bindings.py
src/Shared/DC/Scripts/Bindings.py
+4
-3
src/Testing/ZopeTestCase/ZopeLite.py
src/Testing/ZopeTestCase/ZopeLite.py
+4
-1
src/ZPublisher/HTTPRequest.py
src/ZPublisher/HTTPRequest.py
+1
-1
src/ZPublisher/Publish.py
src/ZPublisher/Publish.py
+5
-5
src/ZPublisher/tests/testBeforeTraverse.py
src/ZPublisher/tests/testBeforeTraverse.py
+2
-1
src/ZPublisher/tests/test_xmlrpc.py
src/ZPublisher/tests/test_xmlrpc.py
+2
-6
src/Zope2/App/startup.py
src/Zope2/App/startup.py
+7
-5
src/Zope2/utilities/mkwsgiinstance.py
src/Zope2/utilities/mkwsgiinstance.py
+1
-1
No files found.
setup.py
View file @
51ca8043
...
...
@@ -64,6 +64,7 @@ setup(
'five.globalrequest'
,
'repoze.retry'
,
'setuptools'
,
'six'
,
'transaction'
,
'waitress'
,
'zExceptions >= 3.2'
,
...
...
src/App/Extensions.py
View file @
51ca8043
...
...
@@ -17,6 +17,8 @@ Extensions currently include external methods.
import
imp
import
os
from
six
import
exec_
import
Products
from
zExceptions
import
NotFound
...
...
@@ -184,7 +186,7 @@ def getObject(module, name, reload=0,
raise
NotFound
(
"The specified module, '%s', "
"couldn't be opened."
%
module
)
module_dict
=
{}
exec
execsrc
in
module_dict
exec
_
(
execsrc
,
module_dict
)
if
old
is
not
None
:
# XXX Accretive??
...
...
src/OFS/Image.py
View file @
51ca8043
...
...
@@ -48,7 +48,7 @@ from zope.event import notify
from
zope.lifecycleevent
import
ObjectModifiedEvent
from
zope.lifecycleevent
import
ObjectCreatedEvent
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
):
unicode
=
str
manage_addFileForm
=
DTMLFile
(
...
...
src/OFS/SimpleItem.py
View file @
51ca8043
...
...
@@ -24,6 +24,8 @@ import re
import
sys
import
time
from
six
import
reraise
from
AccessControl.class_init
import
InitializeClass
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
AccessControl.SecurityManagement
import
getSecurityManager
...
...
@@ -189,7 +191,7 @@ class Item(Base,
if
hasattr
(
self
,
'_v_eek'
):
# Stop if there is recursion.
r
aise
error_type
,
error_value
,
tb
r
eraise
(
error_type
,
error_value
,
tb
)
self
.
_v_eek
=
1
if
hasattr
(
error_type
,
'__name__'
):
...
...
src/OFS/Uninstalled.py
View file @
51ca8043
...
...
@@ -22,6 +22,7 @@ from Acquisition import Explicit
from
App.special_dtml
import
DTMLFile
from
OFS.SimpleItem
import
Item
from
Persistence
import
Overridable
from
six
import
exec_
from
ZODB.broken
import
Broken
as
ZODB_Broken
from
ZODB.broken
import
persistentBroken
...
...
@@ -58,8 +59,8 @@ def Broken(self, oid, pair):
else
:
module
,
klassname
=
pair
d
=
{
'BrokenClass'
:
BrokenClass
}
exec
(
"class %s(BrokenClass): ' '; __module__=%r"
%
(
klassname
,
module
))
in
d
exec
_
(
"class %s(BrokenClass): ' '; __module__=%r"
%
(
klassname
,
module
),
d
)
klass
=
broken_klasses
[
pair
]
=
d
[
klassname
]
module
=
module
.
split
(
'.'
)
if
len
(
module
)
>
2
and
module
[
0
]
==
'Products'
:
...
...
src/Products/Five/fiveconfigure.py
View file @
51ca8043
...
...
@@ -27,7 +27,7 @@ from zope.publisher.interfaces.browser import IDefaultBrowserLayer
from
Products.Five.browser.metaconfigure
import
page
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
):
basestring
=
str
logger
=
logging
.
getLogger
(
'Products.Five'
)
...
...
src/Products/PageTemplates/Expressions.py
View file @
51ca8043
...
...
@@ -47,7 +47,7 @@ from zope.contentprovider.tales import TALESProviderExpression
from
Products.PageTemplates
import
ZRPythonExpr
from
Products.PageTemplates.interfaces
import
IUnicodeEncodingConflictResolver
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
):
basestring
=
str
unicode
=
str
...
...
src/Products/PageTemplates/ZRPythonExpr.py
View file @
51ca8043
...
...
@@ -24,7 +24,7 @@ from DocumentTemplate.security import RestrictedDTML
from
RestrictedPython
import
compile_restricted_eval
from
zope.tales.pythonexpr
import
PythonExpr
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
):
unicode
=
str
...
...
src/Products/PageTemplates/ZopePageTemplate.py
View file @
51ca8043
...
...
@@ -45,7 +45,7 @@ from Products.PageTemplates.utils import encodingFromXMLPreamble
from
Products.PageTemplates.utils
import
charsetFromMetaEquiv
from
Products.PageTemplates.utils
import
convertToUnicode
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
):
unicode
=
str
preferred_encodings
=
[
'utf-8'
,
'iso-8859-15'
]
...
...
src/Products/PageTemplates/tests/testExpressions.py
View file @
51ca8043
...
...
@@ -5,7 +5,7 @@ import unittest
from
zope.component.testing
import
PlacelessSetup
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
):
unicode
=
str
...
...
src/Products/PageTemplates/tests/testHTMLTests.py
View file @
51ca8043
...
...
@@ -27,7 +27,7 @@ from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver
from
Products.PageTemplates.unicodeconflictresolver
import
\
DefaultUnicodeEncodingConflictResolver
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
):
unicode
=
str
...
...
src/Products/PageTemplates/tests/testZopePageTemplate.py
View file @
51ca8043
...
...
@@ -26,7 +26,7 @@ from Products.PageTemplates.unicodeconflictresolver \
import
PreferredCharsetResolver
import
Zope2
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
):
unicode
=
str
ascii_str
=
'<html><body>hello world</body></html>'
...
...
src/Products/PageTemplates/unicodeconflictresolver.py
View file @
51ca8043
...
...
@@ -20,7 +20,7 @@ from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver
from
zope.interface
import
implements
from
zope.i18n.interfaces
import
IUserPreferredCharsets
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
):
unicode
=
str
default_encoding
=
sys
.
getdefaultencoding
()
...
...
src/Products/PageTemplates/utils.py
View file @
51ca8043
...
...
@@ -16,7 +16,7 @@
import
re
import
sys
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
):
unicode
=
str
xml_preamble_reg
=
re
.
compile
(
...
...
src/Shared/DC/Scripts/Bindings.py
View file @
51ca8043
...
...
@@ -14,6 +14,8 @@
import
re
import
string
from
six
import
exec_
from
AccessControl.class_init
import
InitializeClass
from
AccessControl.SecurityInfo
import
ClassSecurityInfo
from
AccessControl.SecurityManagement
import
getSecurityManager
...
...
@@ -23,7 +25,6 @@ from AccessControl.unauthorized import Unauthorized
from
AccessControl.ZopeGuards
import
guarded_getattr
from
Acquisition
import
aq_parent
from
Acquisition
import
aq_inner
from
Persistence
import
Persistent
defaultBindings
=
{
'name_context'
:
'context'
,
'name_container'
:
'container'
,
...
...
@@ -207,7 +208,7 @@ class Bindings:
security
.
declareProtected
(
'Change bindings'
,
'ZBindings_edit'
)
def
ZBindings_edit
(
self
,
mapping
):
names
=
self
.
_setupBindings
(
mapping
)
self
.
_setupBindings
(
mapping
)
self
.
_prepareBindCode
()
self
.
_editedBindings
()
...
...
@@ -356,7 +357,7 @@ class Bindings:
bound_data
=
{}
else
:
bound_data
=
[]
exec
bindcode
exec
_
(
bindcode
)
bound_data
=
bound_data
[
0
]
return
self
.
_exec
(
bound_data
,
args
,
kw
)
finally
:
...
...
src/Testing/ZopeTestCase/ZopeLite.py
View file @
51ca8043
...
...
@@ -26,6 +26,9 @@ Typically used as in
import
os
import
sys
import
time
from
six
import
exec_
from
Testing.ZopeTestCase
import
layer
# Allow code to tell it is run by the test framework
...
...
@@ -54,7 +57,7 @@ def _exec(cmd):
'''Prints the time it takes to execute 'cmd'.'''
if
os
.
environ
.
get
(
'X'
,
None
):
start
=
time
.
time
()
exec
cmd
exec
_
(
cmd
)
_print
(
'(%.3fs)'
%
(
time
.
time
()
-
start
))
_write
(
'Loading Zope, please stand by '
)
...
...
src/ZPublisher/HTTPRequest.py
View file @
51ca8043
...
...
@@ -46,7 +46,7 @@ from ZPublisher.BaseRequest import BaseRequest
from
ZPublisher.BaseRequest
import
quote
from
ZPublisher.Converters
import
get_converter
if
sys
.
version_info
>=
(
3
,
0
):
if
sys
.
version_info
>=
(
3
,
):
unicode
=
str
# Flags
...
...
src/ZPublisher/Publish.py
View file @
51ca8043
...
...
@@ -18,6 +18,7 @@ from thread import allocate_lock
import
transaction
from
urlparse
import
urlparse
from
six
import
reraise
from
zExceptions
import
Redirect
from
zope.event
import
notify
from
zope.publisher.interfaces
import
ISkinnable
...
...
@@ -45,7 +46,7 @@ class Retry(Exception):
if
tb
is
None
:
raise
t
(
v
)
try
:
r
aise
t
,
v
,
tb
r
eraise
(
t
,
v
,
tb
)
finally
:
tb
=
None
...
...
@@ -310,7 +311,7 @@ def publish_module_standard(
request
.
response
.
_requestShutdown
(
code
)
try
:
r
aise
must_die
[
0
],
must_die
[
1
],
must_die
[
2
]
r
eraise
(
must_die
[
0
],
must_die
[
1
],
must_die
[
2
])
finally
:
must_die
=
None
...
...
@@ -378,10 +379,9 @@ def get_module_info(module_name, modules={},
modules
[
module_name
]
=
modules
[
module_name
+
'.cgi'
]
=
info
return
info
except
:
except
Exception
:
t
,
v
,
tb
=
sys
.
exc_info
()
v
=
str
(
v
)
raise
ImportError
,
(
t
,
v
),
tb
reraise
(
t
,
str
(
v
),
tb
)
finally
:
tb
=
None
release
()
...
...
src/ZPublisher/tests/testBeforeTraverse.py
View file @
51ca8043
...
...
@@ -119,7 +119,8 @@ def testBeforeTraverse(self):
Unregister the borken hook:
>>> _ = BeforeTraverse.unregisterBeforeTraverse(container, 'broken_callable')
>>> _ = BeforeTraverse.unregisterBeforeTraverse(
... container, 'broken_callable')
The list of 'before traverse' hooks is empty:
...
...
src/ZPublisher/tests/test_xmlrpc.py
View file @
51ca8043
...
...
@@ -188,7 +188,6 @@ class XMLRPCResponseTests(unittest.TestCase):
def
test_functionattribute
(
self
):
# Cannot marshal functions or methods, obviously
import
sys
import
xmlrpclib
def
foo
():
...
...
@@ -198,11 +197,8 @@ class XMLRPCResponseTests(unittest.TestCase):
faux
=
FauxResponse
()
response
=
self
.
_makeOne
(
faux
)
response
.
setBody
(
body
)
if
sys
.
version_info
<
(
2
,
6
):
self
.
assertRaises
(
xmlrpclib
.
Fault
,
xmlrpclib
.
loads
,
faux
.
_body
)
else
:
func
=
xmlrpclib
.
loads
(
faux
.
_body
)
self
.
assertEqual
(
func
,
(({
'public'
:
{}},),
None
))
func
=
xmlrpclib
.
loads
(
faux
.
_body
)
self
.
assertEqual
(
func
,
(({
'public'
:
{}},),
None
))
def
test_emptystringattribute
(
self
):
# Test an edge case: attribute name '' is possible,
...
...
src/Zope2/App/startup.py
View file @
51ca8043
...
...
@@ -18,6 +18,8 @@ import logging
import
sys
from
time
import
asctime
from
six
import
reraise
import
AccessControl.User
import
App.ZApplication
import
ExtensionClass
...
...
@@ -196,7 +198,7 @@ class ZPublisherExceptionHook:
def
__call__
(
self
,
published
,
REQUEST
,
t
,
v
,
traceback
):
try
:
if
t
is
SystemExit
or
issubclass
(
t
,
Redirect
):
r
aise
t
,
v
,
traceback
r
eraise
(
t
,
v
,
traceback
)
if
issubclass
(
t
,
ConflictError
):
self
.
logConflicts
(
v
,
REQUEST
)
...
...
@@ -227,7 +229,7 @@ class ZPublisherExceptionHook:
if
(
REQUEST
is
None
or
(
getattr
(
REQUEST
.
get
(
'RESPONSE'
,
None
),
'_error_format'
,
''
)
!=
'text/html'
)):
r
aise
t
,
v
,
traceback
r
eraise
(
t
,
v
,
traceback
)
# Lookup a view for the exception and render it, then
# raise the rendered value as the exception value
...
...
@@ -247,7 +249,7 @@ class ZPublisherExceptionHook:
# correctly. We can't do that with all exceptions
# because some don't work with the rendered v as
# argument.
r
aise
t
,
v
,
traceback
r
eraise
(
t
,
v
,
traceback
)
response
=
REQUEST
.
RESPONSE
response
.
setStatus
(
t
)
response
.
setBody
(
v
)
...
...
@@ -265,7 +267,7 @@ class ZPublisherExceptionHook:
if
f
is
None
:
published
=
aq_parent
(
published
)
if
published
is
None
:
r
aise
t
,
v
,
traceback
r
eraise
(
t
,
v
,
traceback
)
else
:
break
...
...
@@ -293,7 +295,7 @@ class ZPublisherExceptionHook:
# correctly. We can't do that with all exceptions
# because some don't work with the rendered v as
# argument.
r
aise
t
,
v
,
traceback
r
eraise
(
t
,
v
,
traceback
)
response
=
REQUEST
.
RESPONSE
response
.
setStatus
(
t
)
response
.
setBody
(
v
)
...
...
src/Zope2/utilities/mkwsgiinstance.py
View file @
51ca8043
...
...
@@ -31,7 +31,7 @@ import os
import
sys
import
copyzopeskel
if
sys
.
version_info
>
(
3
,
0
):
if
sys
.
version_info
>
(
3
,
):
raw_input
=
input
...
...
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