Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5_fork
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
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
Eteri
erp5_fork
Commits
545a7c20
Commit
545a7c20
authored
Sep 30, 2022
by
Kazuhiko Shiozaki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py2/py3: stop using deprecated urllib.split* functions.
parent
d1a6a688
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
16 deletions
+18
-16
product/ERP5/Tool/TemplateTool.py
product/ERP5/Tool/TemplateTool.py
+7
-6
product/ERP5Type/tests/ERP5TypeTestCase.py
product/ERP5Type/tests/ERP5TypeTestCase.py
+11
-10
No files found.
product/ERP5/Tool/TemplateTool.py
View file @
545a7c20
...
@@ -55,10 +55,7 @@ from Products.ERP5 import _dtmldir
...
@@ -55,10 +55,7 @@ from Products.ERP5 import _dtmldir
from
six.moves
import
xrange
from
six.moves
import
xrange
from
six.moves
import
cStringIO
as
StringIO
from
six.moves
import
cStringIO
as
StringIO
from
six.moves.urllib.request
import
pathname2url
,
urlopen
,
urlretrieve
from
six.moves.urllib.request
import
pathname2url
,
urlopen
,
urlretrieve
try
:
from
six.moves.urllib.parse
import
urlparse
from
urllib
import
splittype
except
ImportError
:
# six.PY3
from
urllib.parse
import
splittype
from
six.moves
import
urllib
from
six.moves
import
urllib
import
re
import
re
from
xml.dom.minidom
import
parse
from
xml.dom.minidom
import
parse
...
@@ -385,7 +382,9 @@ class TemplateTool (BaseTool):
...
@@ -385,7 +382,9 @@ class TemplateTool (BaseTool):
if id is None:
if id is None:
id = self.generateNewId()
id = self.generateNewId()
urltype, path = splittype(url)
parsed_url = urlparse(url)
urltype = parsed_url.scheme
path = parsed_url.path
if WIN and urltype and '
\\
' in path:
if WIN and urltype and '
\\
' in path:
urltype = None
urltype = None
path = url
path = url
...
@@ -625,7 +624,9 @@ class TemplateTool (BaseTool):
...
@@ -625,7 +624,9 @@ class TemplateTool (BaseTool):
#LOG('
updateRepositoryBusiessTemplateList
', 0,
#LOG('
updateRepositoryBusiessTemplateList
', 0,
# '
repository_list
=
%
r' % (repository_list,))
# '
repository_list
=
%
r' % (repository_list,))
for repository in repository_list:
for repository in repository_list:
urltype, url = splittype(repository)
parsed_url = urlparse(url)
urltype = parsed_url.scheme
path = parsed_url.path
if WIN and urltype and '
\\
' in url:
if WIN and urltype and '
\\
' in url:
urltype = None
urltype = None
url = repository
url = repository
...
...
product/ERP5Type/tests/ERP5TypeTestCase.py
View file @
545a7c20
...
@@ -61,7 +61,7 @@ from Products.PythonScripts.PythonScript import PythonScript
...
@@ -61,7 +61,7 @@ from Products.PythonScripts.PythonScript import PythonScript
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
from
Products.ERP5Type.Accessor.Constant
import
PropertyGetter
as
ConstantGetter
from
Products.ERP5Form.PreferenceTool
import
Priority
from
Products.ERP5Form.PreferenceTool
import
Priority
from
zLOG
import
LOG
,
DEBUG
from
zLOG
import
LOG
,
DEBUG
from
Products.ERP5Type.Utils
import
convertToUpperCase
from
Products.ERP5Type.Utils
import
convertToUpperCase
,
str2bytes
from
Products.ERP5Type.tests.backportUnittest
import
SetupSiteError
from
Products.ERP5Type.tests.backportUnittest
import
SetupSiteError
from
Products.ERP5Type.tests.utils
import
addUserToDeveloperRole
from
Products.ERP5Type.tests.utils
import
addUserToDeveloperRole
from
Products.ERP5Type.tests.utils
import
parseListeningAddress
from
Products.ERP5Type.tests.utils
import
parseListeningAddress
...
@@ -590,17 +590,18 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
...
@@ -590,17 +590,18 @@ class ERP5TypeTestCaseMixin(ProcessingNodeTestCase, PortalTestCase):
bt5_path_list
+=
[
os
.
path
.
join
(
path
,
"*"
)
for
path
in
bt5_path_list
]
bt5_path_list
+=
[
os
.
path
.
join
(
path
,
"*"
)
for
path
in
bt5_path_list
]
def
search
(
path
,
template
):
def
search
(
path
,
template
):
urltype
,
url
=
urllib
.
splittype
(
path
+
'/'
+
template
)
parsed_url
=
six
.
moves
.
urllib
.
parse
.
urlparse
(
path
+
'/'
+
template
)
if
urltype
==
'http'
:
if
parsed_url
.
scheme
==
'http'
:
host
,
selector
=
urllib
.
splithost
(
url
)
user
=
parsed_url
.
username
user_passwd
,
host
=
urllib
.
splituser
(
host
)
password
=
parsed_url
.
password
host
=
urllib
.
unquote
(
host
)
host
=
parsed_url
.
hostname
h
=
httplib
.
HTTP
(
host
)
selector
=
parsed_url
.
path
h
=
http_client
.
HTTP
(
host
)
h
.
putrequest
(
'HEAD'
,
selector
)
h
.
putrequest
(
'HEAD'
,
selector
)
h
.
putheader
(
'Host'
,
host
)
h
.
putheader
(
'Host'
,
host
)
if
user
_
passwd
:
if
user
and
passwd
:
h
.
putheader
(
'Authorization'
,
h
.
putheader
(
'Authorization'
,
'Basic %s'
%
base64
.
b64encode
(
user_passwd
).
strip
())
'Basic %s'
%
base64
.
b64encode
(
str2bytes
(
'%s:%s'
%
(
user
,
passwd
))
).
strip
())
h
.
endheaders
()
h
.
endheaders
()
errcode
,
errmsg
,
headers
=
h
.
getreply
()
errcode
,
errmsg
,
headers
=
h
.
getreply
()
if
errcode
==
200
:
if
errcode
==
200
:
...
@@ -1313,7 +1314,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
...
@@ -1313,7 +1314,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
sql
=
kw
.
get
(
'erp5_sql_connection_string'
)
sql
=
kw
.
get
(
'erp5_sql_connection_string'
)
if
sql
:
if
sql
:
app
[
portal_name
].
_setProperty
(
'erp5_site_global_id'
,
app
[
portal_name
].
_setProperty
(
'erp5_site_global_id'
,
base64
.
standard_b64encode
(
s
ql
))
base64
.
standard_b64encode
(
s
tr2bytes
(
sql
)
))
if
not
quiet
:
if
not
quiet
:
ZopeTestCase
.
_print
(
'done (%.3fs)
\
n
'
%
(
time
.
time
()
-
_start
))
ZopeTestCase
.
_print
(
'done (%.3fs)
\
n
'
%
(
time
.
time
()
-
_start
))
# Release locks
# Release locks
...
...
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