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
3e67ad81
Commit
3e67ad81
authored
Feb 07, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
web: py3
parent
febd7ce6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
25 additions
and
9 deletions
+25
-9
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_web/ExtensionTemplateItem/portal_components/extension.erp5.WebUtility.py
View file @
3e67ad81
...
...
@@ -134,10 +134,12 @@ def parseCssForUrl(text):
result.append(("data", data))
return result
# pylint:disable=no-name-in-module
if six.PY2:
def unescape(self, html):
return HTMLParser().unescape(html)
else:
from html import unescape as html_unescape
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 @
3e67ad81
...
...
@@ -41,6 +41,7 @@ def main(data):
"data"
:
data
,
})
data
=
context
.
Base_formatAttachmentListToMIMEMultipartString
(
**
mhtml_message
)
return
data
def
handleHtmlTag
(
tag
,
attrs
):
...
...
@@ -179,22 +180,23 @@ def handleImageSourceObject(obj, src):
format_kw
[
"display"
]
=
str
(
value
)
if
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
)
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
# XXX handle "?portal_skin=" parameter ?
if
hasattr
(
obj
,
"getContentType"
):
mime
=
obj
.
getContentType
()
if
mime
:
if
hasattr
(
obj
,
"data"
):
data
=
str
(
obj
.
data
or
""
)
data
=
bytes
(
obj
.
data
or
b
""
)
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
):
data
=
data
.
encode
(
"utf-8"
)
assert
isinstance
(
data
,
bytes
)
return
handleLinkedData
(
mime
,
data
,
src
)
return
handleLinkedData
(
default_mimetype
,
default_data
,
src
)
...
...
@@ -272,7 +274,11 @@ def handleLinkedData(mime, data, href):
})
return
url
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
):
if
isHrefAnAbsoluteUrl
(
href
)
or
not
isHrefAUrl
(
href
):
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_formatAttachmentListToMIMEMultipartString.py
View file @
3e67ad81
...
...
@@ -80,7 +80,7 @@ def encode_quopri(msg):
when necessary.
"""
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
.
add_header
(
"Content-Transfer-Encoding"
,
"quoted-printable"
)
...
...
bt5/erp5_web/SkinTemplateItem/portal_skins/erp5_web/Base_isPublicConvertionResult.py
View file @
3e67ad81
# 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 @
3e67ad81
...
...
@@ -9,7 +9,7 @@
image_conversion_arguments python: '&'.join(['%s=%s' % (k, v) for k, v in image_conversion_dict.items()]);
description python: here.getDescription();
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="teaser"
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