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
7
Merge Requests
7
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Jérome Perrin
erp5
Commits
b59d25a5
Commit
b59d25a5
authored
Feb 13, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web: py3 WIP
parent
4229ba4e
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 @
b59d25a5
...
@@ -1130,7 +1130,7 @@ return True
...
@@ -1130,7 +1130,7 @@ return True
"quoted-printable"
,
"quoted-printable"
,
)
)
self
.
assertEqual
(
htmlmessage
.
get
(
"Content-Location"
),
page
.
absolute_url
())
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
):
def
test_WebPageAsEmbeddedHtml_pageWithLink
(
self
):
"""Test convert one html page with links to embedded html file"""
"""Test convert one html page with links to embedded html file"""
...
@@ -1184,7 +1184,7 @@ return True
...
@@ -1184,7 +1184,7 @@ return True
"quoted-printable"
,
"quoted-printable"
,
)
)
self
.
assertEqual
(
htmlmessage
.
get
(
"Content-Location"
),
page
.
absolute_url
())
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>"
,
"<p>Hello</p>"
,
'<a href="%s//a.a/">aa</a>'
%
self
.
portal
.
absolute_url
().
split
(
"/"
,
1
)[
0
],
'<a href="%s//a.a/">aa</a>'
%
self
.
portal
.
absolute_url
().
split
(
"/"
,
1
)[
0
],
'<a href="%s/b">bb</a>'
%
self
.
portal
.
absolute_url
(),
'<a href="%s/b">bb</a>'
%
self
.
portal
.
absolute_url
(),
...
@@ -1194,7 +1194,7 @@ return True
...
@@ -1194,7 +1194,7 @@ return True
message
=
EmailParser
().
parsestr
(
mhtml_data
)
message
=
EmailParser
().
parsestr
(
mhtml_data
)
htmlmessage
,
=
message
.
get_payload
()
htmlmessage
,
=
message
.
get_payload
()
self
.
assertEqual
(
htmlmessage
.
get
(
"Content-Location"
),
"https://hel.lo/world"
)
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>"
,
"<p>Hello</p>"
,
'<a href="https://a.a/">aa</a>'
,
'<a href="https://a.a/">aa</a>'
,
'<a href="https://hel.lo/b">bb</a>'
,
'<a href="https://hel.lo/b">bb</a>'
,
...
@@ -1233,7 +1233,7 @@ return True
...
@@ -1233,7 +1233,7 @@ return True
"quoted-printable"
,
"quoted-printable"
,
)
)
self
.
assertEqual
(
htmlmessage
.
get
(
"Content-Location"
),
page
.
absolute_url
())
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
):
def
test_WebPageAsEmbeddedHtml_pageWithMoreThanOneImage
(
self
):
"""Test convert one html page with images to embedded html file"""
"""Test convert one html page with images to embedded html file"""
...
@@ -1285,7 +1285,7 @@ return True
...
@@ -1285,7 +1285,7 @@ return True
message
=
EmailParser
().
parsestr
(
mhtml_data
)
message
=
EmailParser
().
parsestr
(
mhtml_data
)
htmlmessage
,
svgmessage
,
pngmessage
,
svgtopngmessage
=
message
.
get_payload
()
htmlmessage
,
svgmessage
,
pngmessage
,
svgtopngmessage
=
message
.
get_payload
()
self
.
assertEqual
(
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
()),
quopri
.
decodestring
(
htmlmessage
.
get_payload
())
.
decode
()
,
""
.
join
([
""
.
join
([
"<p>Hello</p>"
,
"<p>Hello</p>"
,
'<img src="%s?format=" />'
%
svg
.
absolute_url
(),
'<img src="%s?format=" />'
%
svg
.
absolute_url
(),
...
@@ -1402,7 +1402,7 @@ return True
...
@@ -1402,7 +1402,7 @@ return True
self
.
assertEqual
(
len
(
message
.
get_payload
()),
7
)
self
.
assertEqual
(
len
(
message
.
get_payload
()),
7
)
htmlmessage
=
message
.
get_payload
()[
0
]
htmlmessage
=
message
.
get_payload
()[
0
]
self
.
assertEqual
(
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
()),
quopri
.
decodestring
(
htmlmessage
.
get_payload
())
.
decode
()
,
""
.
join
([
""
.
join
([
"<p>Hello</p>"
,
"<p>Hello</p>"
,
'<img src="%s/%s?format=" />'
%
(
page
.
absolute_url
(),
svg
.
getRelativeUrl
()),
'<img src="%s/%s?format=" />'
%
(
page
.
absolute_url
(),
svg
.
getRelativeUrl
()),
...
@@ -1546,7 +1546,7 @@ return True
...
@@ -1546,7 +1546,7 @@ return True
message
=
EmailParser
().
parsestr
(
mhtml_data
)
message
=
EmailParser
().
parsestr
(
mhtml_data
)
htmlmessage
,
imagemessage
=
message
.
get_payload
()
htmlmessage
,
imagemessage
=
message
.
get_payload
()
self
.
assertEqual
(
self
.
assertEqual
(
quopri
.
decodestring
(
htmlmessage
.
get_payload
()),
quopri
.
decodestring
(
htmlmessage
.
get_payload
())
.
decode
()
,
"<style>%s</style><p>Hello</p>"
%
(
"<style>%s</style><p>Hello</p>"
%
(
"body { background-image: url(%s?format=); }"
%
(
"body { background-image: url(%s?format=); }"
%
(
img
.
absolute_url
())),
img
.
absolute_url
())),
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_convertHtmlToSingleFile.py
View file @
b59d25a5
...
@@ -270,7 +270,7 @@ def handleLinkedData(mime, data, href):
...
@@ -270,7 +270,7 @@ def handleLinkedData(mime, data, href):
"mime_type"
:
mime
,
"mime_type"
:
mime
,
"encode"
:
"quoted-printable"
if
mime
.
startswith
(
"text/"
)
else
None
,
"encode"
:
"quoted-printable"
if
mime
.
startswith
(
"text/"
)
else
None
,
"add_header_list"
:
[(
"Content-Location"
,
url
)],
"add_header_list"
:
[(
"Content-Location"
,
url
)],
"data"
:
str
(
data
),
"data"
:
bytes
(
data
),
})
})
return
url
return
url
else
:
else
:
...
@@ -335,7 +335,7 @@ def replaceFromDataUri(data_uri, replacer):
...
@@ -335,7 +335,7 @@ def replaceFromDataUri(data_uri, replacer):
data
=
b64decode
(
data
)
data
=
b64decode
(
data
)
if
not
is_base64
:
if
not
is_base64
:
data
=
replacer
(
data
)
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
):
def
extractUrlSearch
(
url
):
url
=
url
.
split
(
"#"
,
1
)[
0
].
split
(
"?"
,
1
)
url
=
url
.
split
(
"#"
,
1
)[
0
].
split
(
"?"
,
1
)
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_formatAttachmentListToMIMEMultipartString.py
View file @
b59d25a5
...
@@ -80,7 +80,7 @@ def encode_quopri(msg):
...
@@ -80,7 +80,7 @@ def encode_quopri(msg):
when necessary.
when necessary.
"""
"""
orig
=
msg
.
get_payload
()
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
.
set_payload
(
encdata
)
msg
.
add_header
(
"Content-Transfer-Encoding"
,
"quoted-printable"
)
msg
.
add_header
(
"Content-Transfer-Encoding"
,
"quoted-printable"
)
...
...
bt5/erp5_web_renderjs_ui_test/TestTemplateItem/portal_components/test.erp5.testRJSPortalType.py
View file @
b59d25a5
...
@@ -42,7 +42,7 @@ class TestRenderJSPortalType(ERP5TypeTestCase):
...
@@ -42,7 +42,7 @@ class TestRenderJSPortalType(ERP5TypeTestCase):
portal_type
=
'Web Style'
,
portal_type
=
'Web Style'
,
reference
=
'test_web_style.css'
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
()
web_style
.
publish
()
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
'text/css'
,
web_style
.
getContentType
())
self
.
assertEqual
(
'text/css'
,
web_style
.
getContentType
())
...
@@ -52,7 +52,7 @@ class TestRenderJSPortalType(ERP5TypeTestCase):
...
@@ -52,7 +52,7 @@ class TestRenderJSPortalType(ERP5TypeTestCase):
'%s/%s'
%
(
self
.
web_site
.
getPath
(),
web_style
.
getReference
())
'%s/%s'
%
(
self
.
web_site
.
getPath
(),
web_style
.
getReference
())
)
)
self
.
assertEqual
(
self
.
assertEqual
(
'/* cl
\
xc3
\
xa0
sse */ .classe { background: red }'
,
b
'/* cl
\
xc3
\
xa0
sse */ .classe { background: red }'
,
response
.
getBody
()
response
.
getBody
()
)
)
self
.
assertEqual
(
self
.
assertEqual
(
...
@@ -65,7 +65,7 @@ class TestRenderJSPortalType(ERP5TypeTestCase):
...
@@ -65,7 +65,7 @@ class TestRenderJSPortalType(ERP5TypeTestCase):
portal_type
=
'Web Script'
,
portal_type
=
'Web Script'
,
reference
=
'test_web_script.js'
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
()
web_script
.
publish
()
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
'application/javascript'
,
web_script
.
getContentType
())
self
.
assertEqual
(
'application/javascript'
,
web_script
.
getContentType
())
...
@@ -75,7 +75,7 @@ class TestRenderJSPortalType(ERP5TypeTestCase):
...
@@ -75,7 +75,7 @@ class TestRenderJSPortalType(ERP5TypeTestCase):
'%s/%s'
%
(
self
.
web_site
.
getPath
(),
web_script
.
getReference
())
'%s/%s'
%
(
self
.
web_site
.
getPath
(),
web_script
.
getReference
())
)
)
self
.
assertEqual
(
self
.
assertEqual
(
'alert("h
\
xc3
\
xa9
h
\
xc3
\
xa9
")'
,
b
'alert("h
\
xc3
\
xa9
h
\
xc3
\
xa9
")'
,
response
.
getBody
()
response
.
getBody
()
)
)
self
.
assertEqual
(
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