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
Labels
Merge Requests
140
Merge Requests
140
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
Jobs
Commits
Open sidebar
nexedi
erp5
Commits
bb7d1071
Commit
bb7d1071
authored
Sep 16, 2022
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: stop using deprecated string functions, that are removed in python 3.
parent
b3039664
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
31 additions
and
35 deletions
+31
-35
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_hashVariationCategoryItemList.py
...skins/erp5_core/Resource_hashVariationCategoryItemList.py
+2
-2
product/ERP5/tests/erp5_url_checker.py
product/ERP5/tests/erp5_url_checker.py
+2
-2
product/ERP5Form/dtml/captchaFieldTales.dtml
product/ERP5Form/dtml/captchaFieldTales.dtml
+1
-1
product/ERP5Form/dtml/proxyFieldEdit.dtml
product/ERP5Form/dtml/proxyFieldEdit.dtml
+1
-1
product/ERP5Form/dtml/proxyFieldTales.dtml
product/ERP5Form/dtml/proxyFieldTales.dtml
+1
-1
product/Formulator/Form.py
product/Formulator/Form.py
+6
-7
product/Formulator/ListTextAreaField.py
product/Formulator/ListTextAreaField.py
+4
-5
product/Formulator/dtml/FieldHelpTopic.dtml
product/Formulator/dtml/FieldHelpTopic.dtml
+1
-1
product/Formulator/dtml/fieldEdit.dtml
product/Formulator/dtml/fieldEdit.dtml
+1
-1
product/Formulator/dtml/fieldOverride.dtml
product/Formulator/dtml/fieldOverride.dtml
+1
-1
product/Formulator/dtml/fieldTales.dtml
product/Formulator/dtml/fieldTales.dtml
+1
-1
product/PortalTransforms/transforms/python.py
product/PortalTransforms/transforms/python.py
+2
-3
product/ZSQLCatalog/SQLCatalog.py
product/ZSQLCatalog/SQLCatalog.py
+1
-2
product/ZSQLCatalog/ZSQLCatalog.py
product/ZSQLCatalog/ZSQLCatalog.py
+7
-7
No files found.
product/ERP5/bootstrap/erp5_core/SkinTemplateItem/portal_skins/erp5_core/Resource_hashVariationCategoryItemList.py
View file @
bb7d1071
...
...
@@ -13,8 +13,8 @@ for item in item_list:
item_value
=
item
[
int
(
not
is_right_display
)]
# Hash key from item_value
item_split
=
string
.
split
(
item_value
,
'/'
)
item_key
=
string
.
join
(
item_split
[:
split_depth
]
,
'/'
)
item_split
=
item_value
.
split
(
'/'
)
item_key
=
'/'
.
join
(
item_split
[:
split_depth
]
,
'/'
)
if
item_key
not
in
sub_field_dict
:
# Create property dict
...
...
product/ERP5/tests/erp5_url_checker.py
View file @
bb7d1071
...
...
@@ -89,7 +89,7 @@ class URLOpener(FancyURLopener):
urltype
,
rest
=
splittype
(
selector
)
url
=
rest
user_passwd
=
None
if
string
.
lower
(
urltype
)
!=
'http'
:
if
urltype
.
lower
(
)
!=
'http'
:
realhost
=
None
else
:
realhost
,
rest
=
splithost
(
rest
)
...
...
@@ -101,7 +101,7 @@ class URLOpener(FancyURLopener):
if
not
host
:
raise
IOError
(
'http error'
,
'no host given'
)
if
user_passwd
:
import
base64
auth
=
string
.
strip
(
base64
.
encodestring
(
user_passwd
)
)
auth
=
base64
.
encodestring
(
user_passwd
).
strip
(
)
else
:
auth
=
None
h
=
httplib
.
HTTP
(
host
)
...
...
product/ERP5Form/dtml/captchaFieldTales.dtml
View file @
bb7d1071
...
...
@@ -20,7 +20,7 @@ This tab can therefore not be used.
<dtml-if fields>
<tr>
<td colspan="3" class="form-title">
<dtml-var
"_.string.capitalize(group)"
> properties
<dtml-var
group capitalize
> properties
</td>
</tr>
...
...
product/ERP5Form/dtml/proxyFieldEdit.dtml
View file @
bb7d1071
...
...
@@ -76,7 +76,7 @@ Surcharge <dtml-var meta_type> properties here.
<dtml-if fields>
<tr>
<td colspan="3" class="form-title">
<dtml-var
"_.string.capitalize(group)"
> properties
<dtml-var
group capitalize
> properties
</td>
</tr>
...
...
product/ERP5Form/dtml/proxyFieldTales.dtml
View file @
bb7d1071
...
...
@@ -78,7 +78,7 @@ This tab can therefore not be used.
<dtml-if fields>
<tr>
<td colspan="3" class="form-title">
<dtml-var
"_.string.capitalize(group)"
> properties
<dtml-var
group capitalize
> properties
</td>
</tr>
...
...
product/Formulator/Form.py
View file @
bb7d1071
...
...
@@ -14,7 +14,6 @@ from OFS.SimpleItem import Item
import
Acquisition
from
six.moves.urllib.parse
import
quote
import
os
import
string
from
six
import
StringIO
from
.Errors
import
ValidationError
,
FormValidationError
,
FieldDisabledError
...
...
@@ -744,7 +743,7 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
fieldname -- the name of the field (meta_type) to add
Result -- empty string
"""
title
=
string
.
strip
(
title
)
title
=
title
.
strip
(
)
if
not
title
:
title
=
id
# title is always required, use id if not provided
# get the field class we want to add
...
...
@@ -786,9 +785,9 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
try
:
result
=
self
.
settings_form
.
validate_all
(
REQUEST
)
except
FormValidationError
as
e
:
message
=
"Validation error(s).<br />"
+
string
.
join
(
message
=
"Validation error(s).<br />"
+
"<br />"
.
join
(
[
"%s: %s"
%
(
error
.
field
.
get_value
(
'title'
),
error
.
error_text
)
for
error
in
e
.
errors
]
,
"<br />"
)
error
.
error_text
)
for
error
in
e
.
errors
])
return
self
.
formSettings
(
self
,
REQUEST
,
manage_tabs_message
=
message
)
# if we need to switch encoding, get xml representation before setting
...
...
@@ -906,7 +905,7 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
field_ids
=
self
.
_get_field_ids
(
group
,
REQUEST
)
if
(
to_group
!=
'Move to:'
and
self
.
move_field_group
(
field_ids
,
group
,
to_group
)):
fields
=
string
.
join
(
field_ids
,
", "
)
fields
=
", "
.
join
(
field_ids
)
message
=
"Fields %s transferred from %s to %s."
%
(
fields
,
group
,
to_group
)
...
...
@@ -920,7 +919,7 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
def
manage_add_group
(
self
,
new_group
,
REQUEST
):
"""Adds a new group.
"""
group
=
string
.
strip
(
new_group
)
group
=
new_group
.
strip
(
)
if
(
group
and
group
!=
'Select group'
and
self
.
add_group
(
group
)):
message
=
"Group %s created."
%
(
group
)
...
...
@@ -947,7 +946,7 @@ class ZMIForm(ObjectManager, PropertyManager, RoleManager, Item, Form):
"""Renames group.
"""
if
'new_name'
in
REQUEST
:
new_name
=
string
.
strip
(
REQUEST
[
'new_name'
]
)
new_name
=
REQUEST
[
'new_name'
].
strip
(
)
if
self
.
rename_group
(
group
,
new_name
):
message
=
"Group %s renamed to %s."
%
(
group
,
new_name
)
else
:
...
...
product/Formulator/ListTextAreaField.py
View file @
bb7d1071
from
__future__
import
absolute_import
import
string
from
.DummyField
import
fields
from
.
import
Widget
,
Validator
from
.Field
import
ZMIField
...
...
@@ -17,7 +16,7 @@ class ListTextAreaWidget(Widget.TextAreaWidget):
for
element_text
,
element_value
in
value
:
lines
.
append
(
"%s | %s"
%
(
element_text
,
element_value
))
return
Widget
.
TextAreaWidget
.
render
(
self
,
field
,
key
,
string
.
join
(
lines
,
'
\
n
'
),
'
\
n
'
.
join
(
lines
),
REQUEST
)
ListTextAreaWidgetInstance
=
ListTextAreaWidget
()
...
...
@@ -30,14 +29,14 @@ class ListLinesValidator(Validator.LinesValidator):
value
=
Validator
.
LinesValidator
.
validate
(
self
,
field
,
key
,
REQUEST
)
result
=
[]
for
line
in
value
:
elements
=
string
.
split
(
line
,
"|"
)
elements
=
line
.
split
(
"|"
)
if
len
(
elements
)
>=
2
:
text
,
value
=
elements
[:
2
]
else
:
text
=
line
value
=
line
text
=
string
.
strip
(
text
)
value
=
string
.
strip
(
value
)
text
=
text
.
strip
(
)
value
=
value
.
strip
(
)
result
.
append
((
text
,
value
))
return
result
...
...
product/Formulator/dtml/FieldHelpTopic.dtml
View file @
bb7d1071
...
...
@@ -3,7 +3,7 @@
<dtml-in get_groups>
<dtml-let group=sequence-item fields="get_fields_in_group(group)">
<dtml-if fields>
<h4><i><dtml-var
"_.string.capitalize(group)"
> properties</i></h4>
<h4><i><dtml-var
group capitalize
> properties</i></h4>
<dtml-in fields>
<dtml-let field=sequence-item>
<b><dtml-var "field.get_value('title')"> (<dtml-var "field.id">)</b>
...
...
product/Formulator/dtml/fieldEdit.dtml
View file @
bb7d1071
...
...
@@ -17,7 +17,7 @@ Edit <dtml-var meta_type> properties here.
<dtml-if fields>
<tr>
<td colspan="4" class="form-title">
<dtml-var
"_.string.capitalize(group)"
> properties
<dtml-var
group capitalize
> properties
</td>
</tr>
...
...
product/Formulator/dtml/fieldOverride.dtml
View file @
bb7d1071
...
...
@@ -14,7 +14,7 @@ Edit <dtml-var meta_type> method overrides here.
<dtml-if fields>
<tr>
<td colspan="3" class="form-title">
<dtml-var
"_.string.capitalize(group)"
> properties
<dtml-var
group capitalize
> properties
</td>
</tr>
...
...
product/Formulator/dtml/fieldTales.dtml
View file @
bb7d1071
...
...
@@ -21,7 +21,7 @@ This tab can therefore not be used.
<dtml-if fields>
<tr>
<td colspan="3" class="form-title">
<dtml-var
"_.string.capitalize(group)"
> properties
<dtml-var
group capitalize
> properties
</td>
</tr>
...
...
product/PortalTransforms/transforms/python.py
View file @
bb7d1071
...
...
@@ -15,7 +15,6 @@ Original code from active state recipe
"""
__revision__
=
'$Id: python.py 3661 2005-02-23 17:05:31Z tiran $'
import
string
import
keyword
,
token
,
tokenize
from
six.moves
import
cStringIO
as
StringIO
...
...
@@ -35,7 +34,7 @@ class Parser:
def
__init__
(
self
,
raw
,
tags
,
out
):
""" Store the source text.
"""
self
.
raw
=
string
.
strip
(
string
.
expandtabs
(
raw
)
)
self
.
raw
=
raw
.
expandtabs
().
strip
(
)
self
.
out
=
out
self
.
tags
=
tags
...
...
@@ -46,7 +45,7 @@ class Parser:
self
.
lines
=
[
0
,
0
]
pos
=
0
while
1
:
pos
=
s
tring
.
find
(
self
.
raw
,
'
\
n
'
,
pos
)
+
1
pos
=
s
elf
.
raw
.
find
(
'
\
n
'
,
pos
)
+
1
if
not
pos
:
break
self
.
lines
.
append
(
pos
)
self
.
lines
.
append
(
len
(
self
.
raw
))
...
...
product/ZSQLCatalog/SQLCatalog.py
View file @
bb7d1071
...
...
@@ -49,7 +49,6 @@ from inspect import CO_VARKEYWORDS
from
functools
import
wraps
import
time
from
six.moves
import
urllib
import
string
import
pprint
import
re
import
warnings
...
...
@@ -1216,7 +1215,7 @@ class Catalog(Folder,
words
=
0
obj
=
REQUEST
.
PARENTS
[
1
]
path
=
string
.
join
(
obj
.
getPhysicalPath
(),
'/'
)
path
=
'/'
.
join
(
obj
.
getPhysicalPath
()
)
results
=
self
.
aq_parent
.
ZopeFindAndApply
(
obj
,
obj_metatypes
=
obj_metatypes
,
...
...
product/ZSQLCatalog/ZSQLCatalog.py
View file @
bb7d1071
...
...
@@ -35,7 +35,7 @@ from AccessControl import ClassSecurityInfo
from
DocumentTemplate.security
import
RestrictedDTML
from
Products.CMFCore.utils
import
getToolByName
from
Products.ERP5Type.Cache
import
clearCache
import
s
tring
,
s
ys
import
sys
import
time
from
ZODB.POSException
import
ConflictError
...
...
@@ -532,7 +532,7 @@ class ZCatalog(Folder, Persistent, Implicit):
def
manage_edit
(
self
,
RESPONSE
,
URL1
,
threshold
=
1000
,
REQUEST
=
None
):
""" edit the catalog """
if
type
(
threshold
)
is
not
type
(
1
):
threshold
=
string
.
atoi
(
threshold
)
threshold
=
int
(
threshold
)
self
.
threshold
=
threshold
RESPONSE
.
redirect
(
URL1
+
'/manage_main?manage_tabs_message=Catalog%20Changed'
)
...
...
@@ -616,7 +616,7 @@ class ZCatalog(Folder, Persistent, Implicit):
words
=
0
obj
=
REQUEST
.
PARENTS
[
1
]
path
=
string
.
join
(
obj
.
getPhysicalPath
(),
'/'
)
path
=
'/'
.
join
(
obj
.
getPhysicalPath
()
)
results
=
self
.
ZopeFindAndApply
(
obj
,
...
...
@@ -1012,7 +1012,7 @@ class ZCatalog(Folder, Persistent, Implicit):
"""
Return the attribute names as a single string
"""
return
string
.
join
(
self
.
names
(
sql_catalog_id
=
sql_catalog_id
).
get
(
column
,
(
''
,)),
' '
)
return
' '
.
join
(
self
.
names
(
sql_catalog_id
=
sql_catalog_id
).
get
(
column
,
(
''
,))
)
def
_searchable_arguments
(
self
,
sql_catalog_id
=
None
):
catalog
=
self
.
getSQLCatalog
(
sql_catalog_id
)
...
...
@@ -1178,7 +1178,7 @@ class ZCatalog(Folder, Persistent, Implicit):
and
(
not
obj_searchterm
or
(
hasattr
(
ob
,
'PrincipiaSearchSource'
)
and
string
.
find
(
ob
.
PrincipiaSearchSource
(),
obj_searchterm
)
>=
0
ob
.
PrincipiaSearchSource
().
find
(
obj_searchterm
)
>=
0
))
and
(
not
obj_expr
or
expr_match
(
ob
,
obj_expr
))
...
...
@@ -1217,7 +1217,7 @@ class ZCatalog(Folder, Persistent, Implicit):
No exceptions are raised.
"""
script
=
REQUEST
.
script
if
string
.
find
(
path
,
script
)
!=
0
:
if
path
.
find
(
script
)
!=
0
:
path
=
'%s/%s'
%
(
script
,
path
)
try
:
return
REQUEST
.
resolve_url
(
path
)
...
...
@@ -1267,7 +1267,7 @@ class ZCatalog(Folder, Persistent, Implicit):
if
ob
is
None
:
removed
.
append
(
path
)
continue
ppath
=
string
.
join
(
ob
.
getPhysicalPath
(),
'/'
)
ppath
=
'/'
.
join
(
ob
.
getPhysicalPath
()
)
if
path
!=
ppath
:
fixed
.
append
((
path
,
ppath
))
else
:
...
...
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