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
7792bd1e
Commit
7792bd1e
authored
Feb 07, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web: py3
parent
8f034842
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
13 deletions
+29
-13
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testERP5WebWithDms.py
...ateItem/portal_components/test.erp5.testERP5WebWithDms.py
+4
-4
bt5/erp5_web/ExtensionTemplateItem/portal_components/extension.erp5.WebUtility.py
...mplateItem/portal_components/extension.erp5.WebUtility.py
+3
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_convertHtmlToSingleFile.py
...tem/portal_skins/erp5_web/Base_convertHtmlToSingleFile.py
+11
-5
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_formatAttachmentListToMIMEMultipartString.py
...rp5_web/Base_formatAttachmentListToMIMEMultipartString.py
+1
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_isPublicConvertionResult.py
...em/portal_skins/erp5_web/Base_isPublicConvertionResult.py
+9
-1
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Document_getSummaryAsHTML.zpt
...ins/erp5_web_widget_library/Document_getSummaryAsHTML.zpt
+1
-1
No files found.
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testERP5WebWithDms.py
View file @
7792bd1e
...
@@ -1257,8 +1257,8 @@ return True
...
@@ -1257,8 +1257,8 @@ return True
ehtml_data
=
page
.
WebPage_exportAsSingleFile
(
format
=
"embedded_html"
)
ehtml_data
=
page
.
WebPage_exportAsSingleFile
(
format
=
"embedded_html"
)
self
.
assertTrue
(
ehtml_data
.
startswith
(
""
.
join
([
self
.
assertTrue
(
ehtml_data
.
startswith
(
""
.
join
([
"<p>Hello</p>"
,
"<p>Hello</p>"
,
'<img src="data:image/svg+xml;base64,%s" />'
%
b64encode
(
XSMALL_SVG_IMAGE_ICON_DATA
),
'<img src="data:image/svg+xml;base64,%s" />'
%
b64encode
(
XSMALL_SVG_IMAGE_ICON_DATA
)
.
decode
()
,
'<img src="data:image/png;base64,%s" />'
%
b64encode
(
XSMALL_PNG_IMAGE_ICON_DATA
),
'<img src="data:image/png;base64,%s" />'
%
b64encode
(
XSMALL_PNG_IMAGE_ICON_DATA
)
.
decode
()
,
'<img src="data:image/png;base64,'
'<img src="data:image/png;base64,'
])))
])))
...
@@ -1359,7 +1359,7 @@ return True
...
@@ -1359,7 +1359,7 @@ return True
self
.
assertEqual
(
ehtml_data
,
""
.
join
([
self
.
assertEqual
(
ehtml_data
,
""
.
join
([
"<p>Hello</p>"
,
"<p>Hello</p>"
,
]
+
([
]
+
([
'<img src="data:image/svg+xml;base64,%s" />'
%
b64encode
(
XSMALL_SVG_IMAGE_ICON_DATA
),
'<img src="data:image/svg+xml;base64,%s" />'
%
b64encode
(
XSMALL_SVG_IMAGE_ICON_DATA
)
.
decode
()
,
]
*
6
)
+
[
]
*
6
)
+
[
'<img src="%s//example.com/%s?format=" />'
%
(
protocol
,
svg
.
getRelativeUrl
()),
'<img src="%s//example.com/%s?format=" />'
%
(
protocol
,
svg
.
getRelativeUrl
()),
'<img src="http://example.com/%s?format=" />'
%
svg
.
getRelativeUrl
(),
'<img src="http://example.com/%s?format=" />'
%
svg
.
getRelativeUrl
(),
...
@@ -1524,7 +1524,7 @@ return True
...
@@ -1524,7 +1524,7 @@ return True
ehtml_data
,
ehtml_data
,
"<style>%s</style><p>Hello</p>"
%
(
"<style>%s</style><p>Hello</p>"
%
(
'body { background-image: url(data:image/svg+xml;base64,%s); }'
%
(
'body { background-image: url(data:image/svg+xml;base64,%s); }'
%
(
b64encode
(
XSMALL_SVG_IMAGE_ICON_DATA
))),
b64encode
(
XSMALL_SVG_IMAGE_ICON_DATA
)
.
decode
()
)),
)
)
def
test_WebPageAsMhtml_pageWithStyle
(
self
):
def
test_WebPageAsMhtml_pageWithStyle
(
self
):
...
...
bt5/erp5_web/ExtensionTemplateItem/portal_components/extension.erp5.WebUtility.py
View file @
7792bd1e
...
@@ -134,10 +134,12 @@ def parseCssForUrl(text):
...
@@ -134,10 +134,12 @@ def parseCssForUrl(text):
result.append(("data", data))
result.append(("data", data))
return result
return result
# pylint:disable=no-name-in-module
if six.PY2:
if six.PY2:
def unescape(self, html):
def unescape(self, html):
return HTMLParser().unescape(html)
return HTMLParser().unescape(html)
else:
else:
from html import unescape as html_unescape
from html import unescape as html_unescape
def unescape(self, html):
def unescape(self, html):
return html_unescape(self, html)
return html_unescape(html)
# pylint:enable=no-name-in-module
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_convertHtmlToSingleFile.py
View file @
7792bd1e
...
@@ -41,6 +41,7 @@ def main(data):
...
@@ -41,6 +41,7 @@ def main(data):
"data"
:
data
,
"data"
:
data
,
})
})
data
=
context
.
Base_formatAttachmentListToMIMEMultipartString
(
**
mhtml_message
)
data
=
context
.
Base_formatAttachmentListToMIMEMultipartString
(
**
mhtml_message
)
return
data
return
data
def
handleHtmlTag
(
tag
,
attrs
):
def
handleHtmlTag
(
tag
,
attrs
):
...
@@ -179,22 +180,23 @@ def handleImageSourceObject(obj, src):
...
@@ -179,22 +180,23 @@ def handleImageSourceObject(obj, src):
format_kw
[
"display"
]
=
str
(
value
)
format_kw
[
"display"
]
=
str
(
value
)
if
format_kw
:
if
format_kw
:
mime
,
data
=
obj
.
convert
(
**
format_kw
)
mime
,
data
=
obj
.
convert
(
**
format_kw
)
return
handleLinkedData
(
mime
,
str
(
data
)
,
src
)
return
handleLinkedData
(
mime
,
data
,
src
)
return
handleHrefObject
(
obj
,
src
,
default_mimetype
=
bad_image_mime_type
,
default_data
=
bad_image_data
)
return
handleHrefObject
(
obj
,
src
,
default_mimetype
=
bad_image_mime_type
,
default_data
=
bad_image_data
)
def
handleHrefObject
(
obj
,
src
,
default_mimetype
=
"text/html"
,
default_data
=
"<p>Linked page not found</p>"
):
def
handleHrefObject
(
obj
,
src
,
default_mimetype
=
"text/html"
,
default_data
=
b
"<p>Linked page not found</p>"
):
# handle File portal_skins/folder/file.png
# handle File portal_skins/folder/file.png
# XXX handle "?portal_skin=" parameter ?
# XXX handle "?portal_skin=" parameter ?
if
hasattr
(
obj
,
"getContentType"
):
if
hasattr
(
obj
,
"getContentType"
):
mime
=
obj
.
getContentType
()
mime
=
obj
.
getContentType
()
if
mime
:
if
mime
:
if
hasattr
(
obj
,
"data"
):
if
hasattr
(
obj
,
"data"
):
data
=
str
(
obj
.
data
or
""
)
data
=
bytes
(
obj
.
data
or
b
""
)
else
:
else
:
data
=
getattr
(
obj
,
"getData"
,
lambda
:
str
(
obj
))()
or
""
data
=
getattr
(
obj
,
"getData"
,
lambda
:
bytes
(
obj
))()
or
b
""
if
six
.
PY2
and
isinstance
(
data
,
unicode
):
if
six
.
PY2
and
isinstance
(
data
,
unicode
):
data
=
data
.
encode
(
"utf-8"
)
data
=
data
.
encode
(
"utf-8"
)
assert
isinstance
(
data
,
bytes
)
return
handleLinkedData
(
mime
,
data
,
src
)
return
handleLinkedData
(
mime
,
data
,
src
)
return
handleLinkedData
(
default_mimetype
,
default_data
,
src
)
return
handleLinkedData
(
default_mimetype
,
default_data
,
src
)
...
@@ -272,7 +274,11 @@ def handleLinkedData(mime, data, href):
...
@@ -272,7 +274,11 @@ def handleLinkedData(mime, data, href):
})
})
return
url
return
url
else
:
else
:
return
"data:%s;base64,%s"
%
(
mime
,
b64encode
(
data
.
encode
()).
decode
())
if
isinstance
(
data
,
six
.
text_type
):
data
=
data
.
encode
(
'utf-8'
)
else
:
data
=
bytes
(
data
)
return
"data:%s;base64,%s"
%
(
mime
,
b64encode
(
data
).
decode
())
def
makeHrefAbsolute
(
href
):
def
makeHrefAbsolute
(
href
):
if
isHrefAnAbsoluteUrl
(
href
)
or
not
isHrefAUrl
(
href
):
if
isHrefAnAbsoluteUrl
(
href
)
or
not
isHrefAUrl
(
href
):
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_formatAttachmentListToMIMEMultipartString.py
View file @
7792bd1e
...
@@ -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
).
replace
(
"=
\
n
"
,
"=
\
r
\
n
"
)
encdata
=
quopri
.
encodestring
(
orig
.
encode
()
).
replace
(
"=
\
n
"
,
"=
\
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/SkinTemplateItem/portal_skins/erp5_web/Base_isPublicConvertionResult.py
View file @
7792bd1e
# This script has 'Anonymous' proxy role to check 'View' permission for Anonymous.
# This script has 'Anonymous' proxy role to check 'View' permission for Anonymous.
return
'format'
in
context
.
REQUEST
and
context
.
getPortalObject
().
portal_membership
.
checkPermission
(
'View'
,
context
)
if
'format'
in
container
.
REQUEST
:
from
zExceptions
import
Unauthorized
portal
=
context
.
getPortalObject
()
try
:
return
portal
.
portal_membership
.
checkPermission
(
'View'
,
context
)
except
Unauthorized
:
pass
return
False
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web_widget_library/Document_getSummaryAsHTML.zpt
View file @
7792bd1e
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
image_conversion_arguments python: '&'.join(['%s=%s' % (k, v) for k, v in image_conversion_dict.items()]);
image_conversion_arguments python: '&'.join(['%s=%s' % (k, v) for k, v in image_conversion_dict.items()]);
description python: here.getDescription();
description python: here.getDescription();
box_relative_url python: request.get('box_relative_url', '');
box_relative_url python: request.get('box_relative_url', '');
dom_id python: modules['base64'].urlsafe_b64encode(
'%s-%s' %(box_relative_url, here.getUid())
).rstrip('=')">
dom_id python: modules['base64'].urlsafe_b64encode(
('%s-%s' %( box_relative_url, here.getUid())).encode()).decode(
).rstrip('=')">
<div class="document-gadget-quick-preview">
<div class="document-gadget-quick-preview">
<div class="teaser"
<div class="teaser"
tal:attributes="onclick string:$('#${dom_id}').toggle();">
tal:attributes="onclick string:$('#${dom_id}').toggle();">
...
...
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