Commit f252791a authored by Jérome Perrin's avatar Jérome Perrin

web_renderjs_ui: py3

parent e9ee0141
...@@ -24,7 +24,7 @@ if not isinstance(deny_tag_list, (list, tuple)): ...@@ -24,7 +24,7 @@ if not isinstance(deny_tag_list, (list, tuple)):
deny_tag_list = [] deny_tag_list = []
def main(data): def main(data):
if isinstance(data, str): if isinstance(data, bytes):
data = data.decode("utf-8") data = data.decode("utf-8")
for part in context.Base_parseHtml(data): for part in context.Base_parseHtml(data):
handleHtmlPart(part) handleHtmlPart(part)
......
...@@ -12,7 +12,7 @@ def ERP5Site_extractTranslationMessageListFromHTML(self, text_content): ...@@ -12,7 +12,7 @@ def ERP5Site_extractTranslationMessageListFromHTML(self, text_content):
""" """
if not text_content: if not text_content:
return return
if isinstance(text_content, str): if isinstance(text_content, bytes):
text_content = text_content.decode('utf-8') text_content = text_content.decode('utf-8')
parser = lxml.etree.HTMLParser() parser = lxml.etree.HTMLParser()
......
import json import json
import re import re
from six.moves.urllib.parse import urljoin from Products.ERP5Type.Utils import bytes2str, str2bytes
if REQUEST is None: if REQUEST is None:
REQUEST = context.REQUEST REQUEST = context.REQUEST
...@@ -40,6 +40,12 @@ if selected_language == default_language: ...@@ -40,6 +40,12 @@ if selected_language == default_language:
else: else:
base_prefix = '../' base_prefix = '../'
def urljoin(base, url):
# concemtually similar to urllib.parse.urljoin, but without trying to eliminate
# .. path elements, because we want to produce relative URLs that may be parent
# of the base.
return base_prefix + url
mapping_dict = { mapping_dict = {
"base_prefix": base_prefix, "base_prefix": base_prefix,
"frontpage_gadget": web_section.getLayoutProperty("configuration_frontpage_gadget_url", default="worklist"), "frontpage_gadget": web_section.getLayoutProperty("configuration_frontpage_gadget_url", default="worklist"),
......
...@@ -74,7 +74,7 @@ ...@@ -74,7 +74,7 @@
</div> </div>
<div class="dialog_button_container"> <div class="dialog_button_container">
<input type="submit" value="Login" i18n:attributes="value" i18n:domain="ui" tal:attributes="name python: '%s:method' % (form_action, )"/> <input type="submit" value="Login" i18n:attributes="value" i18n:domain="ui" tal:attributes="name python: '%s:method' % (form_action, )"/>
<a i18n:domain="ui" i18n:translate="" tal:attributes="href python: '%sWebSite_viewRecoverAccount?%s' % (absolute_url, modules['urllib'].urlencode([('came_from', absolute_url)]))">I forgot my password!</a> <a i18n:domain="ui" i18n:translate="" tal:attributes="href python: '%sWebSite_viewRecoverAccount?%s' % (absolute_url, modules['six.moves.urllib.parse'].urlencode([('came_from', absolute_url)]))">I forgot my password!</a>
</div> </div>
<div class="dialog_button_container" tal:condition="enable_google_login"> <div class="dialog_button_container" tal:condition="enable_google_login">
<a tal:attributes="href python: root_absolute_url + 'ERP5Site_redirectToGoogleLoginPage'" <a tal:attributes="href python: root_absolute_url + 'ERP5Site_redirectToGoogleLoginPage'"
......
last_message = context.getLastLog()[-1] import re
line_list = filter(None, last_message.replace("=\n","").split("\n")) from Products.ERP5Type.Utils import bytes2str
for line in line_list: last_message_text = bytes2str(context.getMessageList()[-1][2])
if "http" in line: __traceback_info__ = last_message_text
return context.REQUEST.RESPONSE.redirect(line.replace("=3D", "="))
raise RuntimeError("URL not found in the email") return container.REQUEST.RESPONSE.redirect(re.findall(r"http.*", last_message_text)[0])
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment