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
Klaus Wölfel
erp5
Commits
30c354a3
Commit
30c354a3
authored
Oct 14, 2022
by
Kazuhiko Shiozaki
Committed by
Jérome Perrin
Dec 28, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: long does not exist in Python 3.
parent
0d965e65
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
31 additions
and
13 deletions
+31
-13
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_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/ERP5Document_getHateoas.py
...rtal_skins/erp5_hal_json_style/ERP5Document_getHateoas.py
+2
-1
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_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/ERP5Form/www/ListBox_asHTML.zpt
product/ERP5Form/www/ListBox_asHTML.zpt
+2
-2
No files found.
bt5/erp5_big_file/DocumentTemplateItem/portal_components/document.erp5.BigFile.py
View file @
30c354a3
...
@@ -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 @
30c354a3
...
@@ -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_csv_style/SkinTemplateItem/portal_skins/erp5_csv_style/Listbox_exportCsv.py
View file @
30c354a3
# 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 @
30c354a3
...
@@ -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/ERP5Document_getHateoas.py
View file @
30c354a3
...
@@ -63,6 +63,7 @@ from Products.ERP5Type.Message import Message
...
@@ -63,6 +63,7 @@ from Products.ERP5Type.Message import Message
from
collections
import
OrderedDict
from
collections
import
OrderedDict
from
Products.ERP5Form.Selection
import
Selection
from
Products.ERP5Form.Selection
import
Selection
from
Products.PythonScripts.standard
import
Object
from
Products.PythonScripts.standard
import
Object
import
six
MARKER
=
Object
()
MARKER
=
Object
()
...
@@ -83,7 +84,7 @@ def toBasicTypes(obj):
...
@@ -83,7 +84,7 @@ def toBasicTypes(obj):
"""Ensure that obj contains only basic types."""
"""Ensure that obj contains only basic types."""
if
obj
is
None
:
if
obj
is
None
:
return
obj
return
obj
if
isinstance
(
obj
,
(
bool
,
int
,
float
,
long
,
str
,
unicode
)):
if
isinstance
(
obj
,
(
bool
,
float
,
str
)
+
six
.
integer_types
+
(
six
.
text_type
,
)):
return
obj
return
obj
if
isinstance
(
obj
,
list
):
if
isinstance
(
obj
,
list
):
return
[
toBasicTypes
(
x
)
for
x
in
obj
]
return
[
toBasicTypes
(
x
)
for
x
in
obj
]
...
...
bt5/erp5_mobile/SkinTemplateItem/portal_skins/erp5_mobile_ui/ListBox_asHTML.zpt
View file @
30c354a3
...
@@ -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 @
30c354a3
...
@@ -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_sql_browser/SkinTemplateItem/portal_skins/erp5_sql_browser/ZMySQLDAConnection_getQueryResultAsJSON.py
View file @
30c354a3
...
@@ -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 @
30c354a3
...
@@ -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/ERP5Form/www/ListBox_asHTML.zpt
View file @
30c354a3
...
@@ -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>
...
...
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