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

dms: py3

parent e321c689
......@@ -24,7 +24,7 @@ class DocToDocx:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
doc = OOOdCommandTransform(context, filename, data, self.inputs[0])
docx = doc.convertTo('docx')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class DocToHtml:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
doc = OOOdCommandTransform(context, filename, data, self.inputs[0])
html = doc.convertTo('html')
if cache is not None:
......
......@@ -23,7 +23,7 @@ class DocxToDocy:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
docx = OOOdCommandTransform(context, filename, data, self.inputs[0])
docy = docx.convertTo('docy')
if cache is not None:
......
......@@ -23,7 +23,7 @@ class DocxToOdt:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
docx = OOOdCommandTransform(context, filename, data, self.inputs[0])
odt = docx.convertTo('odt')
if cache is not None:
......
......@@ -23,7 +23,7 @@ class DocyToDocx:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
docy = OOOdCommandTransform(context, filename, data, self.inputs[0])
docx = docy.convertTo('docx')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class OdpToHtml:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
odp = OOOdCommandTransform(context, filename, data, self.inputs[0])
html = odp.convertTo('html')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class OdpToPdf:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
odp = OOOdCommandTransform(context, filename, data, self.inputs[0])
pdf = odp.convertTo('pdf')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class OdpToPptx:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
odp = OOOdCommandTransform(context, filename, data, self.inputs[0])
pptx = odp.convertTo('pptx')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class OdpToSxi:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
odp = OOOdCommandTransform(context, filename, data, self.inputs[0])
sxi = odp.convertTo('sxi')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class OdsToHtml:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
ods = OOOdCommandTransform(context, filename, data, self.inputs[0])
html = ods.convertTo('html')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class OdsToPdf:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
ods = OOOdCommandTransform(context, filename, data, self.inputs[0])
pdf = ods.convertTo('pdf')
if cache is not None:
......
......@@ -23,7 +23,7 @@ class OdsToXlsx:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
ods = OOOdCommandTransform(context, filename, data, self.inputs[0])
xlsx = ods.convertTo('xlsx')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class OdtToDocx:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
odt = OOOdCommandTransform(context, filename, data, self.inputs[0])
docx = odt.convertTo('docx')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class OdtToHtml:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
odt = OOOdCommandTransform(context, filename, data, self.inputs[0])
html = odt.convertTo('html')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class PdfToBmp:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
pdf = OOOdCommandTransform(context, filename, data, self.inputs[0])
bmp = pdf.convertTo('bmp')
if cache is not None:
......
......@@ -27,7 +27,7 @@ class PptToPptx:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
ppt = OOOdCommandTransform(context, filename, data, self.inputs[0])
pptx = ppt.convertTo('pptx')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class PptxToOdp:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
pptx = OOOdCommandTransform(context, filename, data, self.inputs[0])
odp = pptx.convertTo('odp')
if cache is not None:
......
......@@ -23,7 +23,7 @@ class PptxToPpty:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
pptx = OOOdCommandTransform(context, filename, data, self.inputs[0])
ppty = pptx.convertTo('ppty')
if cache is not None:
......
......@@ -23,7 +23,7 @@ class PptyToPptx:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
ppty = OOOdCommandTransform(context, filename, data, self.inputs[0])
pptx = ppty.convertTo('pptx')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class SxiToHtml:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
sxi = OOOdCommandTransform(context, filename, data, self.inputs[0])
html = sxi.convertTo('html')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class SxiToOdp:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
sxi = OOOdCommandTransform(context, filename, data, self.inputs[0])
odp = sxi.convertTo('odp')
if cache is not None:
......
......@@ -23,7 +23,7 @@ class XlsToOds:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
xls = OOOdCommandTransform(context, filename, data, self.inputs[0])
ods = xls.convertTo('ods')
if cache is not None:
......
......@@ -23,7 +23,7 @@ class XlsToXlsx:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
xls = OOOdCommandTransform(context, filename, data, self.inputs[0])
xlsx = xls.convertTo('xlsx')
if cache is not None:
......
......@@ -23,7 +23,7 @@ class XlsxToOds:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
xlsx = OOOdCommandTransform(context, filename, data, self.inputs[0])
ods = xlsx.convertTo('ods')
if cache is not None:
......
......@@ -24,7 +24,7 @@ class XlsxToXlsy:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
xlsx = OOOdCommandTransform(context, filename, data, self.inputs[0])
xlsy = xlsx.convertTo('xlsy')
if cache is not None:
......
......@@ -23,7 +23,7 @@ class XlsyToXlsx:
raise AttributeError(attr)
def convert(self, orig, data, cache=None, filename=None, context=None, **kwargs):
data = str(orig)
data = bytes(orig)
xlsy = OOOdCommandTransform(context, filename, data, self.inputs[0])
xlsx = xlsy.convertTo('xlsx')
if cache is not None:
......
......@@ -41,6 +41,6 @@ if relation_id == 'all':
for obj in (predecessor_value_list + successor_value_list +
similar_value_list):
dic[obj] = None
return dic.keys()
return list(dic.keys())
return [] # failover - undefined relation
......@@ -5,10 +5,7 @@ if brain.getValidationState() == 'embedded':
else:
reference = brain.getReference()
return unicode(
"javascript:SelectFile('%s?format=%s')" % (
reference.replace("'", "\\'"),
context.getPortalObject().portal_preferences.getPreferredImageFormat()
),
'utf-8',
)
return "javascript:SelectFile('%s?format=%s')" % (
reference.replace("'", "\\'"),
context.getPortalObject().portal_preferences.getPreferredImageFormat()
)
\ No newline at end of file
......@@ -27,6 +27,7 @@
#
##############################################################################
import six
import unittest
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.utils import createZODBPythonScript, removeZODBPythonScript
......@@ -209,11 +210,15 @@ class TestWebCrawler(ERP5TypeTestCase):
</html>"""
web_page.edit(text_content=text_content)
self.assertEqual(web_page.getContentBaseURL(), "http://www.example.com")
expected_encoded_url = 'http://www.example.com/?title=%E9crit'
if six.PY2:
expected_encoded_url = 'http://www.example.com/?title=\xc3\xa9crit'
self.assertEqual(web_page.getContentNormalisedURLList(),
["http://www.example.com/I don't care I put what/ I want/",
'http://www.example.com/section',
'http://www.example.com/section2',
'http://www.example.com/?title=\xc3\xa9crit',])
expected_encoded_url,
])
# relative links without base tag
text_content = """<html>
<head>
......
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