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
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
Levin Zimmermann
erp5
Commits
2f814c94
Commit
2f814c94
authored
2 years ago
by
Arnaud Fontaine
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py3: string.zfill() was removed.
parent
dcaffa0b
No related merge requests found
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
30 additions
and
44 deletions
+30
-44
bt5/erp5_barcode/ExtensionTemplateItem/portal_components/extension.erp5.Barcode.py
...nTemplateItem/portal_components/extension.erp5.Barcode.py
+2
-3
bt5/erp5_barcode/SkinTemplateItem/portal_skins/erp5_barcode/BarcodeModule_getLastGeneratedId.py
...al_skins/erp5_barcode/BarcodeModule_getLastGeneratedId.py
+1
-2
bt5/erp5_consulting/SkinTemplateItem/portal_skins/erp5_consulting/FastInput_generateObjectStructure.py
...kins/erp5_consulting/FastInput_generateObjectStructure.py
+0
-1
bt5/erp5_consulting/SkinTemplateItem/portal_skins/erp5_consulting/FastInput_generateTwoLevelObjectStructure.py
...5_consulting/FastInput_generateTwoLevelObjectStructure.py
+1
-2
bt5/erp5_consulting/SkinTemplateItem/portal_skins/erp5_consulting/FastInput_initialize.py
...Item/portal_skins/erp5_consulting/FastInput_initialize.py
+3
-3
bt5/erp5_consulting/SkinTemplateItem/portal_skins/erp5_consulting/UseCase_generateUseCaseScenarioList.py
...ns/erp5_consulting/UseCase_generateUseCaseScenarioList.py
+0
-1
bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_getReportFailedResultList.py
...l_skins/erp5_ooo_import/Base_getReportFailedResultList.py
+3
-3
bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_getReportResultList.py
.../portal_skins/erp5_ooo_import/Base_getReportResultList.py
+3
-3
bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_getSpreadsheetColumnNameList.py
...kins/erp5_ooo_import/Base_getSpreadsheetColumnNameList.py
+3
-3
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_initializeFastInput.py
.../portal_skins/erp5_project/Project_initializeFastInput.py
+3
-3
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project_trade/Delivery_updateTaskFastInputDialog.py
.../erp5_project_trade/Delivery_updateTaskFastInputDialog.py
+1
-2
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getDivergenceMessageList.py
...tal_skins/erp5_trade/Delivery_getDivergenceMessageList.py
+2
-3
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.DateUtils.py
...ntTemplateItem/portal_components/module.erp5.DateUtils.py
+1
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_generateDayDomain.py
...lateItem/portal_skins/erp5_core/Base_generateDayDomain.py
+1
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_generateMonthDomain.py
...teItem/portal_skins/erp5_core/Base_generateMonthDomain.py
+1
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_generateWeekDomain.py
...ateItem/portal_skins/erp5_core/Base_generateWeekDomain.py
+1
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_generateYearDomain.py
...ateItem/portal_skins/erp5_core/Base_generateYearDomain.py
+1
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_updateDialogForm.py
...plateItem/portal_skins/erp5_core/Base_updateDialogForm.py
+1
-2
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ListBox_initializeFastInput.py
...tem/portal_skins/erp5_core/ListBox_initializeFastInput.py
+2
-3
No files found.
bt5/erp5_barcode/ExtensionTemplateItem/portal_components/extension.erp5.Barcode.py
View file @
2f814c94
...
...
@@ -31,7 +31,6 @@ from builtins import str
from
builtins
import
map
from
builtins
import
range
import
os
from
string
import
zfill
from
urllib.parse
import
urlencode
import
tempfile
from
DateTime
import
DateTime
...
...
@@ -87,14 +86,14 @@ def printBarcodeSheet(self, sheet_number=1, input_list=[], test=False):
tempfile
.
tempdir
=
tempdir
if
test
:
#Fake list
input_list
=
os
.
linesep
.
join
([
'TEST%
s'
%
zfill
(
b
,
8
)
for
b
in
range
(
1111111
,
1111111
+
(
row_number
*
column_number
*
sheet_number
))])
input_list
=
os
.
linesep
.
join
([
'TEST%
08d'
%
b
for
b
in
range
(
1111111
,
1111111
+
(
row_number
*
column_number
*
sheet_number
))])
elif
input_list
not
in
(
''
,
None
):
if
not
isinstance
(
input_list
,
list
):
input_list
=
os
.
linesep
.
join
(
map
(
escapeString
,
input_list
.
split
(
os
.
linesep
)))
else
:
input_list
=
os
.
linesep
.
join
(
input_list
)
else
:
input_list
=
os
.
linesep
.
join
([
'%
s'
%
zfill
(
self
.
portal_ids
.
generateNewId
(
id_group
=
'barcode'
),
12
)
for
b
in
range
(
row_number
*
column_number
*
sheet_number
)])
input_list
=
os
.
linesep
.
join
([
'%
012d'
%
self
.
portal_ids
.
generateNewId
(
id_group
=
'barcode'
)
for
b
in
range
(
row_number
*
column_number
*
sheet_number
)])
text_command
=
'echo "%s" > %s'
%
(
input_list
,
new_txt_file_path
)
ret
=
os
.
system
(
text_command
)
if
ret
!=
0
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_barcode/SkinTemplateItem/portal_skins/erp5_barcode/BarcodeModule_getLastGeneratedId.py
View file @
2f814c94
from
string
import
zfill
return
zfill
(
context
.
portal_ids
.
getLastGeneratedId
(
id_group
=
'barcode'
),
12
)
return
"%012d"
%
context
.
portal_ids
.
getLastGeneratedId
(
id_group
=
'barcode'
)
This diff is collapsed.
Click to expand it.
bt5/erp5_consulting/SkinTemplateItem/portal_skins/erp5_consulting/FastInput_generateObjectStructure.py
View file @
2f814c94
from
__future__
import
print_function
from
past.builtins
import
cmp
from
builtins
import
range
from
string
import
zfill
##################################################
#### About the transformation_rules structure ####
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_consulting/SkinTemplateItem/portal_skins/erp5_consulting/FastInput_generateTwoLevelObjectStructure.py
View file @
2f814c94
from
past.builtins
import
cmp
from
string
import
zfill
##################################################
#### About the transformation_rules structure ####
...
...
@@ -93,7 +92,7 @@ for upper_level_key in structured_input_data:
for
second_level
in
structured_input_data
[
upper_level_key
][
1
]:
second_level_id
+=
10
new_2nd_level_obj
=
new_1st_level_obj
.
newContent
(
portal_type
=
level_portal_types
[
1
]
,
id
=
zfill
(
second_level_id
,
4
)
,
id
=
"%04d"
%
second_level_id
)
for
property_title
in
list
(
second_level
.
keys
()):
new_2nd_level_obj
.
setProperty
(
property_title
,
second_level
[
property_title
])
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_consulting/SkinTemplateItem/portal_skins/erp5_consulting/FastInput_initialize.py
View file @
2f814c94
from
builtins
import
str
from
builtins
import
range
from
Products.ERP5Type.Document
import
newTempBase
from
string
import
zfill
global
portal_object
,
new_id
,
l
...
...
@@ -14,9 +13,10 @@ def createInputLine():
global
portal_object
,
new_id
,
l
new_id
+=
1
int_len
=
3
new_id_str
=
str
(
new_id
)
o
=
newTempBase
(
portal_object
,
str
(
new_id
)
,
uid
=
'new_
%s'
%
zfill
(
new_id
,
int_len
)
,
new_id_str
,
uid
=
'new_
'
+
new_id_str
.
zfill
(
int_len
)
)
l
.
append
(
o
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_consulting/SkinTemplateItem/portal_skins/erp5_consulting/UseCase_generateUseCaseScenarioList.py
View file @
2f814c94
from
past.builtins
import
cmp
from
string
import
zfill
destination_obj
=
context
.
getObject
()
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_getReportFailedResultList.py
View file @
2f814c94
from
Products.ERP5Type.Document
import
newTempBase
from
string
import
zfill
portal_object
=
context
.
getPortalObject
()
num
=
0
...
...
@@ -19,9 +18,10 @@ for [method_id, result] in result_list:
num
+=
1
int_len
=
7
if
not
result
[
'success'
]:
uid
=
'new_'
+
str
(
num
).
zfill
(
int_len
)
o
=
newTempBase
(
portal_object
,
safe_id
)
o
.
setUid
(
'new_%s'
%
zfill
(
num
,
int_len
))
# XXX There is a security issue here
o
.
edit
(
uid
=
'new_%s'
%
zfill
(
num
,
int_len
)
)
# XXX There is a security issue here
o
.
setUid
(
uid
)
# XXX There is a security issue here
o
.
edit
(
uid
=
uid
)
# XXX There is a security issue here
o
.
edit
(
**
result
[
'object'
])
result_listbox
.
append
(
o
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_getReportResultList.py
View file @
2f814c94
from
Products.ERP5Type.Document
import
newTempBase
from
string
import
zfill
portal_object
=
context
.
getPortalObject
()
num
=
0
...
...
@@ -24,9 +23,10 @@ for [method_id, result] in result_list:
safe_id
=
context
.
Base_getSafeIdFromString
(
'result %s'
%
num
)
num
+=
1
int_len
=
3
uid
=
'new_'
+
str
(
num
).
zfill
(
int_len
)
o
=
newTempBase
(
portal_object
,
safe_id
)
o
.
setUid
(
'new_%s'
%
zfill
(
num
,
int_len
))
# XXX There is a security issue here
o
.
edit
(
uid
=
'new_%s'
%
zfill
(
num
,
int_len
)
)
# XXX There is a security issue here
o
.
setUid
(
uid
)
# XXX There is a security issue here
o
.
edit
(
uid
=
uid
)
# XXX There is a security issue here
o
.
edit
(
method_id
=
method_id
,
result
=
result
[
'message'
]
,
object_url
=
result
[
'object_url'
]
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_ooo_import/SkinTemplateItem/portal_skins/erp5_ooo_import/Base_getSpreadsheetColumnNameList.py
View file @
2f814c94
from
Products.ERP5Type.Document
import
newTempBase
from
string
import
zfill
num
=
0
listbox_lines
=
[]
...
...
@@ -23,8 +22,9 @@ for spreadsheet in list(spreadsheets.keys()):
# int_len is used to fill the uid of the created object like 0000001
int_len
=
7
o
=
newTempBase
(
context
,
safe_id
)
o
.
setUid
(
'new_%s'
%
zfill
(
num
,
int_len
))
# XXX There is a security issue here
o
.
edit
(
uid
=
'new_%s'
%
zfill
(
num
,
int_len
))
# XXX There is a security issue here
uid
=
'new_'
+
str
(
num
).
zfill
(
int_len
)
o
.
setUid
(
uid
)
# XXX There is a security issue here
o
.
edit
(
uid
=
uid
)
# XXX There is a security issue here
o
.
edit
(
id
=
safe_id
,
spreadsheet_name
=
spreadsheet
,
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project/Project_initializeFastInput.py
View file @
2f814c94
from
builtins
import
str
from
builtins
import
range
from
Products.ERP5Type.Document
import
newTempBase
from
string
import
zfill
portal_object
=
context
.
getPortalObject
()
...
...
@@ -15,9 +14,10 @@ l = []
# function to create a new fast input line
def
createInputLine
(
new_id
):
int_len
=
3
new_id_str
=
str
(
new_id
)
o
=
newTempBase
(
portal_object
,
str
(
new_id
)
,
uid
=
'new_
%s'
%
zfill
(
new_id
,
int_len
)
new_id_str
,
uid
=
'new_
'
+
new_id_str
.
zfill
(
int_len
)
)
l
.
append
(
o
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_project/SkinTemplateItem/portal_skins/erp5_project_trade/Delivery_updateTaskFastInputDialog.py
View file @
2f814c94
...
...
@@ -6,7 +6,6 @@ context.log('source_project_title', source_project_title)
portal
=
context
.
getPortalObject
()
line_portal_type
=
"Sale Order Line"
request
=
context
.
REQUEST
from
string
import
zfill
from
Products.ERP5Type.Document
import
newTempBase
from
Products.ERP5Type.Message
import
translateString
...
...
@@ -36,7 +35,7 @@ portal = context.getPortalObject()
for
line
in
line_list
:
line_dict
=
{}
#line_dict['listbox_key'] = "%s" % line_id
key
=
zfill
(
i
,
3
)
key
=
"%03d"
%
i
for
property_name
in
(
'title'
,
'quantity_unit_title'
,
'quantity'
,
'resource_title'
,
'total_price'
,
'price'
,
'reference'
,
'relative_url'
):
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_trade/SkinTemplateItem/portal_skins/erp5_trade/Delivery_getDivergenceMessageList.py
View file @
2f814c94
...
...
@@ -2,7 +2,6 @@ from builtins import str
divergence_messages_list
=
context
.
getDivergenceList
()
from
Products.ERP5Type.Document
import
newTempBase
from
string
import
zfill
portal_object
=
context
.
getPortalObject
()
...
...
@@ -11,10 +10,10 @@ l = []
# function to create a new fast input line
def
createInputLine
(
d_message
,
new_id
):
int_len
=
3
new_id_str
=
str
(
new_id
)
o
=
newTempBase
(
portal_object
,
str
(
new_id
)
,
uid
=
'new_
%s'
%
zfill
(
new_id
,
int_len
)
,
uid
=
'new_
'
+
new_id_str
.
zfill
(
int_len
)
,
message
=
str
(
d_message
.
getTranslatedMessage
())
,
tested_property_id
=
d_message
.
getProperty
(
'tested_property'
)
,
object_title
=
d_message
.
getObject
().
getTranslatedTitle
()
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/ModuleComponentTemplateItem/portal_components/module.erp5.DateUtils.py
View file @
2f814c94
...
...
@@ -34,7 +34,6 @@ import warnings
from
AccessControl
import
ModuleSecurityInfo
from
DateTime
import
DateTime
from
datetime
import
datetime
from
string
import
zfill
security
=
ModuleSecurityInfo
(
__name__
)
security
.
declarePublic
(
'addToDate'
,
'getClosestDate'
,
...
...
@@ -495,7 +494,7 @@ def atTheEndOfPeriod(date, period):
if
period
==
'year'
:
end
=
addToDate
(
DateTime
(
'%s/01/01 00:00:00 %s'
%
(
date
.
year
(),
date
.
timezone
())),
**
{
period
:
1
})
elif
period
==
'month'
:
end
=
addToDate
(
DateTime
(
'%s/%
s/01 00:00:00 %s'
%
(
date
.
year
(),
zfill
(
date
.
month
(),
2
),
date
.
timezone
())),
**
{
period
:
1
})
end
=
addToDate
(
DateTime
(
'%s/%
02d/01 00:00:00 %s'
%
(
date
.
year
(),
date
.
month
(
),
date
.
timezone
())),
**
{
period
:
1
})
elif
period
==
'day'
:
end
=
addToDate
(
date
.
earliestTime
(),
hour
=
36
).
earliestTime
()
elif
period
==
'week'
:
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_generateDayDomain.py
View file @
2f814c94
from
builtins
import
str
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Document
import
newTempBase
from
string
import
zfill
portal
=
context
.
getPortalObject
()
request
=
context
.
REQUEST
domain_list
=
[]
...
...
@@ -29,7 +28,7 @@ if depth == 0:
# 0.125 means 3 hours in DateTime float format
while
current_date
<
bound_stop
:
# Create one Temp Object
o
=
newTempBase
(
portal
,
id
=
'year'
,
uid
=
'new_
%s'
%
zfill
(
'year'
,
4
)
)
o
=
newTempBase
(
portal
,
id
=
'year'
,
uid
=
'new_
year'
)
# Setting Axis Dates start and stop
o
.
setProperty
(
'start'
,
current_date
)
o
.
setProperty
(
'stop'
,
current_date
+
0.125
)
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_generateMonthDomain.py
View file @
2f814c94
...
...
@@ -7,7 +7,6 @@ from past.utils import old_div
from
Products.ERP5Type.Message
import
Message
from
Products.ERP5Type.Document
import
newTempBase
from
Products.PythonScripts.standard
import
url_quote
from
string
import
zfill
portal
=
context
.
getPortalObject
()
request
=
context
.
REQUEST
domain_list
=
[]
...
...
@@ -50,7 +49,7 @@ if depth == 0:
while
current_date
<
axis_stop
:
# Create one Temp Object
o
=
newTempBase
(
portal
,
id
=
str
(
current_date
.
Day
()),
uid
=
'new_
%s'
%
zfill
(
'year'
,
4
)
)
uid
=
'new_
year'
)
# Setting Axis Dates start and stop
o
.
setProperty
(
'start'
,
current_date
)
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_generateWeekDomain.py
View file @
2f814c94
...
...
@@ -5,7 +5,6 @@ from builtins import str
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Document
import
newTempBase
from
Products.PythonScripts.standard
import
url_quote
from
string
import
zfill
portal
=
context
.
getPortalObject
()
request
=
context
.
REQUEST
...
...
@@ -40,7 +39,7 @@ if depth == 0:
# This case show Seven days
while
current_date
<
bound_stop
:
# Create one Temp Object
o
=
newTempBase
(
portal
,
id
=
'week'
,
uid
=
'new_
%s'
%
zfill
(
'week'
,
4
)
)
o
=
newTempBase
(
portal
,
id
=
'week'
,
uid
=
'new_
week'
)
# Setting Axis Dates start and stop
o
.
setProperty
(
'start'
,
current_date
)
o
.
setProperty
(
'stop'
,
current_date
+
1
)
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_generateYearDomain.py
View file @
2f814c94
...
...
@@ -5,7 +5,6 @@ from builtins import str
from
Products.ERP5Type.Message
import
translateString
from
Products.ERP5Type.Document
import
newTempBase
from
Products.PythonScripts.standard
import
url_quote
from
string
import
zfill
portal
=
context
.
getPortalObject
()
request
=
context
.
REQUEST
...
...
@@ -28,7 +27,7 @@ if depth == 0:
count
=
0
while
count
<
12
:
# Create one Temp Object
o
=
newTempBase
(
portal
,
id
=
'year'
,
uid
=
'new_
%s'
%
zfill
(
'year'
,
4
)
)
o
=
newTempBase
(
portal
,
id
=
'year'
,
uid
=
'new_
year'
)
# Setting delimiter
if
current_date
.
month
()
in
[
1
,
7
]:
o
.
setProperty
(
'delimiter_type'
,
1
)
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Base_updateDialogForm.py
View file @
2f814c94
from
builtins
import
str
from
string
import
zfill
request
=
context
.
REQUEST
if
kw
.
get
(
'update'
,
False
):
...
...
@@ -17,7 +16,7 @@ for k in list(kw.keys()):
if
listbox_key
in
line
:
key
=
'%s'
%
line
[
listbox_key
]
else
:
key
=
str
(
zfill
(
i
,
3
))
key
=
'%03d'
%
i
listbox
[
key
]
=
line
i
+=
1
request
.
set
(
k
,
listbox
)
...
...
This diff is collapsed.
Click to expand it.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/ListBox_initializeFastInput.py
View file @
2f814c94
from
builtins
import
str
from
builtins
import
range
from
Products.ERP5Type.Document
import
newTempBase
from
string
import
zfill
if
listbox_id
is
None
:
listbox_id
=
'listbox'
...
...
@@ -30,7 +29,7 @@ if hasattr(request, listbox_id):
for
i
in
keys_list
:
o
=
newTempBase
(
portal_object
,
i
)
o
.
setUid
(
'new_%s'
%
zfill
(
i
,
int_len
))
o
.
setUid
(
'new_%s'
%
str
(
i
).
zfill
(
int_len
))
is_empty
=
1
...
...
@@ -52,7 +51,7 @@ if not('field_errors' in request):
for
i
in
range
(
first_empty_line_id
,
first_empty_line_id
+
empty_line_number
):
o
=
newTempBase
(
portal_object
,
str
(
i
))
o
.
setUid
(
'new_%s'
%
zfill
(
i
,
int_len
))
o
.
setUid
(
'new_%s'
%
str
(
i
).
zfill
(
int_len
))
# zfill is used here to garantee sort order - XXX - cleaner approach required
l
.
append
(
o
)
...
...
This diff is collapsed.
Click to expand it.
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