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
139
Merge Requests
139
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
1a6a040f
Commit
1a6a040f
authored
Jun 08, 2024
by
Jérome Perrin
Committed by
Arnaud Fontaine
Jul 31, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
py3: fix return type of DummyMailHostMixin.getMessageList
mail body is str
parent
63454724
Pipeline
#36756
running with stage
in 0 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
10 deletions
+12
-10
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testPasswordTool.py
...plateItem/portal_components/test.erp5.testPasswordTool.py
+1
-1
bt5/erp5_web_renderjs_ui_test/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui_test/MailHost_redirectPageToURLFromLastMessage.py
...erjs_ui_test/MailHost_redirectPageToURLFromLastMessage.py
+1
-4
product/ERP5Type/tests/utils.py
product/ERP5Type/tests/utils.py
+10
-5
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testPasswordTool.py
View file @
1a6a040f
...
@@ -125,7 +125,7 @@ class TestPasswordTool(ERP5TypeTestCase):
...
@@ -125,7 +125,7 @@ class TestPasswordTool(ERP5TypeTestCase):
self
.
assertEqual
([
'userA@example.invalid'
],
mto
)
self
.
assertEqual
([
'userA@example.invalid'
],
mto
)
reset_key
,
=
list
(
six
.
iterkeys
(
self
.
portal
.
portal_password
.
_password_request_dict
))
reset_key
,
=
list
(
six
.
iterkeys
(
self
.
portal
.
portal_password
.
_password_request_dict
))
self
.
assertIn
(
self
.
assertIn
(
(
'PasswordTool_viewResetPassword?reset_key='
+
reset_key
)
.
encode
()
,
(
'PasswordTool_viewResetPassword?reset_key='
+
reset_key
),
mbody
)
mbody
)
ret
=
self
.
portal
.
portal_password
.
changeUserPassword
(
ret
=
self
.
portal
.
portal_password
.
changeUserPassword
(
...
...
bt5/erp5_web_renderjs_ui_test/SkinTemplateItem/portal_skins/erp5_web_renderjs_ui_test/MailHost_redirectPageToURLFromLastMessage.py
View file @
1a6a040f
import
re
import
re
from
Products.ERP5Type.Utils
import
bytes2str
last_message_text
=
context
.
getMessageList
()[
-
1
][
2
]
last_message_text
=
bytes2str
(
context
.
getMessageList
()[
-
1
][
2
])
__traceback_info__
=
last_message_text
return
container
.
REQUEST
.
RESPONSE
.
redirect
(
re
.
findall
(
r"http.*"
,
last_message_text
)[
0
])
return
container
.
REQUEST
.
RESPONSE
.
redirect
(
re
.
findall
(
r"http.*"
,
last_message_text
)[
0
])
product/ERP5Type/tests/utils.py
View file @
1a6a040f
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
"""
"""
import
contextlib
import
contextlib
from
datetime
import
datetime
from
datetime
import
datetime
import
email
import
errno
import
errno
import
os
import
os
import
logging
import
logging
...
@@ -49,7 +50,6 @@ from Zope2.Startup.datatypes import ZopeDatabase
...
@@ -49,7 +50,6 @@ from Zope2.Startup.datatypes import ZopeDatabase
from
Testing
import
ZopeTestCase
from
Testing
import
ZopeTestCase
import
Products.ERP5Type
import
Products.ERP5Type
from
Products.MailHost.MailHost
import
MailHost
from
Products.MailHost.MailHost
import
MailHost
from
email
import
message_from_string
from
Products.ERP5Type.Globals
import
PersistentMapping
from
Products.ERP5Type.Globals
import
PersistentMapping
from
Products.ERP5Type.Utils
import
simple_decorator
from
Products.ERP5Type.Utils
import
simple_decorator
from
Products.ZSQLCatalog.SQLCatalog
import
Catalog
from
Products.ZSQLCatalog.SQLCatalog
import
Catalog
...
@@ -106,14 +106,19 @@ class DummyMailHostMixin(object):
...
@@ -106,14 +106,19 @@ class DummyMailHostMixin(object):
@
staticmethod
@
staticmethod
def
_decodeMessage
(
messageText
):
def
_decodeMessage
(
messageText
):
# type: (bytes) -> str
""" Decode message"""
""" Decode message"""
if
six
.
PY3
and
isinstance
(
messageText
,
bytes
):
if
six
.
PY3
:
messageText
=
messageText
.
decode
()
message
=
email
.
message_from_bytes
(
messageText
)
else
:
message
=
email
.
message_from_string
(
messageText
)
message_text
=
messageText
message_text
=
messageText
for
part
in
message
_from_string
(
messageText
)
.
walk
():
for
part
in
message
.
walk
():
if
part
.
get_content_type
()
in
[
'text/plain'
,
'text/html'
]
\
if
part
.
get_content_type
()
in
[
'text/plain'
,
'text/html'
]
\
and
not
part
.
is_multipart
():
and
not
part
.
is_multipart
():
message_text
=
part
.
get_payload
(
decode
=
1
)
message_text
=
part
.
get_payload
(
decode
=
True
)
if
six
.
PY3
:
message_text
=
message_text
.
decode
(
part
.
get_content_charset
(
'ascii'
))
return
message_text
return
message_text
security
.
declarePrivate
(
'getMessageList'
)
security
.
declarePrivate
(
'getMessageList'
)
...
...
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