Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
Xueyun Qian
erp5
Commits
742d237c
Commit
742d237c
authored
Oct 13, 2014
by
Julien Muchembled
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop support for Zope < 2.13
parent
7f1a4034
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
14 additions
and
57 deletions
+14
-57
product/ERP5/tests/testContentTranslation.py
product/ERP5/tests/testContentTranslation.py
+3
-3
product/ERP5/tests/testEditorField.py
product/ERP5/tests/testEditorField.py
+3
-4
product/ERP5/tests/testTranslation.py
product/ERP5/tests/testTranslation.py
+1
-3
product/ERP5/tests/testXHTML.py
product/ERP5/tests/testXHTML.py
+2
-4
product/ERP5Type/Tool/ComponentTool.py
product/ERP5Type/Tool/ComponentTool.py
+2
-4
product/ERP5Type/patches/DemoStorage.py
product/ERP5Type/patches/DemoStorage.py
+0
-2
product/ERP5Type/tests/custom_zodb.py
product/ERP5Type/tests/custom_zodb.py
+0
-14
product/ERP5Type/tests/utils.py
product/ERP5Type/tests/utils.py
+0
-10
product/PortalTransforms/TransformEngine.py
product/PortalTransforms/TransformEngine.py
+1
-5
product/ZLDAPMethods/LM.py
product/ZLDAPMethods/LM.py
+1
-4
product/ZSQLCatalog/ZSQLCatalog.py
product/ZSQLCatalog/ZSQLCatalog.py
+1
-4
No files found.
product/ERP5/tests/testContentTranslation.py
View file @
742d237c
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
##############################################################################
##############################################################################
import
unittest
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
to_utf8
class
TestContentTranslation
(
ERP5TypeTestCase
):
class
TestContentTranslation
(
ERP5TypeTestCase
):
...
@@ -208,8 +207,9 @@ class TestContentTranslation(ERP5TypeTestCase):
...
@@ -208,8 +207,9 @@ class TestContentTranslation(ERP5TypeTestCase):
self
.
tic
()
self
.
tic
()
self
.
assert_
(
'タハラ'
in
to_utf8
(
person
.
Base_viewContentTranslation
()))
x
=
person
.
Base_viewContentTranslation
().
encode
(
'utf-8'
)
self
.
assert_
(
'ユウセイ'
in
to_utf8
(
person
.
Base_viewContentTranslation
()))
self
.
assertTrue
(
'タハラ'
in
x
)
self
.
assertTrue
(
'ユウセイ'
in
x
)
self
.
assertEqual
(
person
.
getJaKanaTranslatedFirstName
(),
'タハラ'
)
self
.
assertEqual
(
person
.
getJaKanaTranslatedFirstName
(),
'タハラ'
)
self
.
assertEqual
(
person
.
getJaKanaTranslatedLastName
(),
'ユウセイ'
)
self
.
assertEqual
(
person
.
getJaKanaTranslatedLastName
(),
'ユウセイ'
)
...
...
product/ERP5/tests/testEditorField.py
View file @
742d237c
...
@@ -34,7 +34,6 @@ import unittest
...
@@ -34,7 +34,6 @@ import unittest
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
from
Testing
import
ZopeTestCase
from
Testing
import
ZopeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
to_utf8
class
TestEditorField
(
ERP5TypeTestCase
,
ZopeTestCase
.
Functional
):
class
TestEditorField
(
ERP5TypeTestCase
,
ZopeTestCase
.
Functional
):
"""
"""
...
@@ -128,7 +127,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -128,7 +127,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
text_content -- the embedded text content
text_content -- the embedded text content
"""
"""
html_text
=
to_utf8
(
html_text
)
html_text
=
html_text
.
encode
(
'utf-8'
)
match_string1
=
"var oFCKeditor = new FCKeditor('field_%s');"
%
field_id
match_string1
=
"var oFCKeditor = new FCKeditor('field_%s');"
%
field_id
match_string2
=
"oFCKeditor.Value = '%s';"
%
(
'
\
\
n'
.
join
(
text_content
.
splitlines
()))
match_string2
=
"oFCKeditor.Value = '%s';"
%
(
'
\
\
n'
.
join
(
text_content
.
splitlines
()))
if
html_text
.
find
(
match_string1
)
==
-
1
:
if
html_text
.
find
(
match_string1
)
==
-
1
:
...
@@ -153,7 +152,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -153,7 +152,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
text_content -- the embedded text content
text_content -- the embedded text content
"""
"""
html_text
=
to_utf8
(
html_text
)
html_text
=
html_text
.
encode
(
'utf-8'
)
match_string
=
"""name="field_%s" >
\
n
%s</textarea>"""
%
(
field_id
,
text_content
)
match_string
=
"""name="field_%s" >
\
n
%s</textarea>"""
%
(
field_id
,
text_content
)
if
html_text
.
find
(
match_string
)
==
-
1
:
if
html_text
.
find
(
match_string
)
==
-
1
:
print
html_text
print
html_text
...
@@ -172,7 +171,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -172,7 +171,7 @@ class TestEditorField(ERP5TypeTestCase, ZopeTestCase.Functional):
document -- the document which content is displayed in
document -- the document which content is displayed in
read only mode
read only mode
"""
"""
html_text
=
to_utf8
(
html_text
)
html_text
=
html_text
.
encode
(
'utf-8'
)
text_content
=
document
.
asStrippedHTML
()
text_content
=
document
.
asStrippedHTML
()
match_string1
=
"""<div class="input"><div class="page" >
\
n
%s</div></div>"""
%
text_content
match_string1
=
"""<div class="input"><div class="page" >
\
n
%s</div></div>"""
%
text_content
match_string2
=
"""<div class="field page"""
match_string2
=
"""<div class="field page"""
...
...
product/ERP5/tests/testTranslation.py
View file @
742d237c
...
@@ -31,7 +31,6 @@ import unittest
...
@@ -31,7 +31,6 @@ import unittest
import
MethodObject
import
MethodObject
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
to_utf8
from
Products.ERP5Type.Utils
import
getMessageIdWithContext
from
Products.ERP5Type.Utils
import
getMessageIdWithContext
from
zLOG
import
LOG
from
zLOG
import
LOG
...
@@ -440,8 +439,7 @@ class TestTranslation(ERP5TypeTestCase):
...
@@ -440,8 +439,7 @@ class TestTranslation(ERP5TypeTestCase):
</tal:ommit>
</tal:ommit>
"""
%
domain
"""
%
domain
self
.
myzpt
.
pt_edit
(
zpt_template
,
'text/html'
)
self
.
myzpt
.
pt_edit
(
zpt_template
,
'text/html'
)
results
=
to_utf8
(
self
.
myzpt
(
words
=
words
)).
split
()
return
self
.
myzpt
(
words
=
words
).
encode
(
'utf-8'
).
split
()
return
results
def
test_ZPT_translation
(
self
):
def
test_ZPT_translation
(
self
):
results
=
self
.
translate_by_zpt
(
'erp5_ui'
,
'Person'
,
'Draft'
)
results
=
self
.
translate_by_zpt
(
'erp5_ui'
,
'Person'
,
'Draft'
)
...
...
product/ERP5/tests/testXHTML.py
View file @
742d237c
...
@@ -445,10 +445,8 @@ class W3Validator(object):
...
@@ -445,10 +445,8 @@ class W3Validator(object):
'''
'''
retrun two list : a list of errors and an other for warnings
retrun two list : a list of errors and an other for warnings
'''
'''
if
isinstance
(
page_source
,
unicode
):
source
=
'fragment=%s&output=soap12'
%
urllib
.
quote_plus
(
# Zope 2.12 renders page templates as unicode
page_source
.
encode
(
'utf-8'
))
page_source
=
page_source
.
encode
(
'utf-8'
)
source
=
'fragment=%s&output=soap12'
%
urllib
.
quote_plus
(
page_source
)
stdout
,
stderr
=
Popen
(
self
.
validator_path
,
stdout
,
stderr
=
Popen
(
self
.
validator_path
,
stdin
=
PIPE
,
stdout
=
PIPE
,
stderr
=
PIPE
,
stdin
=
PIPE
,
stdout
=
PIPE
,
stderr
=
PIPE
,
close_fds
=
True
,
close_fds
=
True
,
...
...
product/ERP5Type/Tool/ComponentTool.py
View file @
742d237c
...
@@ -74,10 +74,8 @@ class ComponentTool(BaseTool):
...
@@ -74,10 +74,8 @@ class ComponentTool(BaseTool):
is called on Portal Type class when loading Componet Tool Portal Type
is called on Portal Type class when loading Componet Tool Portal Type
class
class
"""
"""
# XXX-Cosmetic: From Zope >= 2.13, getPermissions() can be used instead of
from
AccessControl.Permission
import
getPermissions
,
pname
# protected _registeredPermissions module attribute
for
permission_name
,
_
,
_
in
getPermissions
():
from
AccessControl.Permission
import
_registeredPermissions
,
pname
for
permission_name
in
_registeredPermissions
:
if
permission_name
==
'Reset dynamic classes'
:
if
permission_name
==
'Reset dynamic classes'
:
permission_function
=
lambda
self
:
(
'Manager'
,)
permission_function
=
lambda
self
:
(
'Manager'
,)
elif
permission_name
in
(
'Change permissions'
,
'Define permissions'
):
elif
permission_name
in
(
'Change permissions'
,
'Define permissions'
):
...
...
product/ERP5Type/patches/DemoStorage.py
View file @
742d237c
...
@@ -30,8 +30,6 @@ class DemoStorage(_DemoStorage.DemoStorage, ConflictResolvingStorage):
...
@@ -30,8 +30,6 @@ class DemoStorage(_DemoStorage.DemoStorage, ConflictResolvingStorage):
except
ConflictError
,
e
:
except
ConflictError
,
e
:
old
=
e
.
serials
[
0
]
old
=
e
.
serials
[
0
]
rdata
=
self
.
tryToResolveConflict
(
oid
,
old
,
serial
,
data
)
rdata
=
self
.
tryToResolveConflict
(
oid
,
old
,
serial
,
data
)
if
rdata
is
None
:
# BBB: Zope < 2.13
raise
ConflictError
(
oid
=
oid
,
serials
=
(
old
,
serial
),
data
=
data
)
self
.
changes
.
store
(
oid
,
old
,
rdata
,
''
,
transaction
)
self
.
changes
.
store
(
oid
,
old
,
rdata
,
''
,
transaction
)
return
ResolvedSerial
return
ResolvedSerial
...
...
product/ERP5Type/tests/custom_zodb.py
View file @
742d237c
...
@@ -66,23 +66,9 @@ elif save and not (neo_storage or zeo_client) and os.path.exists(data_fs_path):
...
@@ -66,23 +66,9 @@ elif save and not (neo_storage or zeo_client) and os.path.exists(data_fs_path):
zeo_server_pid
=
None
zeo_server_pid
=
None
node_pid_list
=
[]
node_pid_list
=
[]
ZEvent
=
sys
.
modules
.
get
(
'ZServer.PubCore.ZEvent'
)
zrpc
=
sys
.
modules
.
get
(
'ZEO.zrpc.connection'
)
def
fork
():
def
fork
():
pid
=
os
.
fork
()
pid
=
os
.
fork
()
if
pid
:
if
pid
:
# recreate event pipes that already exist
# BBB: This is useless on Zope 2.13+ since ZEO now imports cleanly.
for
obj
in
socket_map
.
values
():
obj
.
close
()
if
obj
is
ZEvent
.
the_trigger
:
ZEvent
.
the_trigger
=
ZEvent
.
simple_trigger
()
else
:
assert
obj
is
zrpc
.
ManagedServerConnection
.
trigger
zrpc
.
ManagedServerConnection
.
trigger
=
zrpc
.
trigger
()
zrpc
.
ManagedClientConnection
.
trigger
.
close
()
zrpc
.
ManagedClientConnection
.
trigger
=
\
zrpc
.
client_trigger
=
zrpc
.
trigger
(
zrpc
.
client_map
)
# make sure parent and child have 2 different RNG
# make sure parent and child have 2 different RNG
instance_random
.
seed
(
instance_random
.
random
())
instance_random
.
seed
(
instance_random
.
random
())
return
pid
return
pid
...
...
product/ERP5Type/tests/utils.py
View file @
742d237c
...
@@ -448,16 +448,6 @@ class LogInterceptor:
...
@@ -448,16 +448,6 @@ class LogInterceptor:
handler
.
removeFilter
(
self
)
handler
.
removeFilter
(
self
)
self
.
installed
=
tuple
([
s
for
s
in
self
.
installed
if
s
!=
subsystem
])
self
.
installed
=
tuple
([
s
for
s
in
self
.
installed
if
s
!=
subsystem
])
def
to_utf8
(
text
):
""" Converts string to utf-8 if string is unicode """
# BACK: The users of this function are probably reading the result of
# PageTemplate rendering, which is unicode in Zope 2.12, but string in Zope
# 2.8. When support for Zope 2.8 is dropped, rewrite the tests to assume
# the rendering is unicode and deal with it appropriately.
if
isinstance
(
text
,
unicode
):
text
=
text
.
encode
(
'utf-8'
)
return
text
def
updateCellList
(
portal
,
line
,
cell_type
,
cell_range_method
,
cell_dict_list
):
def
updateCellList
(
portal
,
line
,
cell_type
,
cell_range_method
,
cell_dict_list
):
"""A matrixbox-like helper function to create cells at once.
"""A matrixbox-like helper function to create cells at once.
...
...
product/PortalTransforms/TransformEngine.py
View file @
742d237c
...
@@ -11,11 +11,7 @@ from OFS.Folder import Folder
...
@@ -11,11 +11,7 @@ from OFS.Folder import Folder
from
Persistence
import
PersistentMapping
from
Persistence
import
PersistentMapping
from
Products.CMFCore.ActionProviderBase
import
ActionProviderBase
from
Products.CMFCore.ActionProviderBase
import
ActionProviderBase
from
Products.CMFCore.permissions
import
ManagePortal
,
View
from
Products.CMFCore.permissions
import
ManagePortal
,
View
try
:
from
Products.CMFCore.utils
import
registerToolInterface
,
UniqueObject
from
Products.CMFCore.utils
import
registerToolInterface
except
ImportError
:
# BACK: Zope 2.8
registerToolInterface
=
lambda
tool_id
,
tool_interface
:
None
from
Products.CMFCore.utils
import
UniqueObject
from
Products.CMFCore.utils
import
getToolByName
from
Products.CMFCore.utils
import
getToolByName
from
Products.PageTemplates.PageTemplateFile
import
PageTemplateFile
from
Products.PageTemplates.PageTemplateFile
import
PageTemplateFile
...
...
product/ZLDAPMethods/LM.py
View file @
742d237c
...
@@ -27,10 +27,7 @@ import sys
...
@@ -27,10 +27,7 @@ import sys
from
zLOG
import
LOG
,
INFO
from
zLOG
import
LOG
,
INFO
from
ldif
import
LDIFRecordList
,
is_dn
,
valid_changetype_dict
,
CHANGE_TYPES
from
ldif
import
LDIFRecordList
,
is_dn
,
valid_changetype_dict
,
CHANGE_TYPES
import
ldifvar
import
ldifvar
try
:
from
DocumentTemplate.security
import
RestrictedDTML
from
DocumentTemplate.security
import
RestrictedDTML
except
ImportError
:
# BBB Zope-2.12
from
AccessControl.DTML
import
RestrictedDTML
try
:
try
:
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
except
ImportError
:
except
ImportError
:
...
...
product/ZSQLCatalog/ZSQLCatalog.py
View file @
742d237c
...
@@ -26,10 +26,7 @@ from DocumentTemplate.DT_Util import Eval
...
@@ -26,10 +26,7 @@ from DocumentTemplate.DT_Util import Eval
from
AccessControl.Permission
import
name_trans
from
AccessControl.Permission
import
name_trans
from
SQLCatalog
import
CatalogError
from
SQLCatalog
import
CatalogError
from
AccessControl
import
ClassSecurityInfo
from
AccessControl
import
ClassSecurityInfo
try
:
from
DocumentTemplate.security
import
RestrictedDTML
from
DocumentTemplate.security
import
RestrictedDTML
except
ImportError
:
# BBB Zope-2.12
from
AccessControl.DTML
import
RestrictedDTML
from
Products.CMFCore.utils
import
getToolByName
from
Products.CMFCore.utils
import
getToolByName
from
Products.ERP5Type.Cache
import
clearCache
from
Products.ERP5Type.Cache
import
clearCache
import
string
,
sys
import
string
,
sys
...
...
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