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
142
Merge Requests
142
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
f2d7a90b
Commit
f2d7a90b
authored
Feb 13, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web: py3 WIP
parent
8848e31c
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
14 deletions
+14
-14
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testERP5WebWithDms.py
...ateItem/portal_components/test.erp5.testERP5WebWithDms.py
+7
-7
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_convertHtmlToSingleFile.py
...tem/portal_skins/erp5_web/Base_convertHtmlToSingleFile.py
+2
-2
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_formatAttachmentListToMIMEMultipartString.py
...rp5_web/Base_formatAttachmentListToMIMEMultipartString.py
+1
-1
bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testRJSPortalType.py
...lateItem/portal_components/test.erp5.testRJSPortalType.py
+4
-4
No files found.
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testERP5WebWithDms.py
View file @
f2d7a90b
...
...
@@ -1130,7 +1130,7 @@ return True
"quoted-printable"
,
)
self
.
assertEqual
(
htmlmessage
.
get
(
"Content-Location"
),
page
.
absolute_url
())
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
()),
html_data
)
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
())
.
decode
()
,
html_data
)
def
test_WebPageAsEmbeddedHtml_pageWithLink
(
self
):
"""Test convert one html page with links to embedded html file"""
...
...
@@ -1184,7 +1184,7 @@ return True
"quoted-printable"
,
)
self
.
assertEqual
(
htmlmessage
.
get
(
"Content-Location"
),
page
.
absolute_url
())
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
()),
""
.
join
([
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
())
.
decode
()
,
""
.
join
([
"<p>Hello</p>"
,
'<a href="%s//a.a/">aa</a>'
%
self
.
portal
.
absolute_url
().
split
(
"/"
,
1
)[
0
],
'<a href="%s/b">bb</a>'
%
self
.
portal
.
absolute_url
(),
...
...
@@ -1194,7 +1194,7 @@ return True
message
=
EmailParser
().
parsestr
(
mhtml_data
)
htmlmessage
,
=
message
.
get_payload
()
self
.
assertEqual
(
htmlmessage
.
get
(
"Content-Location"
),
"https://hel.lo/world"
)
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
()),
""
.
join
([
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
())
.
decode
()
,
""
.
join
([
"<p>Hello</p>"
,
'<a href="https://a.a/">aa</a>'
,
'<a href="https://hel.lo/b">bb</a>'
,
...
...
@@ -1233,7 +1233,7 @@ return True
"quoted-printable"
,
)
self
.
assertEqual
(
htmlmessage
.
get
(
"Content-Location"
),
page
.
absolute_url
())
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
()),
"<p>World</p>"
)
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
())
.
decode
()
,
"<p>World</p>"
)
def
test_WebPageAsEmbeddedHtml_pageWithMoreThanOneImage
(
self
):
"""Test convert one html page with images to embedded html file"""
...
...
@@ -1285,7 +1285,7 @@ return True
message
=
EmailParser
().
parsestr
(
mhtml_data
)
htmlmessage
,
svgmessage
,
pngmessage
,
svgtopngmessage
=
message
.
get_payload
()
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
()),
quopri
.
decodestring
(
htmlmessage
.
get_payload
())
.
decode
()
,
""
.
join
([
"<p>Hello</p>"
,
'<img src="%s?format=" />'
%
svg
.
absolute_url
(),
...
...
@@ -1402,7 +1402,7 @@ return True
self
.
assertEqual
(
len
(
message
.
get_payload
()),
7
)
htmlmessage
=
message
.
get_payload
()[
0
]
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
()),
quopri
.
decodestring
(
htmlmessage
.
get_payload
())
.
decode
()
,
""
.
join
([
"<p>Hello</p>"
,
'<img src="%s/%s?format=" />'
%
(
page
.
absolute_url
(),
svg
.
getRelativeUrl
()),
...
...
@@ -1546,7 +1546,7 @@ return True
message
=
EmailParser
().
parsestr
(
mhtml_data
)
htmlmessage
,
imagemessage
=
message
.
get_payload
()
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
()),
quopri
.
decodestring
(
htmlmessage
.
get_payload
())
.
decode
()
,
"<style>%s</style><p>Hello</p>"
%
(
"body { background-image: url(%s?format=); }"
%
(
img
.
absolute_url
())),
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_convertHtmlToSingleFile.py
View file @
f2d7a90b
...
...
@@ -270,7 +270,7 @@ def handleLinkedData(mime, data, href):
"mime_type"
:
mime
,
"encode"
:
"quoted-printable"
if
mime
.
startswith
(
"text/"
)
else
None
,
"add_header_list"
:
[(
"Content-Location"
,
url
)],
"data"
:
str
(
data
),
"data"
:
bytes
(
data
),
})
return
url
else
:
...
...
@@ -335,7 +335,7 @@ def replaceFromDataUri(data_uri, replacer):
data
=
b64decode
(
data
)
if
not
is_base64
:
data
=
replacer
(
data
)
return
"%s,%s"
%
(
header
,
b64encode
(
data
)
if
is_base64
else
data
)
return
"%s,%s"
%
(
header
,
b64encode
(
data
)
.
decode
()
if
is_base64
else
data
)
def
extractUrlSearch
(
url
):
url
=
url
.
split
(
"#"
,
1
)[
0
].
split
(
"?"
,
1
)
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_formatAttachmentListToMIMEMultipartString.py
View file @
f2d7a90b
...
...
@@ -80,7 +80,7 @@ def encode_quopri(msg):
when necessary.
"""
orig
=
msg
.
get_payload
()
encdata
=
quopri
.
encodestring
(
orig
.
encode
()).
replace
(
"=
\
n
"
,
"=
\
r
\
n
"
)
encdata
=
quopri
.
encodestring
(
orig
.
encode
()).
replace
(
b"=
\
n
"
,
b
"=
\
r
\
n
"
)
msg
.
set_payload
(
encdata
)
msg
.
add_header
(
"Content-Transfer-Encoding"
,
"quoted-printable"
)
...
...
bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testRJSPortalType.py
View file @
f2d7a90b
...
...
@@ -42,7 +42,7 @@ class TestRenderJSPortalType(ERP5TypeTestCase):
portal_type
=
'Web Style'
,
reference
=
'test_web_style.css'
)
web_style
.
setTextContent
(
'/* cl
\
xc3
\
xa0
sse */ .classe { background: red }'
)
web_style
.
setTextContent
(
b'/* cl
\
xc3
\
xa0
sse */ .classe { background: red }'
.
decode
(
'utf-8'
)
)
web_style
.
publish
()
self
.
tic
()
self
.
assertEqual
(
'text/css'
,
web_style
.
getContentType
())
...
...
@@ -52,7 +52,7 @@ class TestRenderJSPortalType(ERP5TypeTestCase):
'%s/%s'
%
(
self
.
web_site
.
getPath
(),
web_style
.
getReference
())
)
self
.
assertEqual
(
'/* cl
\
xc3
\
xa0
sse */ .classe { background: red }'
,
b
'/* cl
\
xc3
\
xa0
sse */ .classe { background: red }'
,
response
.
getBody
()
)
self
.
assertEqual
(
...
...
@@ -65,7 +65,7 @@ class TestRenderJSPortalType(ERP5TypeTestCase):
portal_type
=
'Web Script'
,
reference
=
'test_web_script.js'
)
web_script
.
setTextContent
(
'alert("h
\
xc3
\
xa9
h
\
xc3
\
xa9
")'
)
web_script
.
setTextContent
(
b'alert("h
\
xc3
\
xa9
h
\
xc3
\
xa9
")'
.
decode
(
'utf-8'
)
)
web_script
.
publish
()
self
.
tic
()
self
.
assertEqual
(
'application/javascript'
,
web_script
.
getContentType
())
...
...
@@ -75,7 +75,7 @@ class TestRenderJSPortalType(ERP5TypeTestCase):
'%s/%s'
%
(
self
.
web_site
.
getPath
(),
web_script
.
getReference
())
)
self
.
assertEqual
(
'alert("h
\
xc3
\
xa9
h
\
xc3
\
xa9
")'
,
b
'alert("h
\
xc3
\
xa9
h
\
xc3
\
xa9
")'
,
response
.
getBody
()
)
self
.
assertEqual
(
...
...
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