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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
erp5
Commits
0cfb1586
Commit
0cfb1586
authored
Jan 13, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Plain Diff
More python3 support
See merge request
nexedi/erp5!1863
parents
2e8ef0bb
7fc1e3b0
Changes
42
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
42 changed files
with
213 additions
and
191 deletions
+213
-191
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.py
...nting/AccountingTransactionLine_resetGroupingReference.py
+3
-3
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.xml
...ting/AccountingTransactionLine_resetGroupingReference.xml
+1
-1
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_setGroupingReference.py
...nting/AccountingTransactionModule_setGroupingReference.py
+1
-1
bt5/erp5_accounting/TestTemplateItem/portal_components/test.erp5.testAccounting.py
...emplateItem/portal_components/test.erp5.testAccounting.py
+1
-1
bt5/erp5_big_file/DocumentTemplateItem/portal_components/document.erp5.BigFile.py
...ntTemplateItem/portal_components/document.erp5.BigFile.py
+4
-0
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
...mplateItem/portal_components/test.erp5.testERP5Catalog.py
+8
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testXForwardedFor.py
...lateItem/portal_components/test.erp5.testXForwardedFor.py
+1
-1
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testEditorField.py
...mplateItem/portal_components/test.erp5.testEditorField.py
+1
-1
bt5/erp5_csv_style/SkinTemplateItem/portal_skins/erp5_csv_style/Listbox_exportCsv.py
...lateItem/portal_skins/erp5_csv_style/Listbox_exportCsv.py
+2
-1
bt5/erp5_forum_tutorial/SkinTemplateItem/portal_skins/erp5_forum/ListBox_asStandardHTML.zpt
...teItem/portal_skins/erp5_forum/ListBox_asStandardHTML.zpt
+2
-2
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
...portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
+3
-2
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_renderMessage.py
...em/portal_skins/erp5_hal_json_style/Base_renderMessage.py
+2
-1
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+36
-33
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Workflow_statusModify.py
...portal_skins/erp5_hal_json_style/Workflow_statusModify.py
+2
-1
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
...plateItem/portal_components/test.erp5.testHalJsonStyle.py
+65
-59
bt5/erp5_mobile/SkinTemplateItem/portal_skins/erp5_mobile_ui/ListBox_asHTML.zpt
...mplateItem/portal_skins/erp5_mobile_ui/ListBox_asHTML.zpt
+3
-3
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/field_ods_macro.zpt
...plateItem/portal_skins/erp5_ods_style/field_ods_macro.zpt
+2
-2
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_line_ods_macro.zpt
...em/portal_skins/erp5_ods_style/listbox_line_ods_macro.zpt
+3
-3
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.zpt
...ateItem/portal_skins/erp5_ods_style/listbox_ods_macro.zpt
+1
-1
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/style_macros.zpt
...TemplateItem/portal_skins/erp5_ods_style/style_macros.zpt
+1
-1
bt5/erp5_odt_style/SkinTemplateItem/portal_skins/erp5_odt_style/listbox_odt_macro.zpt
...ateItem/portal_skins/erp5_odt_style/listbox_odt_macro.zpt
+2
-2
bt5/erp5_officejs_ui_test/SkinTemplateItem/portal_skins/erp5_officejs_ui_test/Zuite_CommonTemplateForOnlyOffice.zpt
...p5_officejs_ui_test/Zuite_CommonTemplateForOnlyOffice.zpt
+0
-28
bt5/erp5_sql_browser/SkinTemplateItem/portal_skins/erp5_sql_browser/ZMySQLDAConnection_getQueryResultAsJSON.py
...p5_sql_browser/ZMySQLDAConnection_getQueryResultAsJSON.py
+2
-1
bt5/erp5_tiosafe_core/DocumentTemplateItem/portal_components/document.erp5.WebServiceRequest.py
...Item/portal_components/document.erp5.WebServiceRequest.py
+4
-0
product/ERP5/bin/zopewsgi.py
product/ERP5/bin/zopewsgi.py
+2
-7
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_renderActionList.zpt
...ortal_skins/erp5_access_tab/ERP5Site_renderActionList.zpt
+1
-1
product/ERP5Form/www/ListBox_asHTML.zpt
product/ERP5Form/www/ListBox_asHTML.zpt
+2
-2
product/ERP5OOo/tests/utils.py
product/ERP5OOo/tests/utils.py
+7
-3
product/ERP5Type/Utils.py
product/ERP5Type/Utils.py
+4
-0
product/ERP5Type/__init__.py
product/ERP5Type/__init__.py
+1
-1
product/ERP5Type/dynamic/portal_type_class.py
product/ERP5Type/dynamic/portal_type_class.py
+2
-3
product/ERP5Type/patches/DateTimePatch.py
product/ERP5Type/patches/DateTimePatch.py
+11
-9
product/ERP5Type/patches/Restricted.py
product/ERP5Type/patches/Restricted.py
+3
-0
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+1
-1
product/Formulator/Widget.py
product/Formulator/Widget.py
+1
-2
product/Formulator/tests/testForm.py
product/Formulator/tests/testForm.py
+15
-6
product/Localizer/utils.py
product/Localizer/utils.py
+2
-1
product/PortalTransforms/transforms/python.py
product/PortalTransforms/transforms/python.py
+1
-1
product/PortalTransforms/transforms/text_pre_to_html.py
product/PortalTransforms/transforms/text_pre_to_html.py
+1
-1
product/PortalTransforms/transforms/text_to_html.py
product/PortalTransforms/transforms/text_to_html.py
+1
-1
product/ZSQLCatalog/ZSQLCatalog.py
product/ZSQLCatalog/ZSQLCatalog.py
+5
-2
product/Zelenium/zuite.py
product/Zelenium/zuite.py
+3
-1
No files found.
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.py
View file @
0cfb1586
"""Resets grouping reference on this line and all related lines.
"""Resets grouping reference on this line and all related lines.
This runs by default asynchronous
ly, but can be call with `async
=False` to
This runs by default asynchronous
hronously, but can be call with `asynchronous
=False` to
run synchronously and returns the list of ungrouped lines. With `async=True`,
run synchronously and returns the list of ungrouped lines. With `async
hronous
=True`,
the returned list is always empty.
the returned list is always empty.
"""
"""
...
@@ -13,7 +13,7 @@ if not context.getGroupingReference():
...
@@ -13,7 +13,7 @@ if not context.getGroupingReference():
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
resetGroupingReference
=
portal
.
ERP5Site_resetAccountingTransactionLineGroupingReference
resetGroupingReference
=
portal
.
ERP5Site_resetAccountingTransactionLineGroupingReference
if
async
:
if
async
hronous
:
resetGroupingReference
=
portal
.
portal_simulation
.
activate
(
resetGroupingReference
=
portal
.
portal_simulation
.
activate
(
activity
=
'SQLQueue'
,
activity
=
'SQLQueue'
,
after_tag
=
'accounting_grouping_reference'
after_tag
=
'accounting_grouping_reference'
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionLine_resetGroupingReference.xml
View file @
0cfb1586
...
@@ -50,7 +50,7 @@
...
@@ -50,7 +50,7 @@
</item>
</item>
<item>
<item>
<key>
<string>
_params
</string>
</key>
<key>
<string>
_params
</string>
</key>
<value>
<string>
async=True
</string>
</value>
<value>
<string>
async
hronous
=True
</string>
</value>
</item>
</item>
<item>
<item>
<key>
<string>
id
</string>
</key>
<key>
<string>
id
</string>
</key>
...
...
bt5/erp5_accounting/SkinTemplateItem/portal_skins/erp5_accounting/AccountingTransactionModule_setGroupingReference.py
View file @
0cfb1586
...
@@ -121,7 +121,7 @@ else:
...
@@ -121,7 +121,7 @@ else:
if
line
.
getGroupingReference
():
if
line
.
getGroupingReference
():
# Call AccountingTransactionLine_resetGroupingReference synchronously
# Call AccountingTransactionLine_resetGroupingReference synchronously
# to know the number of ungrouped lines.
# to know the number of ungrouped lines.
ungrouped_line_list
.
extend
(
line
.
AccountingTransactionLine_resetGroupingReference
(
async
=
False
))
ungrouped_line_list
.
extend
(
line
.
AccountingTransactionLine_resetGroupingReference
(
async
hronous
=
False
))
portal_status_message
=
Base_translateString
(
'${ungrouped_line_count} lines ungrouped.'
,
portal_status_message
=
Base_translateString
(
'${ungrouped_line_count} lines ungrouped.'
,
mapping
=
dict
(
ungrouped_line_count
=
len
(
ungrouped_line_list
)))
mapping
=
dict
(
ungrouped_line_count
=
len
(
ungrouped_line_list
)))
...
...
bt5/erp5_accounting/TestTemplateItem/portal_components/test.erp5.testAccounting.py
View file @
0cfb1586
...
@@ -3907,7 +3907,7 @@ class TestTransactions(AccountingTestCase):
...
@@ -3907,7 +3907,7 @@ class TestTransactions(AccountingTestCase):
# reset from the payment line, the invoice line from the same group will be
# reset from the payment line, the invoice line from the same group will be
# ungrouped
# ungrouped
payment_line
.
AccountingTransactionLine_resetGroupingReference
(
async
=
False
)
payment_line
.
AccountingTransactionLine_resetGroupingReference
(
async
hronous
=
False
)
self
.
assertFalse
(
payment_line
.
getGroupingReference
())
self
.
assertFalse
(
payment_line
.
getGroupingReference
())
self
.
assertFalse
(
payment_line
.
getGroupingDate
())
self
.
assertFalse
(
payment_line
.
getGroupingDate
())
self
.
assertFalse
(
invoice_line
.
getGroupingReference
())
self
.
assertFalse
(
invoice_line
.
getGroupingReference
())
...
...
bt5/erp5_big_file/DocumentTemplateItem/portal_components/document.erp5.BigFile.py
View file @
0cfb1586
...
@@ -27,6 +27,10 @@ from mimetools import choose_boundary
...
@@ -27,6 +27,10 @@ from mimetools import choose_boundary
from
Products.CMFCore.utils
import
_setCacheHeaders
,
_ViewEmulator
from
Products.CMFCore.utils
import
_setCacheHeaders
,
_ViewEmulator
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
re
import
re
import
six
if
six
.
PY3
:
long
=
int
# pylint:disable=redefined-builtin
class
BigFile
(
File
):
class
BigFile
(
File
):
"""
"""
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
View file @
0cfb1586
...
@@ -33,6 +33,7 @@ from random import randint
...
@@ -33,6 +33,7 @@ from random import randint
import
sys
import
sys
import
threading
import
threading
import
traceback
import
traceback
import
unittest
import
six
import
six
from
AccessControl
import
getSecurityManager
from
AccessControl
import
getSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
...
@@ -48,6 +49,9 @@ from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery, SimpleQuery
...
@@ -48,6 +49,9 @@ from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery, SimpleQuery
from
Testing
import
ZopeTestCase
from
Testing
import
ZopeTestCase
from
zLOG
import
LOG
from
zLOG
import
LOG
if
six
.
PY3
:
long
=
int
# pylint:disable=redefined-builtin
def
format_stack
(
thread
=
None
):
def
format_stack
(
thread
=
None
):
frame_dict
=
sys
.
_current_frames
()
frame_dict
=
sys
.
_current_frames
()
if
thread
is
not
None
:
if
thread
is
not
None
:
...
@@ -588,7 +592,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
...
@@ -588,7 +592,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
uid_dict
=
{}
uid_dict
=
{}
for
_
in
xrange
(
UID_BUFFER_SIZE
*
3
):
for
_
in
xrange
(
UID_BUFFER_SIZE
*
3
):
uid
=
portal_catalog
.
newUid
()
uid
=
portal_catalog
.
newUid
()
self
.
assert
True
(
isinstance
(
uid
,
long
)
)
self
.
assert
IsInstance
(
uid
,
long
)
self
.
assertNotIn
(
uid
,
uid_dict
)
self
.
assertNotIn
(
uid
,
uid_dict
)
uid_dict
[
uid
]
=
None
uid_dict
[
uid
]
=
None
...
@@ -1647,6 +1651,9 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
...
@@ -1647,6 +1651,9 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
portal_type
=
'Organisation'
,
**
catalog_kw
)])
portal_type
=
'Organisation'
,
**
catalog_kw
)])
def
test_54_FixIntUid
(
self
):
def
test_54_FixIntUid
(
self
):
if
six
.
PY3
:
return
unittest
.
skipTest
(
"Python3 does not have different types for int and long"
)
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
module
=
portal
.
getDefaultModule
(
'Organisation'
)
module
=
portal
.
getDefaultModule
(
'Organisation'
)
...
...
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testXForwardedFor.py
View file @
0cfb1586
...
@@ -34,7 +34,7 @@ import unittest
...
@@ -34,7 +34,7 @@ import unittest
def
get_Z2_log_last_line
():
def
get_Z2_log_last_line
():
z2_log_path
=
os
.
path
.
join
(
log_directory
,
'Z2.log'
)
z2_log_path
=
os
.
path
.
join
(
log_directory
,
'Z2.log'
)
f
=
open
(
z2_log_path
,
'r
b
'
)
f
=
open
(
z2_log_path
,
'r'
)
try
:
try
:
f
.
seek
(
-
256
,
os
.
SEEK_END
)
# Assumes last line is not longer than 256 chars (it should be about 130)
f
.
seek
(
-
256
,
os
.
SEEK_END
)
# Assumes last line is not longer than 256 chars (it should be about 130)
except
IOError
:
# too short
except
IOError
:
# too short
...
...
bt5/erp5_crm/TestTemplateItem/portal_components/test.erp5.testEditorField.py
View file @
0cfb1586
...
@@ -34,7 +34,7 @@ import unittest
...
@@ -34,7 +34,7 @@ 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
DocumentTemplate.
DT_Util
import
html_quote
from
DocumentTemplate.
html_quote
import
html_quote
class
TestEditorField
(
ERP5TypeTestCase
,
ZopeTestCase
.
Functional
):
class
TestEditorField
(
ERP5TypeTestCase
,
ZopeTestCase
.
Functional
):
"""
"""
...
...
bt5/erp5_csv_style/SkinTemplateItem/portal_skins/erp5_csv_style/Listbox_exportCsv.py
View file @
0cfb1586
# export_only : allow to disable the uid column and the id of columns
# export_only : allow to disable the uid column and the id of columns
import
six
result
=
''
result
=
''
request
=
context
.
REQUEST
request
=
context
.
REQUEST
...
@@ -9,7 +10,7 @@ listboxline_list = context.get_value('default', render_format='list', REQUEST=re
...
@@ -9,7 +10,7 @@ listboxline_list = context.get_value('default', render_format='list', REQUEST=re
def
encode
(
value
):
def
encode
(
value
):
if
isinstance
(
value
,
bool
):
if
isinstance
(
value
,
bool
):
return
'"%s"'
%
value
return
'"%s"'
%
value
if
isinstance
(
value
,
(
int
,
long
,
float
)):
if
isinstance
(
value
,
six
.
integer_types
+
(
float
,
)):
return
str
(
value
)
return
str
(
value
)
else
:
else
:
if
isinstance
(
value
,
str
):
if
isinstance
(
value
,
str
):
...
...
bt5/erp5_forum_tutorial/SkinTemplateItem/portal_skins/erp5_forum/ListBox_asStandardHTML.zpt
View file @
0cfb1586
...
@@ -238,7 +238,7 @@
...
@@ -238,7 +238,7 @@
error python: value[2]"
error python: value[2]"
class="DataA" align="left"
class="DataA" align="left"
tal:attributes="class python: error and (css + 'Error') or css;
tal:attributes="class python: error and (css + 'Error') or css;
align python: isinstance(original_value,
(float, int, long
)) and 'right' or 'left'">
align python: isinstance(original_value,
modules['six'].integer_types + (float,
)) and 'right' or 'left'">
<input tal:condition="not: repeat/value/index"
<input tal:condition="not: repeat/value/index"
type="hidden" value="1" name="listbox_uid:list"
type="hidden" value="1" name="listbox_uid:list"
tal:attributes="value python: line.getUid() or '';
tal:attributes="value python: line.getUid() or '';
...
@@ -268,7 +268,7 @@
...
@@ -268,7 +268,7 @@
<tal:block tal:repeat="value here/getStatValueList">
<tal:block tal:repeat="value here/getStatValueList">
<td class="Data" align="left"
<td class="Data" align="left"
tal:define="original_value python: value[0]; processed_value python: value[1]"
tal:define="original_value python: value[0]; processed_value python: value[1]"
tal:attributes="align python: isinstance(original_value,
(float, int, long
)) and 'right' or 'left'"
tal:attributes="align python: isinstance(original_value,
modules['six'].integer_types + (float,
)) and 'right' or 'left'"
tal:content="structure processed_value" />
tal:content="structure processed_value" />
</tal:block>
</tal:block>
</tr>
</tr>
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_callDialogMethod.py
View file @
0cfb1586
...
@@ -15,16 +15,17 @@ There are runtime values hidden in every dialog form (injected by getHateoas Scr
...
@@ -15,16 +15,17 @@ There are runtime values hidden in every dialog form (injected by getHateoas Scr
from
erp5.component.module.Log
import
log
,
WARNING
from
erp5.component.module.Log
import
log
,
WARNING
from
Products.Formulator.Errors
import
FormValidationError
from
Products.Formulator.Errors
import
FormValidationError
import
json
import
json
import
six
# http://stackoverflow.com/a/13105359
# http://stackoverflow.com/a/13105359
def
byteify
(
value
):
def
byteify
(
value
):
if
isinstance
(
value
,
dict
):
if
isinstance
(
value
,
dict
):
return
{
byteify
(
key
):
byteify
(
value
)
for
key
,
value
in
value
.
iteritems
(
)}
return
{
byteify
(
key
):
byteify
(
value
)
for
key
,
value
in
six
.
iteritems
(
value
)}
elif
isinstance
(
value
,
list
):
elif
isinstance
(
value
,
list
):
return
[
byteify
(
element
)
for
element
in
value
]
return
[
byteify
(
element
)
for
element
in
value
]
elif
isinstance
(
value
,
tuple
):
elif
isinstance
(
value
,
tuple
):
return
tuple
(
byteify
(
element
)
for
element
in
value
)
return
tuple
(
byteify
(
element
)
for
element
in
value
)
elif
isinstance
(
value
,
unicod
e
):
elif
six
.
PY2
and
isinstance
(
value
,
six
.
text_typ
e
):
return
value
.
encode
(
'utf-8'
)
return
value
.
encode
(
'utf-8'
)
else
:
else
:
return
value
return
value
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Base_renderMessage.py
View file @
0cfb1586
...
@@ -6,8 +6,9 @@ Return JSON with message to be displayed and set according HTTP STATUS for messa
...
@@ -6,8 +6,9 @@ Return JSON with message to be displayed and set according HTTP STATUS for messa
"""
"""
import
json
import
json
from
erp5.component.module.Log
import
WARNING
,
ERROR
from
erp5.component.module.Log
import
WARNING
,
ERROR
import
six
if
isinstance
(
level
,
(
str
,
unicod
e
)):
if
isinstance
(
level
,
(
str
,
six
.
text_typ
e
)):
if
level
.
lower
()
==
"error"
:
if
level
.
lower
()
==
"error"
:
response_code
=
500
response_code
=
500
elif
level
.
lower
().
startswith
(
"warn"
):
elif
level
.
lower
().
startswith
(
"warn"
):
...
...
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
View file @
0cfb1586
This diff is collapsed.
Click to expand it.
bt5/erp5_hal_json_style/SkinTemplateItem/portal_skins/erp5_hal_json_style/Workflow_statusModify.py
View file @
0cfb1586
...
@@ -3,6 +3,7 @@ from Products.Formulator.Errors import FormValidationError
...
@@ -3,6 +3,7 @@ from Products.Formulator.Errors import FormValidationError
from
Products.ERP5Type.Core.Workflow
import
ValidationFailed
from
Products.ERP5Type.Core.Workflow
import
ValidationFailed
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Message
import
translateString
from
erp5.component.module.Log
import
WARNING
from
erp5.component.module.Log
import
WARNING
import
six
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
request
=
REQUEST
or
context
.
REQUEST
request
=
REQUEST
or
context
.
REQUEST
...
@@ -43,7 +44,7 @@ for f in form.get_fields():
...
@@ -43,7 +44,7 @@ for f in form.get_fields():
listbox
=
request
.
get
(
'listbox'
)
# XXX: hardcoded field name
listbox
=
request
.
get
(
'listbox'
)
# XXX: hardcoded field name
if
listbox
is
not
None
:
if
listbox
is
not
None
:
listbox_line_list
=
[]
listbox_line_list
=
[]
for
key
,
value
in
sorted
(
listbox
.
iteritems
(
)):
for
key
,
value
in
sorted
(
six
.
iteritems
(
listbox
)):
value
[
'listbox_key'
]
=
key
value
[
'listbox_key'
]
=
key
listbox_line_list
.
append
(
value
)
listbox_line_list
.
append
(
value
)
doaction_param_list
[
'listbox'
]
=
tuple
(
listbox_line_list
)
doaction_param_list
[
'listbox'
]
=
tuple
(
listbox_line_list
)
...
...
bt5/erp5_hal_json_style/TestTemplateItem/portal_components/test.erp5.testHalJsonStyle.py
View file @
0cfb1586
This diff is collapsed.
Click to expand it.
bt5/erp5_mobile/SkinTemplateItem/portal_skins/erp5_mobile_ui/ListBox_asHTML.zpt
View file @
0cfb1586
...
@@ -273,9 +273,9 @@
...
@@ -273,9 +273,9 @@
</span>
</span>
<span style="color: green;"> : </span>
<span style="color: green;"> : </span>
<tal:block tal:condition="show_search_line">
<tal:block tal:condition="show_search_line">
<span tal:condition="python: isinstance(original_value,
(float, int, long
))"
<span tal:condition="python: isinstance(original_value,
modules['six'].integer_types + (float,
))"
id="data_short" tal:content="python: original_value" />
id="data_short" tal:content="python: original_value" />
<span tal:condition="python: not isinstance(original_value,
(float, int, long
))"
<span tal:condition="python: not isinstance(original_value,
modules['six'].integer_types + (float,
))"
id="data_short" tal:content="data_short" />
id="data_short" tal:content="data_short" />
</tal:block>
</tal:block>
<tal:block tal:condition="not:show_search_line">
<tal:block tal:condition="not:show_search_line">
...
@@ -302,7 +302,7 @@
...
@@ -302,7 +302,7 @@
<tal:block tal:condition="python: original_value is not None">
<tal:block tal:condition="python: original_value is not None">
<span align="right"
<span align="right"
tal:define="original_value python: valueZ[0]; processed_value python: valueZ[1]"
tal:define="original_value python: valueZ[0]; processed_value python: valueZ[1]"
tal:attributes="align python: isinstance(original_value,
(float, int, long
)) and 'right' or 'left'"
tal:attributes="align python: isinstance(original_value,
modules['six'].integer_types + (float,
)) and 'right' or 'left'"
tal:content="structure processed_value" />
tal:content="structure processed_value" />
</tal:block>
</tal:block>
</div>
</div>
...
...
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/field_ods_macro.zpt
View file @
0cfb1586
...
@@ -100,7 +100,7 @@
...
@@ -100,7 +100,7 @@
-->
-->
<tal:block metal:define-macro="cell_value">
<tal:block metal:define-macro="cell_value">
<tal:block tal:define="is_list python:same_type(value, []) or same_type(value, ());
<tal:block tal:define="is_list python:same_type(value, []) or same_type(value, ());
is_float python: isinstance(value,
(int, long, float
));">
is_float python: isinstance(value,
modules['six'].integer_types + (float,
));">
<tal:block tal:condition="python: is_list">
<tal:block tal:condition="python: is_list">
...
@@ -116,7 +116,7 @@
...
@@ -116,7 +116,7 @@
</tal:block>
</tal:block>
<tal:block tal:condition="python: value is not None and not is_list">
<tal:block tal:condition="python: value is not None and not is_list">
<tal:block tal:condition="is_float">
<tal:block tal:condition="is_float">
<tal:block tal:condition="python: isinstance(value,
(int, long)
)">
<tal:block tal:condition="python: isinstance(value,
modules['six'].integer_types
)">
<table:table-cell tal:define="field python: editable_fields.get(column_id, None)"
<table:table-cell tal:define="field python: editable_fields.get(column_id, None)"
tal:attributes="office:value value;
tal:attributes="office:value value;
table:style-name string:${style_prefix}figure"
table:style-name string:${style_prefix}figure"
...
...
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_line_ods_macro.zpt
View file @
0cfb1586
...
@@ -18,7 +18,7 @@
...
@@ -18,7 +18,7 @@
<tal:block tal:condition="not:listboxline/isTitleLine">
<tal:block tal:condition="not:listboxline/isTitleLine">
<table:table-row tal:attributes="table:style-name python: listboxline.isStatLine() and 'listbox_stat_row' or 'listbox_data_row'">
<table:table-row tal:attributes="table:style-name python: listboxline.isStatLine() and 'listbox_stat_row' or 'listbox_data_row'">
<tal:block tal:condition="python: listboxline.isDataLine()">
<tal:block tal:condition="python: listboxline.isDataLine()">
<tal:block tal:repeat="empty_index python:
x
range(0, max_section_depth)">
<tal:block tal:repeat="empty_index python: range(0, max_section_depth)">
<table:table-cell table:style-name='report-column-title'
<table:table-cell table:style-name='report-column-title'
table:number-columns-spanned='1'
table:number-columns-spanned='1'
office:value-type='string'>
office:value-type='string'>
...
@@ -36,7 +36,7 @@
...
@@ -36,7 +36,7 @@
</tal:block>
</tal:block>
<tal:block tal:condition="python: listboxline.isStatLine() or listboxline.isSummaryLine()">
<tal:block tal:condition="python: listboxline.isStatLine() or listboxline.isSummaryLine()">
<tal:block tal:repeat="empty_index python:
x
range(0, listboxline.getSectionDepth())">
<tal:block tal:repeat="empty_index python: range(0, listboxline.getSectionDepth())">
<table:table-cell table:style-name='report-column-title'
<table:table-cell table:style-name='report-column-title'
table:number-columns-spanned='1'
table:number-columns-spanned='1'
office:value-type='string'>
office:value-type='string'>
...
@@ -48,7 +48,7 @@
...
@@ -48,7 +48,7 @@
office:value-type='string'>
office:value-type='string'>
<text:p tal:content="listboxline/getSectionName"/>
<text:p tal:content="listboxline/getSectionName"/>
</table:table-cell>
</table:table-cell>
<tal:block tal:repeat="empty_index python:
x
range(listboxline.getSectionDepth()+1, max_section_depth)">
<tal:block tal:repeat="empty_index python: range(listboxline.getSectionDepth()+1, max_section_depth)">
<table:table-cell table:style-name='report-column-title'
<table:table-cell table:style-name='report-column-title'
table:number-columns-spanned='1'
table:number-columns-spanned='1'
office:value-type='string'>
office:value-type='string'>
...
...
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/listbox_ods_macro.zpt
View file @
0cfb1586
...
@@ -70,7 +70,7 @@
...
@@ -70,7 +70,7 @@
<tal:block tal:condition="not:display_header">
<tal:block tal:condition="not:display_header">
<table:table-row table:style-name='listbox_header_row'>
<table:table-row table:style-name='listbox_header_row'>
<tal:block tal:repeat="empty_index python:
x
range(0, max_section_depth)">
<tal:block tal:repeat="empty_index python: range(0, max_section_depth)">
<table:table-cell table:style-name='report-column-title'
<table:table-cell table:style-name='report-column-title'
table:number-columns-spanned='1'
table:number-columns-spanned='1'
office:value-type='string'>
office:value-type='string'>
...
...
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/style_macros.zpt
View file @
0cfb1586
...
@@ -110,7 +110,7 @@
...
@@ -110,7 +110,7 @@
<style:style style:name="date_with_time" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="date_style">
<style:style style:name="date_with_time" style:family="table-cell" style:parent-style-name="Default" style:data-style-name="date_style">
<style:table-cell-properties style:vertical-align='middle' style:repeat-content='false' style:text-align-source='fix' fo:border-right='0.002cm solid #000000' />
<style:table-cell-properties style:vertical-align='middle' style:repeat-content='false' style:text-align-source='fix' fo:border-right='0.002cm solid #000000' />
</style:style>
</style:style>
<tal:block tal:repeat="precision python:
x
range(0,here.Base_getODSMaximumSupportedPrecision())">
<tal:block tal:repeat="precision python: range(0,here.Base_getODSMaximumSupportedPrecision())">
<tal:block tal:define="figure_data_precision_style_name string:figure_data_precision_${precision}">
<tal:block tal:define="figure_data_precision_style_name string:figure_data_precision_${precision}">
<number:number-style style:name="figure_data_precision_X" tal:attributes="style:name figure_data_precision_style_name">
<number:number-style style:name="figure_data_precision_X" tal:attributes="style:name figure_data_precision_style_name">
<number:number number:decimal-places="X" number:min-integer-digits="1" number:grouping="true" tal:attributes="number:decimal-places precision"/>
<number:number number:decimal-places="X" number:min-integer-digits="1" number:grouping="true" tal:attributes="number:decimal-places precision"/>
...
...
bt5/erp5_odt_style/SkinTemplateItem/portal_skins/erp5_odt_style/listbox_odt_macro.zpt
View file @
0cfb1586
...
@@ -118,11 +118,11 @@
...
@@ -118,11 +118,11 @@
column_id python: column_item[0]">
column_id python: column_item[0]">
<tal:block tal:condition="python: column_property is not None">
<tal:block tal:condition="python: column_property is not None">
<table:table-cell table:style-name='listbox-table.A1' office:value-type='string'>
<table:table-cell table:style-name='listbox-table.A1' office:value-type='string'>
<tal:block tal:condition="python:
untranslatable_columns_dict.has_key(column_id)
">
<tal:block tal:condition="python:
column_id in untranslatable_columns_dict
">
<text:p text:style-name='listbox-header'
<text:p text:style-name='listbox-header'
tal:content="python: column_property"/>
tal:content="python: column_property"/>
</tal:block>
</tal:block>
<tal:block tal:condition="python:
not(untranslatable_columns_dict.has_key(column_id))
">
<tal:block tal:condition="python:
column_id not in untranslatable_columns_dict
">
<text:p text:style-name='listbox-header'
<text:p text:style-name='listbox-header'
tal:content="python: here.Base_translateString(column_property)"/>
tal:content="python: here.Base_translateString(column_property)"/>
</tal:block>
</tal:block>
...
...
bt5/erp5_officejs_ui_test/SkinTemplateItem/portal_skins/erp5_officejs_ui_test/Zuite_CommonTemplateForOnlyOffice.zpt
View file @
0cfb1586
...
@@ -139,34 +139,6 @@
...
@@ -139,34 +139,6 @@
<td>2000</td>
<td>2000</td>
<td></td>
<td></td>
</tr>
</tr>
<!-- Second loader while updating the page -->
<!--
<tr>
<td>waitForElementPresent</td>
<td>//h1[@class="ui-title"]//a[contains(@class, "ui-icon-spinner")]</td>
<td></td>
</tr>
<!-- Save Button is disabled -->
<!--
<tr>
<td>verifyElementPresent</td>
<td>//button[@data-i18n="Save"][contains(@class, "ui-disabled")]</td>
<td></td>
</tr>
<tr>
<td>waitForElementNotPresent</td>
<td>//h1[@class="ui-title"]//a[contains(@class, "ui-icon-spinner")]</td>
<td></td>
</tr>
<tr>
<td>verifyElementPresent</td>
<td>//button[@data-i18n="Save"][contains(@class, "ui-icon-check")]</td>
<td></td>
</tr>
<tr>
<td colspan="3"><p></p></td>
</tr>
<-->
</tal:block>
</tal:block>
<tal:block metal:define-macro="click_to_align_center">
<tal:block metal:define-macro="click_to_align_center">
<tr>
<tr>
...
...
bt5/erp5_sql_browser/SkinTemplateItem/portal_skins/erp5_sql_browser/ZMySQLDAConnection_getQueryResultAsJSON.py
View file @
0cfb1586
...
@@ -3,6 +3,7 @@ import datetime
...
@@ -3,6 +3,7 @@ import datetime
import
time
import
time
import
json
import
json
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
six
response
=
container
.
REQUEST
.
RESPONSE
response
=
container
.
REQUEST
.
RESPONSE
start
=
time
.
time
()
start
=
time
.
time
()
...
@@ -32,7 +33,7 @@ for line in results.tuples():
...
@@ -32,7 +33,7 @@ for line in results.tuples():
v
=
v
.
isoformat
()
v
=
v
.
isoformat
()
elif
isinstance
(
v
,
Decimal
):
elif
isinstance
(
v
,
Decimal
):
v
=
float
(
v
)
v
=
float
(
v
)
elif
isinstance
(
v
,
(
long
,
int
,
float
))
and
not
isSafeInteger
(
v
):
elif
isinstance
(
v
,
six
.
integer_types
+
(
float
,
))
and
not
isSafeInteger
(
v
):
# if numbers are too large to be handled by javascript, we simply return them
# if numbers are too large to be handled by javascript, we simply return them
# as string, this will still not work for pivot table, but at least the spreadsheet
# as string, this will still not work for pivot table, but at least the spreadsheet
# will not display truncated values.
# will not display truncated values.
...
...
bt5/erp5_tiosafe_core/DocumentTemplateItem/portal_components/document.erp5.WebServiceRequest.py
View file @
0cfb1586
...
@@ -40,6 +40,10 @@ from lxml import etree
...
@@ -40,6 +40,10 @@ from lxml import etree
from
zLOG
import
LOG
,
ERROR
,
INFO
from
zLOG
import
LOG
,
ERROR
,
INFO
from
erp5.component.tool.WebServiceTool
import
ConnectionError
from
erp5.component.tool.WebServiceTool
import
ConnectionError
from
Products.ERP5Type.Cache
import
CachingMethod
from
Products.ERP5Type.Cache
import
CachingMethod
import
six
if
six
.
PY3
:
long
=
int
ID_SEPARATOR
=
"-"
ID_SEPARATOR
=
"-"
...
...
product/ERP5/bin/zopewsgi.py
View file @
0cfb1586
...
@@ -11,11 +11,7 @@ import socket
...
@@ -11,11 +11,7 @@ import socket
import
sys
import
sys
from
tempfile
import
TemporaryFile
from
tempfile
import
TemporaryFile
import
time
import
time
from
six.moves.urllib.parse
import
quote
from
six.moves.urllib.parse
import
quote
,
urlsplit
try
:
from
urllib
import
splitport
except
ImportError
:
# six.PY3
from
urllib.parse
import
splitport
from
waitress.server
import
create_server
from
waitress.server
import
create_server
import
ZConfig
import
ZConfig
...
@@ -268,8 +264,7 @@ def runwsgi():
...
@@ -268,8 +264,7 @@ def runwsgi():
new_limit
=
(
cur_limit
[
1
],
cur_limit
[
1
])
new_limit
=
(
cur_limit
[
1
],
cur_limit
[
1
])
resource
.
setrlimit
(
resource
.
RLIMIT_NOFILE
,
new_limit
)
resource
.
setrlimit
(
resource
.
RLIMIT_NOFILE
,
new_limit
)
ip
,
port
=
splitport
(
args
.
address
)
port
=
urlsplit
(
'//'
+
args
.
address
).
port
port
=
int
(
port
)
createServer
(
createServer
(
app_wrapper
(
app_wrapper
(
large_file_threshold
=
args
.
large_file_threshold
,
large_file_threshold
=
args
.
large_file_threshold
,
...
...
product/ERP5/bootstrap/erp5_xhtml_style/SkinTemplateItem/portal_skins/erp5_access_tab/ERP5Site_renderActionList.zpt
View file @
0cfb1586
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
cell_number python: len(module_category_list);
cell_number python: len(module_category_list);
row_number python: (cell_number/max_per_line+1)"
row_number python: (cell_number/max_per_line+1)"
class="access_tab_table">
class="access_tab_table">
<tr tal:repeat="row python:
x
range(row_number)">
<tr tal:repeat="row python: range(row_number)">
<tal:block tal:repeat="module_category python: module_category_list[(row*max_per_line):((row+1)*max_per_line)]">
<tal:block tal:repeat="module_category python: module_category_list[(row*max_per_line):((row+1)*max_per_line)]">
<td>
<td>
<div style="width:25%; min-width:150px; float:left;"
<div style="width:25%; min-width:150px; float:left;"
...
...
product/ERP5Form/www/ListBox_asHTML.zpt
View file @
0cfb1586
...
@@ -330,7 +330,7 @@
...
@@ -330,7 +330,7 @@
error python: value[2]"
error python: value[2]"
class="DataA" align="left"
class="DataA" align="left"
tal:attributes="class python: error and (css + 'Error') or css;
tal:attributes="class python: error and (css + 'Error') or css;
align python: isinstance(original_value,
(float, int, long
)) and 'right' or 'left'">
align python: isinstance(original_value,
modules['six'].integer_types + (float,
)) and 'right' or 'left'">
<input tal:condition="not: repeat/value/index"
<input tal:condition="not: repeat/value/index"
type="hidden" value="1" name="listbox_uid:list"
type="hidden" value="1" name="listbox_uid:list"
tal:attributes="value python: line.getUid() or '';
tal:attributes="value python: line.getUid() or '';
...
@@ -348,7 +348,7 @@
...
@@ -348,7 +348,7 @@
<tal:block tal:repeat="value here/getStatValueList">
<tal:block tal:repeat="value here/getStatValueList">
<td class="Data" align="left"
<td class="Data" align="left"
tal:define="original_value python: value[0]; processed_value python: value[1]"
tal:define="original_value python: value[0]; processed_value python: value[1]"
tal:attributes="align python: isinstance(original_value,
(float, int, long
)) and 'right' or 'left'"
tal:attributes="align python: isinstance(original_value,
modules['six'].integer_types + (float,
)) and 'right' or 'left'"
tal:content="structure processed_value" />
tal:content="structure processed_value" />
</tal:block>
</tal:block>
</tr>
</tr>
...
...
product/ERP5OOo/tests/utils.py
View file @
0cfb1586
...
@@ -38,7 +38,7 @@ import os
...
@@ -38,7 +38,7 @@ import os
import
sys
import
sys
import
tempfile
import
tempfile
import
zipfile
import
zipfile
import
popen2
import
subprocess
from
six.moves
import
urllib
from
six.moves
import
urllib
from
six.moves
import
cStringIO
as
StringIO
from
six.moves
import
cStringIO
as
StringIO
...
@@ -93,8 +93,12 @@ elif odfpy:
...
@@ -93,8 +93,12 @@ elif odfpy:
fd
,
file_name
=
tempfile
.
mkstemp
()
fd
,
file_name
=
tempfile
.
mkstemp
()
os
.
write
(
fd
,
odf_file_content
)
os
.
write
(
fd
,
odf_file_content
)
os
.
close
(
fd
)
os
.
close
(
fd
)
stdout
,
stdin
=
popen2
.
popen4
(
'odflint %s'
%
file_name
)
process
=
subprocess
.
Popen
(
stdin
.
close
()
[
'odflint'
,
file_name
],
stdout
=
subprocess
.
PIPE
,
stderr
=
subprocess
.
STDOUT
,
)
stdout
,
_
=
process
.
communicate
()
error_list
=
''
error_list
=
''
for
line
in
stdout
:
for
line
in
stdout
:
if
line
.
startswith
(
'Error: '
):
if
line
.
startswith
(
'Error: '
):
...
...
product/ERP5Type/Utils.py
View file @
0cfb1586
...
@@ -567,6 +567,8 @@ def checkPythonSourceCode(source_code_str, portal_type=None):
...
@@ -567,6 +567,8 @@ def checkPythonSourceCode(source_code_str, portal_type=None):
if
str
is
bytes
:
if
str
is
bytes
:
bytes2str
=
str2bytes
=
lambda
s
:
s
bytes2str
=
str2bytes
=
lambda
s
:
s
def
str2unicode
(
s
):
return
s
.
decode
(
'utf-8'
)
def
unicode2str
(
s
):
def
unicode2str
(
s
):
return
s
.
encode
(
'utf-8'
)
return
s
.
encode
(
'utf-8'
)
else
:
else
:
...
@@ -574,6 +576,8 @@ else:
...
@@ -574,6 +576,8 @@ else:
return
s
.
decode
()
return
s
.
decode
()
def
str2bytes
(
s
):
def
str2bytes
(
s
):
return
s
.
encode
()
return
s
.
encode
()
def
str2unicode
(
s
):
return
s
def
unicode2str
(
s
):
def
unicode2str
(
s
):
return
s
return
s
...
...
product/ERP5Type/__init__.py
View file @
0cfb1586
...
@@ -189,7 +189,7 @@ ModuleSecurityInfo('Products.ERP5Type.Utils').declarePublic(
...
@@ -189,7 +189,7 @@ ModuleSecurityInfo('Products.ERP5Type.Utils').declarePublic(
'int2letter'
,
'getMessageIdWithContext'
,
'getTranslationStringWithContext'
,
'int2letter'
,
'getMessageIdWithContext'
,
'getTranslationStringWithContext'
,
'Email_parseAddressHeader'
,
'guessEncodingFromText'
,
'Email_parseAddressHeader'
,
'guessEncodingFromText'
,
'isValidTALESExpression'
,
'isValidTALESExpression'
,
'ensure_list'
,
'bytes2str'
,
'str2bytes'
,
'unicode2str'
,
'ensure_list'
,
'bytes2str'
,
'str2bytes'
,
'
str2unicode'
,
'
unicode2str'
,
)
)
allow_module
(
'Products.ERP5Type.Message'
)
allow_module
(
'Products.ERP5Type.Message'
)
...
...
product/ERP5Type/dynamic/portal_type_class.py
View file @
0cfb1586
...
@@ -61,8 +61,7 @@ ACQUIRE_LOCAL_ROLE_GETTER_DICT = {
...
@@ -61,8 +61,7 @@ ACQUIRE_LOCAL_ROLE_GETTER_DICT = {
for
acquire_local_role
in
(
False
,
True
)
for
acquire_local_role
in
(
False
,
True
)
}
}
if
six
.
PY3
:
StandardError
=
Exception
def
_importFilesystemClass
(
classpath
):
def
_importFilesystemClass
(
classpath
):
try
:
try
:
module_path
,
class_name
=
classpath
.
rsplit
(
'.'
,
1
)
module_path
,
class_name
=
classpath
.
rsplit
(
'.'
,
1
)
...
@@ -74,7 +73,7 @@ def _importFilesystemClass(classpath):
...
@@ -74,7 +73,7 @@ def _importFilesystemClass(classpath):
InitializeClass
(
klass
)
InitializeClass
(
klass
)
return
klass
return
klass
except
StandardError
:
except
Exception
as
e
:
raise
ImportError
(
'Could not import document class '
+
classpath
)
raise
ImportError
(
'Could not import document class '
+
classpath
)
def
_importComponentClass
(
component_package
,
name
):
def
_importComponentClass
(
component_package
,
name
):
...
...
product/ERP5Type/patches/DateTimePatch.py
View file @
0cfb1586
...
@@ -32,6 +32,7 @@ import math
...
@@ -32,6 +32,7 @@ import math
from
DateTime.DateTime
import
_calcSD
,
_calcDependentSecond
,
_calcYMDHMS
,
\
from
DateTime.DateTime
import
_calcSD
,
_calcDependentSecond
,
_calcYMDHMS
,
\
getDefaultDateFormat
,
_correctYear
,
_calcHMS
,
_calcDependentSecond2
,
DateTimeError
,
\
getDefaultDateFormat
,
_correctYear
,
_calcHMS
,
_calcDependentSecond2
,
DateTimeError
,
\
SyntaxError
,
DateError
,
TimeError
,
localtime
,
time
SyntaxError
,
DateError
,
TimeError
,
localtime
,
time
from
Products.ERP5Type
import
IS_ZOPE2
STATE_KEY
=
'str'
STATE_KEY
=
'str'
...
@@ -297,12 +298,13 @@ DateTimeKlass.SyntaxError = SyntaxError
...
@@ -297,12 +298,13 @@ DateTimeKlass.SyntaxError = SyntaxError
DateTimeKlass
.
DateError
=
DateError
DateTimeKlass
.
DateError
=
DateError
DateTimeKlass
.
TimeError
=
TimeError
DateTimeKlass
.
TimeError
=
TimeError
# BBB undo patch from DateTime 2.12 , which patches
if
IS_ZOPE2
:
# BBB Zope2
# copy_reg._reconstructor with a function that appears as
# BBB undo patch from DateTime 2.12 , which patches
# `DateTime.DateTime._dt_reconstructor` in pickles.
# copy_reg._reconstructor with a function that appears as
# See https://github.com/zopefoundation/DateTime/blob/2.12.8/src/DateTime/DateTime.py#L1863-L1874
# `DateTime.DateTime._dt_reconstructor` in pickles.
# This patch is no longer needed once we are using DateTime >= 3 so
# See https://github.com/zopefoundation/DateTime/blob/2.12.8/src/DateTime/DateTime.py#L1863-L1874
# it is not needed on python3 (copy_reg does not exist on python3)
# This patch is no longer needed once we are using DateTime >= 3 so
import
copy_reg
# it is not needed on python3 (copy_reg does not exist on python3)
copy_reg
.
_reconstructor
.
__module__
=
'copy_reg'
import
copy_reg
copy_reg
.
_reconstructor
.
__name__
=
'_reconstructor'
copy_reg
.
_reconstructor
.
__module__
=
'copy_reg'
copy_reg
.
_reconstructor
.
__name__
=
'_reconstructor'
product/ERP5Type/patches/Restricted.py
View file @
0cfb1586
...
@@ -80,6 +80,9 @@ add_builtins(Ellipsis=Ellipsis, NotImplemented=NotImplemented,
...
@@ -80,6 +80,9 @@ add_builtins(Ellipsis=Ellipsis, NotImplemented=NotImplemented,
dict
=
dict
,
list
=
list
)
dict
=
dict
,
list
=
list
)
if
"set"
not
in
safe_builtins
:
# BBB
if
"set"
not
in
safe_builtins
:
# BBB
add_builtins
(
set
=
set
,
frozenset
=
frozenset
,
slice
=
slice
)
add_builtins
(
set
=
set
,
frozenset
=
frozenset
,
slice
=
slice
)
if
"bytes"
not
in
safe_builtins
:
# BBB Zope2
assert
six
.
PY2
add_builtins
(
bytes
=
str
)
add_builtins
(
bin
=
bin
,
classmethod
=
classmethod
,
format
=
format
,
object
=
object
,
add_builtins
(
bin
=
bin
,
classmethod
=
classmethod
,
format
=
format
,
object
=
object
,
property
=
property
,
staticmethod
=
staticmethod
,
property
=
property
,
staticmethod
=
staticmethod
,
...
...
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
0cfb1586
...
@@ -1356,7 +1356,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
...
@@ -1356,7 +1356,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
try
:
try
:
portal_activities
=
self
.
portal
.
portal_activities
portal_activities
=
self
.
portal
.
portal_activities
message_list
=
portal_activities
.
getMessageList
()
message_list
=
portal_activities
.
getMessageList
()
except
StandardError
:
# AttributeError, TransactionFailedError ...
except
Exception
:
# AttributeError, TransactionFailedError ...
pass
pass
else
:
else
:
for
m
in
message_list
:
for
m
in
message_list
:
...
...
product/Formulator/Widget.py
View file @
0cfb1586
...
@@ -4,9 +4,8 @@ from six import unichr
...
@@ -4,9 +4,8 @@ from six import unichr
from
six.moves
import
xrange
from
six.moves
import
xrange
import
string
import
string
from
.DummyField
import
fields
from
.DummyField
import
fields
from
DocumentTemplate.
DT_Util
import
html_quote
from
DocumentTemplate.
html_quote
import
html_quote
from
DateTime
import
DateTime
,
Timezones
from
DateTime
import
DateTime
,
Timezones
from
Products.PythonScripts.standard
import
html_quote
import
types
import
types
from
DocumentTemplate.ustr
import
ustr
from
DocumentTemplate.ustr
import
ustr
from
six.moves.urllib.parse
import
urljoin
from
six.moves.urllib.parse
import
urljoin
...
...
product/Formulator/tests/testForm.py
View file @
0cfb1586
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
import
unittest
,
re
import
unittest
,
re
from
lxml
import
etree
from
DateTime
import
DateTime
from
DateTime
import
DateTime
import
Zope2
import
Zope2
...
@@ -122,9 +123,12 @@ class FormTestCase(unittest.TestCase):
...
@@ -122,9 +123,12 @@ class FormTestCase(unittest.TestCase):
.
manage_addField
(
'date_time'
,
'Test Field'
,
'DateTimeField'
)
.
manage_addField
(
'date_time'
,
'Test Field'
,
'DateTimeField'
)
field
=
self
.
form
.
date_time
field
=
self
.
form
.
date_time
field
.
_edit
({
'timezone_style'
:
0
})
field
.
_edit
({
'timezone_style'
:
0
})
self
.
assertNotIn
(
'<select size="1" name="subfield_field_date_time_timezone" >'
,
field
.
render
())
parser
=
etree
.
HTMLParser
()
e
=
etree
.
fromstring
(
field
.
render
(),
parser
=
parser
)
self
.
assertFalse
(
e
.
xpath
(
'//select[@size="1"][@name="subfield_field_date_time_timezone"]'
))
field
.
_edit
({
'timezone_style'
:
1
})
field
.
_edit
({
'timezone_style'
:
1
})
self
.
assertIn
(
'<select size="1" name="subfield_field_date_time_timezone" >'
,
field
.
render
())
e
=
etree
.
fromstring
(
field
.
render
(),
parser
=
parser
)
self
.
assertTrue
(
e
.
xpath
(
'//select[@size="1"][@name="subfield_field_date_time_timezone"]'
))
def
test_datetime_css_class_rendering
(
self
):
def
test_datetime_css_class_rendering
(
self
):
...
@@ -181,13 +185,18 @@ class FormTestCase(unittest.TestCase):
...
@@ -181,13 +185,18 @@ class FormTestCase(unittest.TestCase):
.
manage_addField
(
'date_time'
,
'Test Field'
,
'DateTimeField'
)
.
manage_addField
(
'date_time'
,
'Test Field'
,
'DateTimeField'
)
field
=
self
.
form
.
date_time
field
=
self
.
form
.
date_time
field
.
_edit
({
'input_style'
:
'number'
})
field
.
_edit
({
'input_style'
:
'number'
})
self
.
assertIn
(
'<input name="subfield_field_date_time_year" value="" maxlength="4" type="number" size="4" min="0" max="9999" />'
,
field
.
render
())
parser
=
etree
.
HTMLParser
()
e
=
etree
.
fromstring
(
field
.
render
(),
parser
=
parser
)
self
.
assertTrue
(
e
.
xpath
(
'//input[@name="subfield_field_date_time_year"][@value=""][@maxlength="4"][@type="number"][@size="4"][@min="0"][@max="9999"]'
))
field
.
_edit
({
'start_datetime'
:
DateTime
(
'1900/01/01'
),
'end_datetime'
:
None
})
field
.
_edit
({
'start_datetime'
:
DateTime
(
'1900/01/01'
),
'end_datetime'
:
None
})
self
.
assertIn
(
'<input name="subfield_field_date_time_year" value="" maxlength="4" type="number" size="4" min="1900" max="9999" />'
,
field
.
render
())
e
=
etree
.
fromstring
(
field
.
render
(),
parser
=
parser
)
self
.
assertTrue
(
e
.
xpath
(
'//input[@name="subfield_field_date_time_year"][@value=""][@maxlength="4"][@type="number"][@size="4"][@min="1900"][@max="9999"]'
))
field
.
_edit
({
'start_datetime'
:
None
,
'end_datetime'
:
DateTime
(
'2099/12/31'
)})
field
.
_edit
({
'start_datetime'
:
None
,
'end_datetime'
:
DateTime
(
'2099/12/31'
)})
self
.
assertIn
(
'<input name="subfield_field_date_time_year" value="" maxlength="4" type="number" size="4" min="0" max="2099" />'
,
field
.
render
())
e
=
etree
.
fromstring
(
field
.
render
(),
parser
=
parser
)
self
.
assertTrue
(
e
.
xpath
(
'//input[@name="subfield_field_date_time_year"][@value=""][@maxlength="4"][@type="number"][@size="4"][@min="0"][@max="2099"]'
))
field
.
_edit
({
'start_datetime'
:
DateTime
(
'1900/01/01'
),
'end_datetime'
:
DateTime
(
'2099/12/31'
)})
field
.
_edit
({
'start_datetime'
:
DateTime
(
'1900/01/01'
),
'end_datetime'
:
DateTime
(
'2099/12/31'
)})
self
.
assertIn
(
'<input name="subfield_field_date_time_year" value="" maxlength="4" type="number" size="4" min="1900" max="2099" />'
,
field
.
render
())
e
=
etree
.
fromstring
(
field
.
render
(),
parser
=
parser
)
self
.
assertTrue
(
e
.
xpath
(
'//input[@name="subfield_field_date_time_year"][@value=""][@maxlength="4"][@type="number"][@size="4"][@min="1900"][@max="2099"]'
))
def
test_suite
():
def
test_suite
():
...
...
product/Localizer/utils.py
View file @
0cfb1586
...
@@ -26,7 +26,8 @@ from App.Common import package_home
...
@@ -26,7 +26,8 @@ from App.Common import package_home
ph
=
package_home
(
globals
())
ph
=
package_home
(
globals
())
# Initializes a list with the charsets
# Initializes a list with the charsets
charsets
=
[
x
.
strip
()
for
x
in
open
(
ph
+
'/charsets.txt'
).
readlines
()
]
with
open
(
ph
+
'/charsets.txt'
)
as
f
:
charsets
=
[
x
.
strip
()
for
x
in
f
.
readlines
()
]
...
...
product/PortalTransforms/transforms/python.py
View file @
0cfb1586
...
@@ -20,7 +20,7 @@ from six.moves import cStringIO as StringIO
...
@@ -20,7 +20,7 @@ from six.moves import cStringIO as StringIO
from
Products.PortalTransforms.interfaces
import
ITransform
from
Products.PortalTransforms.interfaces
import
ITransform
from
zope.interface
import
implementer
from
zope.interface
import
implementer
from
DocumentTemplate.
DT_Util
import
html_quote
from
DocumentTemplate.
html_quote
import
html_quote
## Python Source Parser #####################################################
## Python Source Parser #####################################################
...
...
product/PortalTransforms/transforms/text_pre_to_html.py
View file @
0cfb1586
from
Products.PortalTransforms.interfaces
import
ITransform
from
Products.PortalTransforms.interfaces
import
ITransform
from
zope.interface
import
implementer
from
zope.interface
import
implementer
from
DocumentTemplate.
DT_Util
import
html_quote
from
DocumentTemplate.
html_quote
import
html_quote
__revision__
=
'$Id: text_pre_to_html.py 3658 2005-02-23 16:29:54Z tiran $'
__revision__
=
'$Id: text_pre_to_html.py 3658 2005-02-23 16:29:54Z tiran $'
...
...
product/PortalTransforms/transforms/text_to_html.py
View file @
0cfb1586
from
Products.PortalTransforms.interfaces
import
ITransform
from
Products.PortalTransforms.interfaces
import
ITransform
from
zope.interface
import
implementer
from
zope.interface
import
implementer
from
DocumentTemplate.
DT_Util
import
html_quote
from
DocumentTemplate.
html_quote
import
html_quote
__revision__
=
'$Id: text_to_html.py 4787 2005-08-19 21:43:41Z dreamcatcher $'
__revision__
=
'$Id: text_to_html.py 4787 2005-08-19 21:43:41Z dreamcatcher $'
...
...
product/ZSQLCatalog/ZSQLCatalog.py
View file @
0cfb1586
...
@@ -25,8 +25,11 @@ from OFS.Folder import Folder
...
@@ -25,8 +25,11 @@ from OFS.Folder import Folder
from
DateTime
import
DateTime
from
DateTime
import
DateTime
from
Acquisition
import
Implicit
,
aq_base
from
Acquisition
import
Implicit
,
aq_base
from
Persistence
import
Persistent
from
Persistence
import
Persistent
from
DocumentTemplate.DT_Util
import
InstanceDict
,
TemplateDict
from
DocumentTemplate.DT_Util
import
Eval
,
TemplateDict
from
DocumentTemplate.DT_Util
import
Eval
try
:
from
DocumentTemplate._DocumentTemplate
import
InstanceDict
except
ImportError
:
# BBB
from
DocumentTemplate.DT_Util
import
InstanceDict
from
AccessControl.Permission
import
pname
from
AccessControl.Permission
import
pname
from
AccessControl.Permissions
import
import_export_objects
,
\
from
AccessControl.Permissions
import
import_export_objects
,
\
manage_zcatalog_entries
manage_zcatalog_entries
...
...
product/Zelenium/zuite.py
View file @
0cfb1586
...
@@ -69,7 +69,9 @@ def _makeFile(filename, prefix=None, id=None):
...
@@ -69,7 +69,9 @@ def _makeFile(filename, prefix=None, id=None):
if
id
is
None
:
if
id
is
None
:
id
=
os
.
path
.
split
(
path
)[
1
]
id
=
os
.
path
.
split
(
path
)[
1
]
return
File
(
id
=
id
,
title
=
''
,
file
=
open
(
path
).
read
()
)
with
open
(
path
,
'rb'
)
as
f
:
data
=
f
.
read
()
return
File
(
id
=
id
,
title
=
''
,
file
=
data
)
def
registerFiles
(
directory
,
prefix
):
def
registerFiles
(
directory
,
prefix
):
...
...
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