Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
nexedi
erp5
Commits
47ff58ca
Commit
47ff58ca
authored
2 years ago
by
Kazuhiko Shiozaki
Browse files
Options
Download
Email Patches
Plain Diff
py2/py3: modernize -f xrange_six.
parent
aed6255d
Changes
53
Hide whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
69 additions
and
49 deletions
+69
-49
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/ERP5Site_checkCatalogTable.py
...l_skins/erp5_administration/ERP5Site_checkCatalogTable.py
+2
-1
bt5/erp5_archive/WorkflowTemplateItem/portal_workflow/archive_workflow/script_checkArchive.py
...m/portal_workflow/archive_workflow/script_checkArchive.py
+3
-2
bt5/erp5_big_file/ModuleComponentTemplateItem/portal_components/module.erp5.BTreeData.py
...ntTemplateItem/portal_components/module.erp5.BTreeData.py
+9
-8
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
...eItem/portal_components/test.erp5.testBusinessTemplate.py
+6
-5
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
...mplateItem/portal_components/test.erp5.testERP5Catalog.py
+4
-3
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFolder.py
...estTemplateItem/portal_components/test.erp5.testFolder.py
+3
-2
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIdTool.py
...estTemplateItem/portal_components/test.erp5.testIdTool.py
+4
-3
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIdToolUpgrade.py
...lateItem/portal_components/test.erp5.testIdToolUpgrade.py
+4
-3
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTrashTool.py
...TemplateItem/portal_components/test.erp5.testTrashTool.py
+2
-1
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWorkflowHistoryList.py
...em/portal_components/test.erp5.testWorkflowHistoryList.py
+9
-8
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/EventModule_getEventDetailedLineList.py
...al_skins/erp5_crm/EventModule_getEventDetailedLineList.py
+2
-1
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Ticket_getResourceItemList.py
...eItem/portal_skins/erp5_crm/Ticket_getResourceItemList.py
+2
-1
bt5/erp5_csv_style/SkinTemplateItem/portal_skins/erp5_csv_core/Base_importCsvFile.py
...lateItem/portal_skins/erp5_csv_core/Base_importCsvFile.py
+2
-1
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testDms.py
...s/TestTemplateItem/portal_components/test.erp5.testDms.py
+4
-3
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testERP5WebWithDms.py
...ateItem/portal_components/test.erp5.testERP5WebWithDms.py
+3
-2
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testWebDavSupport.py
...lateItem/portal_components/test.erp5.testWebDavSupport.py
+2
-1
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.Subversion.py
...tTemplateItem/portal_components/module.erp5.Subversion.py
+2
-1
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.WorkingCopy.py
...TemplateItem/portal_components/module.erp5.WorkingCopy.py
+2
-1
bt5/erp5_ingestion/ToolComponentTemplateItem/portal_components/tool.erp5.UrlRegistryTool.py
...mplateItem/portal_components/tool.erp5.UrlRegistryTool.py
+2
-1
bt5/erp5_ingestion_test/TestTemplateItem/portal_components/test.erp5.testLiveIngestion.py
...lateItem/portal_components/test.erp5.testLiveIngestion.py
+2
-1
No files found.
bt5/erp5_administration/SkinTemplateItem/portal_skins/erp5_administration/ERP5Site_checkCatalogTable.py
View file @
47ff58ca
...
...
@@ -16,6 +16,7 @@
"""
from
DateTime
import
DateTime
from
Products.CMFActivity.ActiveResult
import
ActiveResult
from
six.moves
import
range
active_result
=
ActiveResult
()
portal
=
context
.
getPortalObject
()
activate
=
portal
.
portal_activities
.
activate
...
...
@@ -54,7 +55,7 @@ if catalog_uid_list is None:
'tag'
:
tag
,
'fixit'
:
fixit
,
}
for
_
in
x
range
(
activity_count
):
for
_
in
range
(
activity_count
):
if
len
(
catalog_uid_list
)
==
0
:
result_list
.
append
(
'No more uids to check, stop spawning activities.'
)
break
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_archive/WorkflowTemplateItem/portal_workflow/archive_workflow/script_checkArchive.py
View file @
47ff58ca
from
Products.ERP5Type.Core.Workflow
import
ValidationFailed
from
Products.ERP5Type.Message
import
Message
from
six.moves
import
range
# Check new catalog or catalog is the same as previous archive
# Check date
...
...
@@ -25,7 +26,7 @@ if archive.getStopDateRangeMax() is not None:
if
len
(
previous_archive_list
)
>
0
:
# Check the date
for
x
in
x
range
(
len
(
previous_archive_list
)):
for
x
in
range
(
len
(
previous_archive_list
)):
previous_archive
=
previous_archive_list
[
x
]
# find a previous archive which was not for current catalog
if
previous_archive
.
getStopDateRangeMax
()
is
not
None
:
...
...
@@ -40,7 +41,7 @@ else:
if
len
(
previous_archive_list
)
>
0
:
# Check the date
for
x
in
x
range
(
len
(
previous_archive_list
)):
for
x
in
range
(
len
(
previous_archive_list
)):
previous_archive
=
previous_archive_list
[
x
]
# find a previous archive which was not for current catalog
if
previous_archive
.
getStopDateRangeMax
()
is
not
None
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_big_file/ModuleComponentTemplateItem/portal_components/module.erp5.BTreeData.py
View file @
47ff58ca
from
BTrees.LOBTree
import
LOBTree
from
persistent
import
Persistent
import
itertools
from
six.moves
import
range
# Maximum memory to allocate for sparse-induced padding.
MAX_PADDING_CHUNK
=
2
**
20
...
...
@@ -418,22 +419,22 @@ if __name__ == '__main__':
check
(
data
,
36
,
0
,
36
,
'01ABC56789ABcDEFGHIJKL
\x00
NOPQRSTUVWXYZ'
,
[
0
,
10
,
20
,
23
,
33
])
data
=
BTreeData
(
max_chunk_size
=
10
)
for
x
in
x
range
(
255
):
for
x
in
range
(
255
):
data
.
write
(
'%02x'
%
x
,
x
*
2
)
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
x
*
2
for
x
in
x
range
(
255
)])
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
x
*
2
for
x
in
range
(
255
)])
defragment_generator
=
data
.
defragment
(
batch_size
=
2
)
defragment_generator
.
next
()
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
0
]
+
[
x
*
2
for
x
in
x
range
(
2
,
255
)])
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
0
]
+
[
x
*
2
for
x
in
range
(
2
,
255
)])
opaque
=
defragment_generator
.
next
()
defragment_generator
.
close
()
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
0
]
+
[
x
*
2
for
x
in
x
range
(
4
,
255
)])
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
0
]
+
[
x
*
2
for
x
in
range
(
4
,
255
)])
defragment_generator
=
data
.
defragment
(
batch_size
=
2
,
resume_at
=
opaque
)
defragment_generator
.
next
()
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
0
]
+
[
x
*
2
for
x
in
x
range
(
5
,
255
)])
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
0
]
+
[
x
*
2
for
x
in
range
(
5
,
255
)])
defragment_generator
.
send
(
10
)
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
0
,
10
,
20
]
+
[
x
*
2
for
x
in
x
range
(
13
,
255
)])
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
0
,
10
,
20
]
+
[
x
*
2
for
x
in
range
(
13
,
255
)])
defragment_generator
.
next
()
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
0
,
10
,
20
,
30
,
40
]
+
[
x
*
2
for
x
in
x
range
(
23
,
255
)])
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
0
,
10
,
20
,
30
,
40
]
+
[
x
*
2
for
x
in
range
(
23
,
255
)])
for
_
in
defragment_generator
:
pass
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
x
*
10
for
x
in
x
range
(
51
)])
check
(
data
,
510
,
0
,
10
,
'0001020304'
,
[
x
*
10
for
x
in
range
(
51
)])
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testBusinessTemplate.py
View file @
47ff58ca
...
...
@@ -47,6 +47,7 @@ import string
import
tempfile
import
glob
import
sys
from
six.moves
import
range
WORKFLOW_TYPE
=
'erp5_workflow'
...
...
@@ -606,7 +607,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
module
.
manage_permission
(
'Copy or Move'
,
[
'Assignor'
],
False
)
sequence
.
edit
(
module_id
=
module
.
getId
())
module_object_list
=
[]
for
_
in
x
range
(
10
):
for
_
in
range
(
10
):
obj
=
module
.
newContent
(
portal_type
=
'Geek Object'
)
self
.
assertIsNotNone
(
obj
)
module_object_list
.
append
(
obj
)
...
...
@@ -630,7 +631,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
module
=
portal
.
_getOb
(
module_id
,
None
)
self
.
assertIsNotNone
(
module
)
module_object_list
=
[]
for
_
in
x
range
(
10
):
for
_
in
range
(
10
):
obj
=
module
.
newContent
(
portal_type
=
'Geek Object'
)
self
.
assertIsNotNone
(
obj
)
module_object_list
.
append
(
obj
.
getId
())
...
...
@@ -1178,7 +1179,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
base_category
=
pc
.
_getOb
(
bc_id
,
None
)
self
.
assertTrue
(
base_category
is
not
None
)
category_list
=
[]
for
_
in
x
range
(
10
):
for
_
in
range
(
10
):
category
=
base_category
.
newContent
(
portal_type
=
'Category'
)
category_list
.
append
(
category
.
getId
())
sequence
.
edit
(
category_id_list
=
category_list
)
...
...
@@ -1245,7 +1246,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
self
.
assertTrue
(
category
is
not
None
)
subcategory_list
=
[]
subcategory_uid_dict
=
{}
for
_
in
x
range
(
10
):
for
_
in
range
(
10
):
subcategory
=
category
.
newContent
(
portal_type
=
'Category'
,
title
=
'toto'
)
subcategory_list
.
append
(
subcategory
.
getId
())
subcategory_uid_dict
[
subcategory
.
getId
()]
=
subcategory
.
getUid
()
...
...
@@ -3040,7 +3041,7 @@ class BusinessTemplateMixin(ERP5TypeTestCase, LogInterceptor):
def
stepCreateFakeZODBScript
(
self
,
sequence
=
None
,
**
kw
):
"""Create a Script inside portal_skins
"""
grain_of_sand
=
''
.
join
([
random
.
choice
(
string
.
ascii_letters
)
for
_
in
x
range
(
10
)])
grain_of_sand
=
''
.
join
([
random
.
choice
(
string
.
ascii_letters
)
for
_
in
range
(
10
)])
python_script_id
=
'ERP5Site_dummyScriptWhichRandomId%s'
%
grain_of_sand
skin_folder_id
=
'custom'
if
getattr
(
self
.
portal
.
portal_skins
,
skin_folder_id
,
None
)
is
None
:
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testERP5Catalog.py
View file @
47ff58ca
...
...
@@ -47,6 +47,7 @@ from Products.PageTemplates.Expressions import getEngine
from
Products.ZSQLCatalog.SQLCatalog
import
Query
,
ComplexQuery
,
SimpleQuery
from
Testing
import
ZopeTestCase
from
zLOG
import
LOG
from
six.moves
import
range
def
format_stack
(
thread
=
None
):
frame_dict
=
sys
.
_current_frames
()
...
...
@@ -586,7 +587,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
portal_catalog
=
self
.
getCatalogTool
()
from
Products.ZSQLCatalog.SQLCatalog
import
UID_BUFFER_SIZE
uid_dict
=
{}
for
_
in
x
range
(
UID_BUFFER_SIZE
*
3
):
for
_
in
range
(
UID_BUFFER_SIZE
*
3
):
uid
=
portal_catalog
.
newUid
()
self
.
assertTrue
(
isinstance
(
uid
,
long
))
self
.
assertFalse
(
uid
in
uid_dict
)
...
...
@@ -1277,7 +1278,7 @@ class TestERP5Catalog(ERP5TypeTestCase, LogInterceptor):
old_default_result_limit
=
ctool
.
default_result_limit
max_
=
ctool
.
default_result_limit
=
3
#Create max + 2 Organisations
for
i
in
x
range
(
max_
+
2
):
for
i
in
range
(
max_
+
2
):
self
.
_makeOrganisation
(
title
=
'abc%s'
%
(
i
),
description
=
'abc'
)
self
.
assertEqual
(
max_
,
len
(
self
.
getCatalogTool
()(
portal_type
=
'Organisation'
)))
...
...
@@ -4056,7 +4057,7 @@ VALUES
now
=
DateTime
()
try
:
organisation_list
=
[]
for
_
in
x
range
(
0
,
300
):
for
_
in
range
(
0
,
300
):
organisation_list
.
append
(
self
.
portal
.
organisation_module
.
newContent
().
getPath
())
self
.
tic
()
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testFolder.py
View file @
47ff58ca
...
...
@@ -37,6 +37,7 @@ from Products.ERP5Type.Cache import clearCache
from
Products.ERP5Type.Core.Folder
import
FragmentedLength
,
FRAGMENTED_LENGTH_THRESHOLD
from
AccessControl.ZopeGuards
import
guarded_getattr
from
zExceptions
import
Unauthorized
from
six.moves
import
range
class
TestFolder
(
ERP5TypeTestCase
,
LogInterceptor
):
...
...
@@ -108,7 +109,7 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor):
'return %s[len(context)]'
%
(
repr
(
id_generator_id_list
),
))
self
.
folder
.
setIdGenerator
(
id_generator_script_name
)
self
.
assertEqual
(
self
.
folder
.
getIdGenerator
(),
id_generator_script_name
)
for
expected_length
in
x
range
(
len
(
id_generator_id_list
)):
for
expected_length
in
range
(
len
(
id_generator_id_list
)):
self
.
assertEqual
(
len
(
self
.
folder
),
expected_length
)
obj
=
self
.
newContent
()
self
.
assertEqual
(
obj
.
getId
(),
id_generator_id_list
[
expected_length
])
...
...
@@ -278,7 +279,7 @@ class TestFolder(ERP5TypeTestCase, LogInterceptor):
self
.
assertEqual
(
len
(
folder
),
1
)
self
.
assertIsInstance
(
folder_dict
[
'_count'
],
Length
)
original_length_oid
=
folder_dict
[
'_count'
].
_p_oid
for
_
in
x
range
(
FRAGMENTED_LENGTH_THRESHOLD
-
len
(
folder
)
-
1
):
for
_
in
range
(
FRAGMENTED_LENGTH_THRESHOLD
-
len
(
folder
)
-
1
):
folder
.
newContent
(
portal_type
=
'Folder'
)
self
.
assertEqual
(
len
(
folder
),
FRAGMENTED_LENGTH_THRESHOLD
-
1
)
self
.
assertIsInstance
(
folder_dict
[
'_count'
],
Length
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIdTool.py
View file @
47ff58ca
...
...
@@ -33,6 +33,7 @@ import unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
from
MySQLdb
import
ProgrammingError
from
six.moves
import
range
class
TestIdTool
(
ERP5TypeTestCase
):
...
...
@@ -389,14 +390,14 @@ class TestIdTool(ERP5TypeTestCase):
A_LOT_OF_KEY
=
2500
var_id
=
'C-%04d'
for
x
in
x
range
(
A_LOT_OF_KEY
):
for
x
in
range
(
A_LOT_OF_KEY
):
self
.
assertEqual
(
0
,
self
.
id_tool
.
generateNewId
(
id_generator
=
id_generator
,
id_group
=
var_id
%
x
))
# test before update
self
.
assertEqual
(
None
,
sql_generator
.
last_max_id_dict
.
get
(
'A-08'
))
self
.
assertEqual
(
None
,
sql_generator
.
last_max_id_dict
.
get
(
'B-08'
))
for
x
in
x
range
(
A_LOT_OF_KEY
):
for
x
in
range
(
A_LOT_OF_KEY
):
self
.
assertEqual
(
None
,
sql_generator
.
last_max_id_dict
.
get
(
var_id
%
x
))
createZODBPythonScript
(
self
.
portal
.
portal_skins
.
custom
,
...
...
@@ -420,7 +421,7 @@ if new_last_id_group is not None:
# asserts
self
.
assertEqual
(
2
,
sql_generator
.
last_max_id_dict
[
'A-08'
].
value
)
self
.
assertEqual
(
1
,
sql_generator
.
last_max_id_dict
[
'B-08'
].
value
)
for
x
in
x
range
(
A_LOT_OF_KEY
):
for
x
in
range
(
A_LOT_OF_KEY
):
self
.
assertEqual
(
0
,
sql_generator
.
last_max_id_dict
[
var_id
%
x
].
value
)
def
test_decentralised_ZODB_id_generator
(
self
):
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testIdToolUpgrade.py
View file @
47ff58ca
...
...
@@ -34,6 +34,7 @@ from Products.ERP5Type.Globals import PersistentMapping
from
Products.ERP5Type.Utils
import
ScalarMaxConflictResolver
from
BTrees.Length
import
Length
from
BTrees.OOBTree
import
OOBTree
from
six.moves
import
range
class
TestIdToolUpgrade
(
ERP5TypeTestCase
):
...
...
@@ -173,14 +174,14 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
def
_setUpLastMaxIdDict
(
self
,
id_generator_reference
):
def
countup
(
id_generator
,
id_group
,
until
):
for
_
in
x
range
(
until
+
1
):
for
_
in
range
(
until
+
1
):
self
.
id_tool
.
generateNewId
(
id_generator
=
id_generator_reference
,
id_group
=
id_group
)
countup
(
id_generator_reference
,
'A-01'
,
2
)
countup
(
id_generator_reference
,
'B-01'
,
1
)
var_id
=
'C-%04d'
for
x
in
x
range
(
self
.
a_lot_of_key
):
for
x
in
range
(
self
.
a_lot_of_key
):
countup
(
id_generator_reference
,
var_id
%
x
,
0
)
def
_getLastIdDictName
(
self
,
id_generator
):
...
...
@@ -214,7 +215,7 @@ class TestIdToolUpgrade(ERP5TypeTestCase):
last_id_dict
=
self
.
_getLastIdDict
(
id_generator
)
self
.
assertEqual
(
2
,
self
.
_getValueFromLastIdDict
(
last_id_dict
,
'A-01'
))
self
.
assertEqual
(
1
,
self
.
_getValueFromLastIdDict
(
last_id_dict
,
'B-01'
))
for
x
in
x
range
(
self
.
a_lot_of_key
):
for
x
in
range
(
self
.
a_lot_of_key
):
key
=
'C-%04d'
%
x
self
.
assertEqual
(
0
,
self
.
_getValueFromLastIdDict
(
last_id_dict
,
key
))
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testTrashTool.py
View file @
47ff58ca
...
...
@@ -33,6 +33,7 @@ from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from
AccessControl.SecurityManagement
import
newSecurityManager
from
zLOG
import
LOG
from
Products.ERP5Type.tests.Sequence
import
SequenceList
from
six.moves
import
range
class
TestTrashTool
(
ERP5TypeTestCase
):
...
...
@@ -76,7 +77,7 @@ class TestTrashTool(ERP5TypeTestCase):
base_category
=
pc
.
_getOb
(
bc_id
,
None
)
self
.
assertTrue
(
base_category
is
not
None
)
category_list
=
[]
for
_
in
x
range
(
10
):
for
_
in
range
(
10
):
category
=
base_category
.
newContent
(
portal_type
=
'Category'
)
category_list
.
append
(
category
.
getId
())
sequence
.
edit
(
category_id_list
=
category_list
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testWorkflowHistoryList.py
View file @
47ff58ca
...
...
@@ -34,6 +34,7 @@ from Products.ERP5Type.Workflow import WorkflowHistoryList
from
Products.ERP5Type.patches.WorkflowTool
import
\
WorkflowHistoryList
as
LegacyWorkflowHistoryList
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
six.moves
import
range
orig_maybe_rotate
=
DoublyLinkList
.
_maybe_rotate
.
__func__
...
...
@@ -73,7 +74,7 @@ def old(items):
return
whl
COUNT
=
45
EXPECTED
=
range
(
COUNT
)
EXPECTED
=
list
(
range
(
COUNT
)
)
class
TestWorkflowHistoryList
(
TestCase
):
...
...
@@ -101,7 +102,7 @@ class TestWorkflowHistoryList(TestCase):
check
=
check
()
i
=
COUNT
+
1
for
i
in
x
range
(
-
i
,
i
):
for
i
in
range
(
-
i
,
i
):
_
=
check
[
i
]
_
=
check
[
-
50
:
10
]
_
=
check
[:
20
:
3
]
...
...
@@ -129,7 +130,7 @@ class TestWorkflowHistoryList(TestCase):
@
fixed_count_bucket
def
test_01_DoublyLinkList
(
self
):
self
.
checkList
(
new
(
DoublyLinkList
,
range
(
COUNT
)))
self
.
checkList
(
new
(
DoublyLinkList
,
list
(
range
(
COUNT
)))
)
@
fixed_count_bucket
def
test_02_LegacyWorkflowHistoryList
(
self
):
...
...
@@ -159,13 +160,13 @@ class TestWorkflowHistoryList(TestCase):
self
.
assertIs
(
prev
,
whl
.
_prev
)
self
.
assertEqual
(
slots
,
EXPECTED
[
32
:])
whl
+=
x
range
(
3
)
whl
+=
range
(
3
)
self
.
checkClass
(
whl
,
LegacyWorkflowHistoryList
)
whl
+=
x
range
(
2
)
whl
+=
range
(
2
)
self
.
checkClass
(
whl
,
WorkflowHistoryList
)
self
.
abort
()
whl
+=
x
range
(
3
)
whl
+=
range
(
3
)
self
.
checkClass
(
whl
,
LegacyWorkflowHistoryList
)
whl
.
append
(
'foo'
)
whl
.
append
(
'bar'
)
...
...
@@ -186,8 +187,8 @@ class TestWorkflowHistoryList(TestCase):
def
test_04_rotation
(
self
):
self
.
app
.
ddl
=
ddl
=
DoublyLinkList
()
item_size
=
ddl
.
_bucket_size
//
3
for
_
in
x
range
(
3
):
for
_
in
x
range
(
3
):
for
_
in
range
(
3
):
for
_
in
range
(
3
):
ddl
.
append
(
'.'
*
item_size
)
self
.
commit
()
self
.
assertEqual
(
6
,
ddl
.
_tail_count
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/EventModule_getEventDetailedLineList.py
View file @
47ff58ca
from
Products.PythonScripts.standard
import
Object
from
six.moves
import
range
request
=
container
.
REQUEST
portal
=
context
.
getPortalObject
()
state_item_list
=
[
x
[
1
]
for
x
in
portal
.
ERP5Site_getWorkflowStateItemList
(
...
...
@@ -32,7 +33,7 @@ unassigned_dic['ticket_type']=portal.Base_translateString("Unassigned")
#Return index of uid into the list and append if not exists
def
createReturnLine
(
uid
,
list_
):
for
i
in
x
range
(
len
(
list_
)):
for
i
in
range
(
len
(
list_
)):
if
list
[
i
][
'uid'
]
==
uid
:
return
i
new_dic
=
default_dic
.
copy
()
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_crm/SkinTemplateItem/portal_skins/erp5_crm/Ticket_getResourceItemList.py
View file @
47ff58ca
...
...
@@ -39,6 +39,7 @@ getPreferredCategoryChildItemListMethodId.
# It is much simpler if only "empty_category=False" case is handled.
from
Products.ERP5Type.Cache
import
CachingMethod
from
AccessControl
import
getSecurityManager
from
six.moves
import
range
portal
=
context
.
getPortalObject
()
checkPermission
=
portal
.
portal_membership
.
checkPermission
portal_preferences
=
portal
.
portal_preferences
...
...
@@ -67,7 +68,7 @@ def getResourceItemList():
def
getCategoryTitle_
(
category
,
depth
):
result
=
[]
append
=
result
.
append
for
_
in
x
range
(
depth
+
1
):
for
_
in
range
(
depth
+
1
):
append
(
getattr
(
category
,
accessor_id
)())
category
=
category
.
getParentValue
()
return
'/'
.
join
(
result
[::
-
1
])
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_csv_style/SkinTemplateItem/portal_skins/erp5_csv_core/Base_importCsvFile.py
View file @
47ff58ca
from
six.moves
import
range
def
cleanString
(
str
):
clean_item
=
str
if
clean_item
.
find
(
'"'
)
!=
-
1
:
...
...
@@ -51,7 +52,7 @@ for line in iter(import_file.readline, ""):
csv_data_list
=
splitCsvLine
(
line
)
attribute_value_dict
=
dict
([(
csv_property_list
[
x
],
csv_data_list
[
x
])
\
for
x
in
x
range
(
len
(
csv_property_list
))])
for
x
in
range
(
len
(
csv_property_list
))])
method
(
priority
=
4
,
activity
=
"SQLQueue"
).
Base_importCsvLine
(
attribute_value_dict
)
redirect_url
=
'%s?%s'
%
(
context
.
absolute_url
()
+
'/'
+
'view'
,
'portal_status_message=Importing+CSV+file.'
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testDms.py
View file @
47ff58ca
...
...
@@ -72,6 +72,7 @@ from Products.ERP5Type import Permissions
from
DateTime
import
DateTime
from
ZTUtils
import
make_query
import
PyPDF2
from
six.moves
import
range
QUIET
=
0
...
...
@@ -1901,12 +1902,12 @@ document.write('<sc'+'ript type="text/javascript" src="http://somosite.bg/utb.ph
# assume there is no password
credential
=
'%s:'
%
(
getSecurityManager
().
getUser
().
getId
(),)
tested_list
=
[]
frame_list
=
range
(
pages_number
)
frame_list
=
list
(
range
(
pages_number
)
)
# assume that ZServer is configured with 4 Threads
conversion_per_tread
=
pages_number
/
4
while
frame_list
:
local_frame_list
=
[
frame_list
.
pop
()
for
i
in
\
x
range
(
min
(
conversion_per_tread
,
len
(
frame_list
)))]
range
(
min
(
conversion_per_tread
,
len
(
frame_list
)))]
instance
=
ThreadWrappedConverter
(
self
.
publish
,
document
.
getPath
(),
local_frame_list
,
credential
)
tested_list
.
append
(
instance
)
...
...
@@ -1924,7 +1925,7 @@ document.write('<sc'+'ript type="text/javascript" src="http://somosite.bg/utb.ph
'resolution'
:
None
}
result_list
=
[]
for
i
in
x
range
(
pages_number
):
for
i
in
range
(
pages_number
):
# all conversions should succeeded and stored in cache storage
convert_kw
[
'frame'
]
=
i
if
not
document
.
hasConversion
(
**
convert_kw
):
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testERP5WebWithDms.py
View file @
47ff58ca
...
...
@@ -45,6 +45,7 @@ from Products.ERP5Type.tests.utils import FileUpload, createZODBPythonScript
from
erp5.component.document.Document
import
ConversionError
from
PIL
import
Image
from
six.moves
import
range
LANGUAGE_LIST
=
(
'en'
,
'fr'
,
'de'
,
'bg'
,)
IMAGE_COMPARE_TOLERANCE
=
850
...
...
@@ -493,7 +494,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
policy_list
=
self
.
portal
.
caching_policy_manager
.
listPolicies
()
policy
=
[
policy
[
1
]
for
policy
in
policy_list
\
if
policy
[
0
]
==
'unauthenticated no language'
][
0
]
for
i
in
x
range
(
3
):
for
i
in
range
(
3
):
path
=
'/'
.
join
((
website_url
,
reference
,
'img%s.png'
%
i
))
...
...
@@ -668,7 +669,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEquals
(
policy
.
getMaxAgeSecs
(),
1200
)
self
.
assertEquals
(
policy
.
getStaleWhileRevalidateSecs
(),
30
)
self
.
assertEquals
(
policy
.
getStaleIfErrorSecs
(),
600
)
for
i
in
x
range
(
3
):
for
i
in
range
(
3
):
path
=
'/'
.
join
((
website_url
,
reference
,
'img%s.png'
%
i
))
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testWebDavSupport.py
View file @
47ff58ca
...
...
@@ -39,6 +39,7 @@ from six.moves import cStringIO as StringIO
from
DateTime
import
DateTime
from
lxml
import
etree
from
six.moves
import
range
def
makeFilePath
(
name
):
import
Products.ERP5.tests
...
...
@@ -186,7 +187,7 @@ class TestWebDavSupport(ERP5TypeTestCase):
"""
iso_text_content
=
text_content
.
decode
(
'utf-8'
).
encode
(
'iso-8859-1'
)
path
=
web_page_module
.
getPath
()
for
_
in
x
range
(
2
):
# Run twice to check the code that compares
for
_
in
range
(
2
):
# Run twice to check the code that compares
# old & new data when setting file attribute.
response
=
self
.
publish
(
'%s/%s'
%
(
path
,
filename
),
request_method
=
'PUT'
,
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.Subversion.py
View file @
47ff58ca
...
...
@@ -42,6 +42,7 @@ from erp5.component.module.WorkingCopy import \
NotAWorkingCopyError
,
NotVersionedError
,
VcsConflictError
from
erp5.component.module.SubversionClient
import
newSubversionClient
from
six
import
string_types
as
basestring
from
six.moves
import
range
# XXX This does not work with concurrent processes/threads accessing the
# same working copy...
...
...
@@ -390,7 +391,7 @@ class BusinessTemplateWorkingCopy(BusinessTemplateFolder):
prefix_length
=
len
(
os
.
path
.
join
(
'.'
,
''
))
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
'.'
):
dirpath
=
dirpath
[
prefix_length
:]
for
i
in
x
range
(
len
(
dirnames
)
-
1
,
-
1
,
-
1
):
for
i
in
range
(
len
(
dirnames
)
-
1
,
-
1
,
-
1
):
d
=
dirnames
[
i
]
if
d
[
0
]
==
'.'
:
# Ignore hidden directories (in particular '.svn')
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_forge/ModuleComponentTemplateItem/portal_components/module.erp5.WorkingCopy.py
View file @
47ff58ca
...
...
@@ -42,6 +42,7 @@ from ZTUtils import make_query
from
Products.ERP5.Document.BusinessTemplate
import
BusinessTemplateFolder
from
Products.ERP5Type.Utils
import
simple_decorator
from
six
import
string_types
as
basestring
from
six.moves
import
range
@
simple_decorator
def
selfcached
(
func
):
...
...
@@ -406,7 +407,7 @@ class BusinessTemplateWorkingCopy(BusinessTemplateFolder):
prefix_length
=
len
(
os
.
path
.
join
(
self
.
path
,
''
))
for
dirpath
,
dirnames
,
filenames
in
os
.
walk
(
self
.
path
):
dirpath
=
dirpath
[
prefix_length
:]
for
i
in
x
range
(
len
(
dirnames
)
-
1
,
-
1
,
-
1
):
for
i
in
range
(
len
(
dirnames
)
-
1
,
-
1
,
-
1
):
d
=
dirnames
[
i
]
if
d
[
0
]
!=
'.'
:
d
=
os
.
path
.
join
(
dirpath
,
d
)
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_ingestion/ToolComponentTemplateItem/portal_components/tool.erp5.UrlRegistryTool.py
View file @
47ff58ca
...
...
@@ -34,6 +34,7 @@ from Products.ERP5Type import Permissions
from
Acquisition
import
Implicit
from
BTrees.OOBTree
import
OOBTree
from
warnings
import
warn
from
six.moves
import
range
ACTIVITY_GROUPING_COUNT
=
200
...
...
@@ -172,7 +173,7 @@ class UrlRegistryTool(BaseTool):
object_list_len
=
len
(
object_list
)
portal_activities
=
portal
.
portal_activities
object_path_list
=
[
x
.
path
for
x
in
object_list
]
for
i
in
x
range
(
0
,
object_list_len
,
ACTIVITY_GROUPING_COUNT
):
for
i
in
range
(
0
,
object_list_len
,
ACTIVITY_GROUPING_COUNT
):
current_path_list
=
object_path_list
[
i
:
i
+
ACTIVITY_GROUPING_COUNT
]
portal_activities
.
activate
(
activity
=
'SQLQueue'
,
priority
=
3
)
\
.
callMethodOnObjectList
(
current_path_list
,
...
...
This diff is collapsed.
Click to expand it.
bt5/erp5_ingestion_test/TestTemplateItem/portal_components/test.erp5.testLiveIngestion.py
View file @
47ff58ca
...
...
@@ -32,6 +32,7 @@ from Products.ERP5Type.tests.ERP5TypeLiveTestCase import ERP5TypeLiveTestCase
from
Products.CMFCore.utils
import
getToolByName
import
random
import
string
from
six.moves
import
range
# test files' home
FILENAME_REGULAR_EXPRESSION
=
"(?P<reference>[A-Z&é@{]{3,7})-(?P<language>[a-z]{2})-(?P<version>[0-9]{3})"
...
...
@@ -82,7 +83,7 @@ class TestIngestion(ERP5TypeLiveTestCase):
portal
=
self
.
portal
contribution_tool
=
getToolByName
(
portal
,
'portal_contributions'
)
# seed parameter is here to ensure entropy for document id generation
seed
=
''
.
join
([
random
.
choice
(
string
.
ascii_letters
)
for
_
in
x
range
(
20
)])
seed
=
''
.
join
([
random
.
choice
(
string
.
ascii_letters
)
for
_
in
range
(
20
)])
url
=
portal
.
absolute_url
()
url
+=
'/%s?seed=%s'
%
(
script_id
,
seed
)
if
filename
:
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
3
Next
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