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
1
Merge Requests
1
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
Cédric Le Ninivin
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
from
Products.CMFCore.utils
import
_setCacheHeaders
,
_ViewEmulator
from
DateTime
import
DateTime
import
re
import
six
if
six
.
PY3
:
long
=
int
# pylint:disable=redefined-builtin
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
import
sys
import
threading
import
traceback
import
unittest
import
six
from
AccessControl
import
getSecurityManager
from
AccessControl.SecurityManagement
import
newSecurityManager
...
...
@@ -48,6 +49,9 @@ from Products.ZSQLCatalog.SQLCatalog import Query, ComplexQuery, SimpleQuery
from
Testing
import
ZopeTestCase
from
zLOG
import
LOG
if
six
.
PY3
:
long
=
int
# pylint:disable=redefined-builtin
def
format_stack
(
thread
=
None
):
frame_dict
=
sys
.
_current_frames
()
if
thread
is
not
None
:
...
...
@@ -588,7 +592,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
uid_dict
=
{}
for
_
in
xrange
(
UID_BUFFER_SIZE
*
3
):
uid
=
portal_catalog
.
newUid
()
self
.
assert
True
(
isinstance
(
uid
,
long
)
)
self
.
assert
IsInstance
(
uid
,
long
)
self
.
assertNotIn
(
uid
,
uid_dict
)
uid_dict
[
uid
]
=
None
...
...
@@ -1647,6 +1651,9 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
portal_type
=
'Organisation'
,
**
catalog_kw
)])
def
test_54_FixIntUid
(
self
):
if
six
.
PY3
:
return
unittest
.
skipTest
(
"Python3 does not have different types for int and long"
)
portal
=
self
.
getPortal
()
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
import
six
result
=
''
request
=
context
.
REQUEST
...
...
@@ -9,7 +10,7 @@ listboxline_list = context.get_value('default', render_format='list', REQUEST=re
def
encode
(
value
):
if
isinstance
(
value
,
bool
):
return
'"%s"'
%
value
if
isinstance
(
value
,
(
int
,
long
,
float
)):
if
isinstance
(
value
,
six
.
integer_types
+
(
float
,
)):
return
str
(
value
)
else
:
if
isinstance
(
value
,
str
):
...
...
bt5/erp5_forum_tutorial/SkinTemplateItem/portal_skins/erp5_forum/ListBox_asStandardHTML.zpt
View file @
30c354a3
...
...
@@ -238,7 +238,7 @@
error python: value[2]"
class="DataA" align="left"
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"
type="hidden" value="1" name="listbox_uid:list"
tal:attributes="value python: line.getUid() or '';
...
...
@@ -268,7 +268,7 @@
<tal:block tal:repeat="value here/getStatValueList">
<td class="Data" align="left"
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:block>
</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
from
collections
import
OrderedDict
from
Products.ERP5Form.Selection
import
Selection
from
Products.PythonScripts.standard
import
Object
import
six
MARKER
=
Object
()
...
...
@@ -83,7 +84,7 @@ def toBasicTypes(obj):
"""Ensure that obj contains only basic types."""
if
obj
is
None
:
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
if
isinstance
(
obj
,
list
):
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 @@
</span>
<span style="color: green;"> : </span>
<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" />
<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" />
</tal:block>
<tal:block tal:condition="not:show_search_line">
...
...
@@ -302,7 +302,7 @@
<tal:block tal:condition="python: original_value is not None">
<span align="right"
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:block>
</div>
...
...
bt5/erp5_ods_style/SkinTemplateItem/portal_skins/erp5_ods_style/field_ods_macro.zpt
View file @
30c354a3
...
...
@@ -100,7 +100,7 @@
-->
<tal:block metal:define-macro="cell_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">
...
...
@@ -116,7 +116,7 @@
</tal:block>
<tal:block tal:condition="python: value is not None and not is_list">
<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)"
tal:attributes="office:value value;
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
import
time
import
json
from
DateTime
import
DateTime
import
six
response
=
container
.
REQUEST
.
RESPONSE
start
=
time
.
time
()
...
...
@@ -32,7 +33,7 @@ for line in results.tuples():
v
=
v
.
isoformat
()
elif
isinstance
(
v
,
Decimal
):
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
# as string, this will still not work for pivot table, but at least the spreadsheet
# 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
from
zLOG
import
LOG
,
ERROR
,
INFO
from
erp5.component.tool.WebServiceTool
import
ConnectionError
from
Products.ERP5Type.Cache
import
CachingMethod
import
six
if
six
.
PY3
:
long
=
int
ID_SEPARATOR
=
"-"
...
...
product/ERP5Form/www/ListBox_asHTML.zpt
View file @
30c354a3
...
...
@@ -330,7 +330,7 @@
error python: value[2]"
class="DataA" align="left"
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"
type="hidden" value="1" name="listbox_uid:list"
tal:attributes="value python: line.getUid() or '';
...
...
@@ -348,7 +348,7 @@
<tal:block tal:repeat="value here/getStatValueList">
<td class="Data" align="left"
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:block>
</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