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
ce2a1eda
Commit
ce2a1eda
authored
Feb 07, 2024
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dms: py3
parent
e321c689
Changes
30
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
112 additions
and
126 deletions
+112
-126
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformDocToDocx.py
...eItem/portal_components/module.erp5.TransformDocToDocx.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformDocToHtml.py
...eItem/portal_components/module.erp5.TransformDocToHtml.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformDocxToDocy.py
...Item/portal_components/module.erp5.TransformDocxToDocy.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformDocxToOdt.py
...eItem/portal_components/module.erp5.TransformDocxToOdt.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformDocyToDocx.py
...Item/portal_components/module.erp5.TransformDocyToDocx.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdpToHtml.py
...eItem/portal_components/module.erp5.TransformOdpToHtml.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdpToPdf.py
...teItem/portal_components/module.erp5.TransformOdpToPdf.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdpToPptx.py
...eItem/portal_components/module.erp5.TransformOdpToPptx.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdpToSxi.py
...teItem/portal_components/module.erp5.TransformOdpToSxi.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdsToHtml.py
...eItem/portal_components/module.erp5.TransformOdsToHtml.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdsToPdf.py
...teItem/portal_components/module.erp5.TransformOdsToPdf.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdsToXlsx.py
...eItem/portal_components/module.erp5.TransformOdsToXlsx.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdtToDocx.py
...eItem/portal_components/module.erp5.TransformOdtToDocx.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdtToHtml.py
...eItem/portal_components/module.erp5.TransformOdtToHtml.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformPdfToBmp.py
...teItem/portal_components/module.erp5.TransformPdfToBmp.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformPptToPptx.py
...eItem/portal_components/module.erp5.TransformPptToPptx.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformPptxToOdp.py
...eItem/portal_components/module.erp5.TransformPptxToOdp.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformPptxToPpty.py
...Item/portal_components/module.erp5.TransformPptxToPpty.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformPptyToPptx.py
...Item/portal_components/module.erp5.TransformPptyToPptx.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformSxiToHtml.py
...eItem/portal_components/module.erp5.TransformSxiToHtml.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformSxiToOdp.py
...teItem/portal_components/module.erp5.TransformSxiToOdp.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformXlsToOds.py
...teItem/portal_components/module.erp5.TransformXlsToOds.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformXlsToXlsx.py
...eItem/portal_components/module.erp5.TransformXlsToXlsx.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformXlsxToOds.py
...eItem/portal_components/module.erp5.TransformXlsxToOds.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformXlsxToXlsy.py
...Item/portal_components/module.erp5.TransformXlsxToXlsy.py
+1
-1
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformXlsyToXlsx.py
...Item/portal_components/module.erp5.TransformXlsyToXlsx.py
+1
-1
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_getRelatedDocumentList.py
.../portal_skins/erp5_dms/Document_getRelatedDocumentList.py
+1
-1
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/FCKeditor_getSetReferenceUrl.py
...tem/portal_skins/erp5_dms/FCKeditor_getSetReferenceUrl.py
+4
-7
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testERP5WebWithDms.py
...ateItem/portal_components/test.erp5.testERP5WebWithDms.py
+75
-91
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testWebCrawler.py
...emplateItem/portal_components/test.erp5.testWebCrawler.py
+6
-1
No files found.
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformDocToDocx.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class DocToDocx:
...
@@ -24,7 +24,7 @@ class DocToDocx:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
doc
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
docx
=
doc
.
convertTo
(
'docx'
)
docx
=
doc
.
convertTo
(
'docx'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformDocToHtml.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class DocToHtml:
...
@@ -24,7 +24,7 @@ class DocToHtml:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
doc
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
html
=
doc
.
convertTo
(
'html'
)
html
=
doc
.
convertTo
(
'html'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformDocxToDocy.py
View file @
ce2a1eda
...
@@ -23,7 +23,7 @@ class DocxToDocy:
...
@@ -23,7 +23,7 @@ class DocxToDocy:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
docx
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
docy
=
docx
.
convertTo
(
'docy'
)
docy
=
docx
.
convertTo
(
'docy'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformDocxToOdt.py
View file @
ce2a1eda
...
@@ -23,7 +23,7 @@ class DocxToOdt:
...
@@ -23,7 +23,7 @@ class DocxToOdt:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
docx
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
odt
=
docx
.
convertTo
(
'odt'
)
odt
=
docx
.
convertTo
(
'odt'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformDocyToDocx.py
View file @
ce2a1eda
...
@@ -23,7 +23,7 @@ class DocyToDocx:
...
@@ -23,7 +23,7 @@ class DocyToDocx:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
docy
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
docx
=
docy
.
convertTo
(
'docx'
)
docx
=
docy
.
convertTo
(
'docx'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdpToHtml.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class OdpToHtml:
...
@@ -24,7 +24,7 @@ class OdpToHtml:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
odp
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
html
=
odp
.
convertTo
(
'html'
)
html
=
odp
.
convertTo
(
'html'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdpToPdf.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class OdpToPdf:
...
@@ -24,7 +24,7 @@ class OdpToPdf:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
odp
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
pdf
=
odp
.
convertTo
(
'pdf'
)
pdf
=
odp
.
convertTo
(
'pdf'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdpToPptx.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class OdpToPptx:
...
@@ -24,7 +24,7 @@ class OdpToPptx:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
odp
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
pptx
=
odp
.
convertTo
(
'pptx'
)
pptx
=
odp
.
convertTo
(
'pptx'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdpToSxi.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class OdpToSxi:
...
@@ -24,7 +24,7 @@ class OdpToSxi:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
odp
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
sxi
=
odp
.
convertTo
(
'sxi'
)
sxi
=
odp
.
convertTo
(
'sxi'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdsToHtml.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class OdsToHtml:
...
@@ -24,7 +24,7 @@ class OdsToHtml:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
ods
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
html
=
ods
.
convertTo
(
'html'
)
html
=
ods
.
convertTo
(
'html'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdsToPdf.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class OdsToPdf:
...
@@ -24,7 +24,7 @@ class OdsToPdf:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
ods
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
pdf
=
ods
.
convertTo
(
'pdf'
)
pdf
=
ods
.
convertTo
(
'pdf'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdsToXlsx.py
View file @
ce2a1eda
...
@@ -23,7 +23,7 @@ class OdsToXlsx:
...
@@ -23,7 +23,7 @@ class OdsToXlsx:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
ods
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
xlsx
=
ods
.
convertTo
(
'xlsx'
)
xlsx
=
ods
.
convertTo
(
'xlsx'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdtToDocx.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class OdtToDocx:
...
@@ -24,7 +24,7 @@ class OdtToDocx:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
odt
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
docx
=
odt
.
convertTo
(
'docx'
)
docx
=
odt
.
convertTo
(
'docx'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformOdtToHtml.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class OdtToHtml:
...
@@ -24,7 +24,7 @@ class OdtToHtml:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
odt
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
html
=
odt
.
convertTo
(
'html'
)
html
=
odt
.
convertTo
(
'html'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformPdfToBmp.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class PdfToBmp:
...
@@ -24,7 +24,7 @@ class PdfToBmp:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
pdf
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
bmp
=
pdf
.
convertTo
(
'bmp'
)
bmp
=
pdf
.
convertTo
(
'bmp'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformPptToPptx.py
View file @
ce2a1eda
...
@@ -27,7 +27,7 @@ class PptToPptx:
...
@@ -27,7 +27,7 @@ class PptToPptx:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
ppt
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
pptx
=
ppt
.
convertTo
(
'pptx'
)
pptx
=
ppt
.
convertTo
(
'pptx'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformPptxToOdp.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class PptxToOdp:
...
@@ -24,7 +24,7 @@ class PptxToOdp:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
pptx
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
odp
=
pptx
.
convertTo
(
'odp'
)
odp
=
pptx
.
convertTo
(
'odp'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformPptxToPpty.py
View file @
ce2a1eda
...
@@ -23,7 +23,7 @@ class PptxToPpty:
...
@@ -23,7 +23,7 @@ class PptxToPpty:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
pptx
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
ppty
=
pptx
.
convertTo
(
'ppty'
)
ppty
=
pptx
.
convertTo
(
'ppty'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformPptyToPptx.py
View file @
ce2a1eda
...
@@ -23,7 +23,7 @@ class PptyToPptx:
...
@@ -23,7 +23,7 @@ class PptyToPptx:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
ppty
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
pptx
=
ppty
.
convertTo
(
'pptx'
)
pptx
=
ppty
.
convertTo
(
'pptx'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformSxiToHtml.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class SxiToHtml:
...
@@ -24,7 +24,7 @@ class SxiToHtml:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
sxi
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
html
=
sxi
.
convertTo
(
'html'
)
html
=
sxi
.
convertTo
(
'html'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformSxiToOdp.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class SxiToOdp:
...
@@ -24,7 +24,7 @@ class SxiToOdp:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
sxi
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
odp
=
sxi
.
convertTo
(
'odp'
)
odp
=
sxi
.
convertTo
(
'odp'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformXlsToOds.py
View file @
ce2a1eda
...
@@ -23,7 +23,7 @@ class XlsToOds:
...
@@ -23,7 +23,7 @@ class XlsToOds:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
xls
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
ods
=
xls
.
convertTo
(
'ods'
)
ods
=
xls
.
convertTo
(
'ods'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformXlsToXlsx.py
View file @
ce2a1eda
...
@@ -23,7 +23,7 @@ class XlsToXlsx:
...
@@ -23,7 +23,7 @@ class XlsToXlsx:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
xls
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
xlsx
=
xls
.
convertTo
(
'xlsx'
)
xlsx
=
xls
.
convertTo
(
'xlsx'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformXlsxToOds.py
View file @
ce2a1eda
...
@@ -23,7 +23,7 @@ class XlsxToOds:
...
@@ -23,7 +23,7 @@ class XlsxToOds:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
xlsx
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
ods
=
xlsx
.
convertTo
(
'ods'
)
ods
=
xlsx
.
convertTo
(
'ods'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformXlsxToXlsy.py
View file @
ce2a1eda
...
@@ -24,7 +24,7 @@ class XlsxToXlsy:
...
@@ -24,7 +24,7 @@ class XlsxToXlsy:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
xlsx
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
xlsy
=
xlsx
.
convertTo
(
'xlsy'
)
xlsy
=
xlsx
.
convertTo
(
'xlsy'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/ModuleComponentTemplateItem/portal_components/module.erp5.TransformXlsyToXlsx.py
View file @
ce2a1eda
...
@@ -23,7 +23,7 @@ class XlsyToXlsx:
...
@@ -23,7 +23,7 @@ class XlsyToXlsx:
raise
AttributeError
(
attr
)
raise
AttributeError
(
attr
)
def
convert
(
self
,
orig
,
data
,
cache
=
None
,
filename
=
None
,
context
=
None
,
**
kwargs
):
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
])
xlsy
=
OOOdCommandTransform
(
context
,
filename
,
data
,
self
.
inputs
[
0
])
xlsx
=
xlsy
.
convertTo
(
'xlsx'
)
xlsx
=
xlsy
.
convertTo
(
'xlsx'
)
if
cache
is
not
None
:
if
cache
is
not
None
:
...
...
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/Document_getRelatedDocumentList.py
View file @
ce2a1eda
...
@@ -41,6 +41,6 @@ if relation_id == 'all':
...
@@ -41,6 +41,6 @@ if relation_id == 'all':
for
obj
in
(
predecessor_value_list
+
successor_value_list
+
for
obj
in
(
predecessor_value_list
+
successor_value_list
+
similar_value_list
):
similar_value_list
):
dic
[
obj
]
=
None
dic
[
obj
]
=
None
return
dic
.
keys
(
)
return
list
(
dic
.
keys
()
)
return
[]
# failover - undefined relation
return
[]
# failover - undefined relation
bt5/erp5_dms/SkinTemplateItem/portal_skins/erp5_dms/FCKeditor_getSetReferenceUrl.py
View file @
ce2a1eda
...
@@ -5,10 +5,7 @@ if brain.getValidationState() == 'embedded':
...
@@ -5,10 +5,7 @@ if brain.getValidationState() == 'embedded':
else
:
else
:
reference
=
brain
.
getReference
()
reference
=
brain
.
getReference
()
return
unicode
(
return
"javascript:SelectFile('%s?format=%s')"
%
(
"javascript:SelectFile('%s?format=%s')"
%
(
reference
.
replace
(
"'"
,
"
\
\
'"
),
reference
.
replace
(
"'"
,
"
\
\
'"
),
context
.
getPortalObject
().
portal_preferences
.
getPreferredImageFormat
()
context
.
getPortalObject
().
portal_preferences
.
getPreferredImageFormat
()
),
'utf-8'
,
)
)
\ No newline at end of file
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testERP5WebWithDms.py
View file @
ce2a1eda
...
@@ -31,8 +31,8 @@ import unittest
...
@@ -31,8 +31,8 @@ import unittest
import
os
import
os
import
quopri
import
quopri
import
functools
import
functools
import
io
import
requests
import
requests
from
six.moves
import
cStringIO
as
StringIO
from
lxml
import
etree
from
lxml
import
etree
from
base64
import
b64decode
,
b64encode
from
base64
import
b64decode
,
b64encode
from
email.parser
import
Parser
as
EmailParser
from
email.parser
import
Parser
as
EmailParser
...
@@ -51,7 +51,7 @@ from six.moves import range
...
@@ -51,7 +51,7 @@ from six.moves import range
LANGUAGE_LIST
=
(
'en'
,
'fr'
,
'de'
,
'bg'
,)
LANGUAGE_LIST
=
(
'en'
,
'fr'
,
'de'
,
'bg'
,)
IMAGE_COMPARE_TOLERANCE
=
850
IMAGE_COMPARE_TOLERANCE
=
850
XSMALL_SVG_IMAGE_ICON_DATA
=
'''<svg width="30" height="35" xmlns="http://www.w3.org/2000/svg">
XSMALL_SVG_IMAGE_ICON_DATA
=
b
'''<svg width="30" height="35" xmlns="http://www.w3.org/2000/svg">
<path d="m5,5l15,0l0,5l5,0l0,20l-20,0z" stroke-width="1.5" stroke="gray" fill="skyblue"/>
<path d="m5,5l15,0l0,5l5,0l0,20l-20,0z" stroke-width="1.5" stroke="gray" fill="skyblue"/>
<path d="m6,29l8,-8l5,5l2,-2l3,3l0,2z" stroke-width="0" fill="green"/>
<path d="m6,29l8,-8l5,5l2,-2l3,3l0,2z" stroke-width="0" fill="green"/>
<path d="m25,10l0,-1l-4,-4l-1,0l0,5z" stroke-width="1.5" stroke="gray" fill="white"/>
<path d="m25,10l0,-1l-4,-4l-1,0l0,5z" stroke-width="1.5" stroke="gray" fill="white"/>
...
@@ -73,11 +73,6 @@ def makeFilePath(name):
...
@@ -73,11 +73,6 @@ def makeFilePath(name):
from
Products.ERP5
import
tests
from
Products.ERP5
import
tests
return
os
.
path
.
join
(
tests
.
__path__
[
0
],
'test_data'
,
name
)
return
os
.
path
.
join
(
tests
.
__path__
[
0
],
'test_data'
,
name
)
def
makeFileUpload
(
name
,
as_name
=
None
):
if
as_name
is
None
:
as_name
=
name
path
=
makeFilePath
(
name
)
return
FileUpload
(
path
,
as_name
)
def
process_image
(
image
,
size
=
(
40
,
40
)):
def
process_image
(
image
,
size
=
(
40
,
40
)):
# open the images to compare, resize them, and convert to grayscale
# open the images to compare, resize them, and convert to grayscale
...
@@ -85,6 +80,7 @@ def process_image(image, size=(40, 40)):
...
@@ -85,6 +80,7 @@ def process_image(image, size=(40, 40)):
image
=
Image
.
open
(
image
)
image
=
Image
.
open
(
image
)
return
list
(
image
.
resize
(
size
).
convert
(
"L"
).
getdata
())
return
list
(
image
.
resize
(
size
).
convert
(
"L"
).
getdata
())
def
compare_image
(
image_data_1
,
image_data_2
):
def
compare_image
(
image_data_1
,
image_data_2
):
""" Find the total difference in RGB value for all pixels in the images
""" Find the total difference in RGB value for all pixels in the images
and return the "amount" of differences that the 2 images contains. """
and return the "amount" of differences that the 2 images contains. """
...
@@ -92,6 +88,7 @@ def compare_image(image_data_1, image_data_2):
...
@@ -92,6 +88,7 @@ def compare_image(image_data_1, image_data_2):
data2
=
process_image
(
image_data_2
)
data2
=
process_image
(
image_data_2
)
return
abs
(
sum
([
data1
[
x
]
-
data2
[
x
]
for
x
in
range
(
len
(
data1
))]))
return
abs
(
sum
([
data1
[
x
]
-
data2
[
x
]
for
x
in
range
(
len
(
data1
))]))
def
customScript
(
script_id
,
script_param
,
script_code
):
def
customScript
(
script_id
,
script_param
,
script_code
):
def
wrapper
(
func
):
def
wrapper
(
func
):
@
functools
.
wraps
(
func
)
@
functools
.
wraps
(
func
)
...
@@ -113,11 +110,10 @@ def customScript(script_id, script_param, script_code):
...
@@ -113,11 +110,10 @@ def customScript(script_id, script_param, script_code):
return
wrapped
return
wrapped
return
wrapper
return
wrapper
class
TestERP5WebWithDms
(
ERP5TypeTestCase
,
ZopeTestCase
.
Functional
):
class
TestERP5WebWithDms
(
ERP5TypeTestCase
,
ZopeTestCase
.
Functional
):
"""Test for erp5_web business template.
"""Test for erp5_web business template.
"""
"""
run_all_test
=
1
quiet
=
0
manager_username
=
'zope'
manager_username
=
'zope'
manager_password
=
'zope'
manager_password
=
'zope'
website_id
=
'test'
website_id
=
'test'
...
@@ -125,7 +121,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -125,7 +121,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
def
getTitle
(
self
):
def
getTitle
(
self
):
return
"ERP5WebWithDms"
return
"ERP5WebWithDms"
def
login
(
self
,
quiet
=
0
,
run
=
run_all_test
):
def
login
(
self
):
uf
=
self
.
getPortal
().
acl_users
uf
=
self
.
getPortal
().
acl_users
uf
.
_doAddUser
(
self
.
manager_username
,
self
.
manager_password
,
[
'Manager'
],
[])
uf
.
_doAddUser
(
self
.
manager_username
,
self
.
manager_password
,
[
'Manager'
],
[])
user
=
uf
.
getUserById
(
self
.
manager_username
).
__of__
(
uf
)
user
=
uf
.
getUserById
(
self
.
manager_username
).
__of__
(
uf
)
...
@@ -157,9 +153,18 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -157,9 +153,18 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
tic
()
self
.
tic
()
def
beforeTearDown
(
self
):
def
beforeTearDown
(
self
):
return
self
.
clearModule
(
self
.
portal
.
web_site_module
)
self
.
clearModule
(
self
.
portal
.
web_site_module
)
self
.
clearModule
(
self
.
portal
.
web_page_module
)
self
.
clearModule
(
self
.
portal
.
web_page_module
)
def
makeFileUpload
(
self
,
name
,
as_name
=
None
):
if
as_name
is
None
:
as_name
=
name
path
=
makeFilePath
(
name
)
fu
=
FileUpload
(
path
,
as_name
)
self
.
addCleanup
(
fu
.
close
)
return
fu
def
setupWebSite
(
self
,
**
kw
):
def
setupWebSite
(
self
,
**
kw
):
"""
"""
Setup Web Site
Setup Web Site
...
@@ -229,28 +234,24 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -229,28 +234,24 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
return
webpage_list
return
webpage_list
def
test_01_WebPageVersioning
(
self
,
quiet
=
quiet
,
run
=
run_all_test
):
def
test_01_WebPageVersioning
(
self
):
"""
"""
Simple Case of showing the proper most recent public Web Page based on
Simple Case of showing the proper most recent public Web Page based on
(language, version)
(language, version)
"""
"""
if
not
run
:
return
if
not
quiet
:
message
=
'
\
n
test_01_WebPageVersioning'
ZopeTestCase
.
_print
(
message
)
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
self
.
setupWebSite
()
self
.
setupWebSite
()
websection
=
self
.
setupWebSection
()
websection
=
self
.
setupWebSection
()
page_reference
=
'default-webpage-versionning'
page_reference
=
'default-webpage-versionning'
self
.
setupWebSitePages
(
prefix
=
page_reference
)
self
.
setupWebSitePages
(
prefix
=
page_reference
)
# set default web page for section
# set default web page for section
found_by_reference
=
portal
.
portal_catalog
(
reference
=
page_reference
,
found_by_reference
=
portal
.
portal_catalog
(
reference
=
page_reference
,
language
=
'en'
,
language
=
'en'
,
portal_type
=
'Web Page'
)
portal_type
=
'Web Page'
)
en_01
=
found_by_reference
[
0
].
getObject
()
en_01
=
found_by_reference
[
0
].
getObject
()
# set it as default web page for section
# set it as default web page for section
websection
.
edit
(
categories_list
=
[
'aggregate/%s'
%
en_01
.
getRelativeUrl
(),])
websection
.
edit
(
categories_list
=
[
'aggregate/%s'
%
en_01
.
getRelativeUrl
(),])
self
.
assertEqual
([
en_01
.
getReference
(),],
self
.
assertEqual
([
en_01
.
getReference
(),],
websection
.
getAggregateReferenceList
())
websection
.
getAggregateReferenceList
())
...
@@ -275,15 +276,11 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -275,15 +276,11 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEqual
(
'0.2'
,
default_document
.
getVersion
())
self
.
assertEqual
(
'0.2'
,
default_document
.
getVersion
())
self
.
assertEqual
(
'published'
,
default_document
.
getValidationState
())
self
.
assertEqual
(
'published'
,
default_document
.
getValidationState
())
def
test_02_WebSectionAuthorizationForced
(
self
,
quiet
=
quiet
,
run
=
run_all_test
):
def
test_02_WebSectionAuthorizationForced
(
self
):
""" Check that when a document is requested within a Web Section we have a chance to
""" Check that when a document is requested within a Web Section we have a chance to
require user to login.
require user to login.
Whether or not an user will login is controlled by a property on Web Section (authorization_forced).
Whether or not an user will login is controlled by a property on Web Section (authorization_forced).
"""
"""
if
not
run
:
return
if
not
quiet
:
message
=
'
\
n
test_02_WebSectionAuthorizationForced'
ZopeTestCase
.
_print
(
message
)
request
=
self
.
app
.
REQUEST
request
=
self
.
app
.
REQUEST
website
=
self
.
setupWebSite
()
website
=
self
.
setupWebSite
()
websection
=
self
.
setupWebSection
()
websection
=
self
.
setupWebSection
()
...
@@ -319,25 +316,19 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -319,25 +316,19 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
logout
()
self
.
logout
()
self
.
assertRaises
(
Unauthorized
,
websection
.
_getExtensibleContent
,
request
,
document_reference
)
self
.
assertRaises
(
Unauthorized
,
websection
.
_getExtensibleContent
,
request
,
document_reference
)
def
test_03_LatestContent
(
self
,
quiet
=
quiet
,
run
=
run_all_test
):
def
test_03_LatestContent
(
self
):
""" Test latest content for a Web Section. Test different use case like languaeg, workflow state.
""" Test latest content for a Web Section. Test different use case like languaeg, workflow state.
"""
"""
if
not
run
:
return
if
not
quiet
:
message
=
'
\
n
test_03_LatestContent'
ZopeTestCase
.
_print
(
message
)
portal
=
self
.
getPortal
()
portal
=
self
.
getPortal
()
self
.
setupWebSite
()
self
.
setupWebSite
()
websection
=
self
.
setupWebSection
()
websection
=
self
.
setupWebSection
()
portal_categories
=
portal
.
portal_categories
portal_categories
=
portal
.
portal_categories
publication_section_category_id_list
=
[
'documentation'
,
'administration'
]
publication_section_category_id_list
=
[
'documentation'
,
'administration'
]
for
category_id
in
publication_section_category_id_list
:
for
category_id
in
publication_section_category_id_list
:
portal_categories
.
publication_section
.
newContent
(
portal_type
=
'Category'
,
portal_categories
.
publication_section
.
newContent
(
portal_type
=
'Category'
,
id
=
category_id
)
id
=
category_id
)
# set predicate on web section using 'publication_section'
#set predicate on web section using 'publication_section'
websection
.
edit
(
membership_criterion_base_category
=
[
'publication_section'
],
websection
.
edit
(
membership_criterion_base_category
=
[
'publication_section'
],
membership_criterion_category
=
[
'publication_section/%s'
%
publication_section_category_id_list
[
0
]])
membership_criterion_category
=
[
'publication_section/%s'
%
publication_section_category_id_list
[
0
]])
self
.
tic
()
self
.
tic
()
self
.
assertEqual
(
0
,
len
(
websection
.
getDocumentValueList
()))
self
.
assertEqual
(
0
,
len
(
websection
.
getDocumentValueList
()))
...
@@ -370,15 +361,11 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -370,15 +361,11 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEqual
(
1
,
len
(
websection
.
getDocumentValueList
()))
self
.
assertEqual
(
1
,
len
(
websection
.
getDocumentValueList
()))
self
.
assertEqual
(
web_page_en
,
websection
.
getDocumentValueList
()[
0
].
getObject
())
self
.
assertEqual
(
web_page_en
,
websection
.
getDocumentValueList
()[
0
].
getObject
())
def
test_04_WebSectionAuthorizationForcedForDefaultDocument
(
self
,
quiet
=
quiet
,
run
=
run_all_test
):
def
test_04_WebSectionAuthorizationForcedForDefaultDocument
(
self
):
""" Check that when a Web Section contains a default document not accessible by user we have a chance to
""" Check that when a Web Section contains a default document not accessible by user we have a chance to
require user to login.
require user to login.
Whether or not an user will login is controlled by a property on Web Section (authorization_forced).
Whether or not an user will login is controlled by a property on Web Section (authorization_forced).
"""
"""
if
not
run
:
return
if
not
quiet
:
message
=
'
\
n
test_04_WebSectionAuthorizationForcedForDefaultDocument'
ZopeTestCase
.
_print
(
message
)
self
.
setupWebSite
()
self
.
setupWebSite
()
websection
=
self
.
setupWebSection
()
websection
=
self
.
setupWebSection
()
web_page_reference
=
'default-document-reference'
web_page_reference
=
'default-document-reference'
...
@@ -429,15 +416,11 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -429,15 +416,11 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
commit
()
self
.
commit
()
self
.
assertEqual
(
5
,
len
(
websection
.
getDocumentValueList
(
limit
=
5
)))
self
.
assertEqual
(
5
,
len
(
websection
.
getDocumentValueList
(
limit
=
5
)))
def
test_05_deadProxyFields
(
self
,
quiet
=
quiet
,
run
=
run_all_test
):
def
test_05_deadProxyFields
(
self
):
"""
"""
check that all proxy fields defined in business templates have a valid
check that all proxy fields defined in business templates have a valid
target
target
"""
"""
if
not
run
:
return
if
not
quiet
:
message
=
'
\
n
test_05_deadProxyFields'
ZopeTestCase
.
_print
(
message
)
skins_tool
=
self
.
portal
.
portal_skins
skins_tool
=
self
.
portal
.
portal_skins
for
field_path
,
field
in
skins_tool
.
ZopeFind
(
for
field_path
,
field
in
skins_tool
.
ZopeFind
(
skins_tool
,
obj_metatypes
=
[
'ProxyField'
],
search_sub
=
1
):
skins_tool
,
obj_metatypes
=
[
'ProxyField'
],
search_sub
=
1
):
...
@@ -481,7 +464,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -481,7 +464,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEqual
(
modification_date
,
last_modified_header
)
self
.
assertEqual
(
modification_date
,
last_modified_header
)
# Upload a presentation with 3 pages.
# Upload a presentation with 3 pages.
upload_file
=
makeFileUpload
(
'P-DMS-Presentation.3.Pages-001-en.odp'
)
upload_file
=
self
.
makeFileUpload
(
'P-DMS-Presentation.3.Pages-001-en.odp'
)
document
=
document_module
.
newContent
(
portal_type
=
'Presentation'
,
document
=
document_module
.
newContent
(
portal_type
=
'Presentation'
,
file
=
upload_file
)
file
=
upload_file
)
reference
=
'P-DMS-Presentation.3.Pages'
reference
=
'P-DMS-Presentation.3.Pages'
...
@@ -538,7 +521,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -538,7 +521,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
document_reference
=
'NXD-Presentation'
document_reference
=
'NXD-Presentation'
document_module
=
portal
.
getDefaultModule
(
portal_type
=
'Presentation'
)
document_module
=
portal
.
getDefaultModule
(
portal_type
=
'Presentation'
)
upload_file
=
makeFileUpload
(
'P-DMS-Presentation.3.Pages-001-en.odp'
)
upload_file
=
self
.
makeFileUpload
(
'P-DMS-Presentation.3.Pages-001-en.odp'
)
document
=
document_module
.
newContent
(
portal_type
=
'Presentation'
,
document
=
document_module
.
newContent
(
portal_type
=
'Presentation'
,
reference
=
document_reference
,
reference
=
document_reference
,
file
=
upload_file
)
file
=
upload_file
)
...
@@ -546,7 +529,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -546,7 +529,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
image_reference
=
'NXD-IMAGE'
image_reference
=
'NXD-IMAGE'
image_module
=
portal
.
getDefaultModule
(
portal_type
=
'Image'
)
image_module
=
portal
.
getDefaultModule
(
portal_type
=
'Image'
)
upload_file
=
makeFileUpload
(
'tiolive-ERP5.Freedom.TioLive.Logo-001-en.png'
)
upload_file
=
self
.
makeFileUpload
(
'tiolive-ERP5.Freedom.TioLive.Logo-001-en.png'
)
image
=
image_module
.
newContent
(
portal_type
=
'Image'
,
image
=
image_module
.
newContent
(
portal_type
=
'Image'
,
file
=
upload_file
,
file
=
upload_file
,
reference
=
image_reference
)
reference
=
image_reference
)
...
@@ -558,15 +541,14 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -558,15 +541,14 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
web_page_reference
,
credential
)
web_page_reference
,
credential
)
self
.
assertEqual
(
response
.
getHeader
(
'content-type'
),
self
.
assertEqual
(
response
.
getHeader
(
'content-type'
),
'text/html; charset=utf-8'
)
'text/html; charset=utf-8'
)
self
.
assertIn
(
'<form'
,
response
.
getBody
())
# means the web_page
# means the web_page is rendered in web_site context
# is rendered in web_site context
self
.
assertIn
(
b'<form'
,
response
.
getBody
())
response
=
self
.
publish
(
website
.
absolute_url_path
()
+
'/'
+
\
response
=
self
.
publish
(
website
.
absolute_url_path
()
+
'/'
+
\
web_page_reference
,
credential
)
web_page_reference
,
credential
)
self
.
assertEqual
(
response
.
getHeader
(
'content-type'
),
self
.
assertEqual
(
response
.
getHeader
(
'content-type'
),
'text/html; charset=utf-8'
)
'text/html; charset=utf-8'
)
self
.
assertIn
(
'<form'
,
response
.
getBody
())
# means the web_page
self
.
assertIn
(
b'<form'
,
response
.
getBody
())
# is rendered in web_site context
response
=
self
.
publish
(
website
.
absolute_url_path
()
+
'/'
+
\
response
=
self
.
publish
(
website
.
absolute_url_path
()
+
'/'
+
\
web_page_reference
+
'?format=pdf'
,
credential
)
web_page_reference
+
'?format=pdf'
,
credential
)
...
@@ -645,7 +627,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
...
@@ -645,7 +627,7 @@ class TestERP5WebWithDms(ERP5TypeTestCase, ZopeTestCase.Functional):
self
.
assertEqual
(
modification_date
,
last_modified_header
)
self
.
assertEqual
(
modification_date
,
last_modified_header
)
# Upload a presentation with 3 pages.
# Upload a presentation with 3 pages.
upload_file
=
makeFileUpload
(
'P-DMS-Presentation.3.Pages-001-en.odp'
)
upload_file
=
self
.
makeFileUpload
(
'P-DMS-Presentation.3.Pages-001-en.odp'
)
document
=
document_module
.
newContent
(
portal_type
=
'Presentation'
,
document
=
document_module
.
newContent
(
portal_type
=
'Presentation'
,
file
=
upload_file
)
file
=
upload_file
)
reference
=
'P-DMS-Presentation-001-.3.Pages'
reference
=
'P-DMS-Presentation-001-.3.Pages'
...
@@ -713,7 +695,7 @@ return True
...
@@ -713,7 +695,7 @@ return True
website
.
newContent
(
portal_type
=
web_section_portal_type
)
website
.
newContent
(
portal_type
=
web_section_portal_type
)
document_reference
=
'tiolive-ERP5.Freedom.TioLive'
document_reference
=
'tiolive-ERP5.Freedom.TioLive'
upload_file
=
makeFileUpload
(
'tiolive-ERP5.Freedom.TioLive-001-en.odp'
)
upload_file
=
self
.
makeFileUpload
(
'tiolive-ERP5.Freedom.TioLive-001-en.odp'
)
document
=
self
.
portal
.
document_module
.
newContent
(
document
=
self
.
portal
.
document_module
.
newContent
(
portal_type
=
'Presentation'
,
portal_type
=
'Presentation'
,
reference
=
document_reference
,
reference
=
document_reference
,
...
@@ -727,7 +709,7 @@ return True
...
@@ -727,7 +709,7 @@ return True
credential
)
credential
)
self
.
assertTrue
(
response
.
getHeader
(
'content-type'
).
startswith
(
'text/html'
))
self
.
assertTrue
(
response
.
getHeader
(
'content-type'
).
startswith
(
'text/html'
))
html
=
response
.
getBody
()
html
=
response
.
getBody
()
self
.
assert
True
(
'<img'
in
html
,
html
)
self
.
assert
In
(
b'<img'
,
html
)
# find the img src
# find the img src
img_list
=
etree
.
HTML
(
html
).
findall
(
'.//img'
)
img_list
=
etree
.
HTML
(
html
).
findall
(
'.//img'
)
...
@@ -739,7 +721,7 @@ return True
...
@@ -739,7 +721,7 @@ return True
credential
)
credential
)
self
.
assertEqual
(
response
.
getHeader
(
'content-type'
),
'image/png'
)
self
.
assertEqual
(
response
.
getHeader
(
'content-type'
),
'image/png'
)
png
=
response
.
getBody
()
png
=
response
.
getBody
()
self
.
assertTrue
(
png
.
startswith
(
'
\
x89
PNG'
))
self
.
assertTrue
(
png
.
startswith
(
b
'
\
x89
PNG'
))
# then publish the document and access it anonymously by reference through
# then publish the document and access it anonymously by reference through
# the web site
# the web site
...
@@ -751,7 +733,7 @@ return True
...
@@ -751,7 +733,7 @@ return True
website
.
absolute_url_path
(),
document_reference
))
website
.
absolute_url_path
(),
document_reference
))
self
.
assertTrue
(
response
.
getHeader
(
'content-type'
).
startswith
(
'text/html'
))
self
.
assertTrue
(
response
.
getHeader
(
'content-type'
).
startswith
(
'text/html'
))
html
=
response
.
getBody
()
html
=
response
.
getBody
()
self
.
assert
True
(
'<img'
in
html
,
html
)
self
.
assert
In
(
b'<img'
,
html
)
# find the img src
# find the img src
img_list
=
etree
.
HTML
(
html
).
findall
(
'.//img'
)
img_list
=
etree
.
HTML
(
html
).
findall
(
'.//img'
)
...
@@ -763,7 +745,7 @@ return True
...
@@ -763,7 +745,7 @@ return True
website
.
absolute_url_path
(),
document_reference
,
src
))
website
.
absolute_url_path
(),
document_reference
,
src
))
self
.
assertEqual
(
response
.
getHeader
(
'content-type'
),
'image/png'
)
self
.
assertEqual
(
response
.
getHeader
(
'content-type'
),
'image/png'
)
png
=
response
.
getBody
()
png
=
response
.
getBody
()
self
.
assertTrue
(
png
.
startswith
(
'
\
x89
PNG'
))
self
.
assertTrue
(
png
.
startswith
(
b
'
\
x89
PNG'
))
# Now purge cache and let Anonymous user converting the document.
# Now purge cache and let Anonymous user converting the document.
self
.
login
()
self
.
login
()
...
@@ -773,7 +755,7 @@ return True
...
@@ -773,7 +755,7 @@ return True
website
.
absolute_url_path
(),
document_reference
))
website
.
absolute_url_path
(),
document_reference
))
self
.
assertTrue
(
response
.
getHeader
(
'content-type'
).
startswith
(
'text/html'
))
self
.
assertTrue
(
response
.
getHeader
(
'content-type'
).
startswith
(
'text/html'
))
html
=
response
.
getBody
()
html
=
response
.
getBody
()
self
.
assert
True
(
'<img'
in
html
,
html
)
self
.
assert
In
(
b'<img'
,
html
)
# find the img src
# find the img src
img_list
=
etree
.
HTML
(
html
).
findall
(
'.//img'
)
img_list
=
etree
.
HTML
(
html
).
findall
(
'.//img'
)
...
@@ -805,10 +787,9 @@ return True
...
@@ -805,10 +787,9 @@ return True
text_content
=
content
)
text_content
=
content
)
web_page
.
publish
()
web_page
.
publish
()
image_reference
=
'NXD-IMAGE'
image_reference
=
'NXD-IMAGE'
module
=
portal
.
getDefaultModule
(
portal_type
=
image_portal_type
)
module
=
portal
.
getDefaultModule
(
portal_type
=
image_portal_type
)
upload_file
=
makeFileUpload
(
'tiolive-ERP5.Freedom.TioLive.Logo-001-en.png'
)
upload_file
=
self
.
makeFileUpload
(
'tiolive-ERP5.Freedom.TioLive.Logo-001-en.png'
)
image
=
module
.
newContent
(
portal_type
=
image_portal_type
,
image
=
module
.
newContent
(
portal_type
=
image_portal_type
,
file
=
upload_file
,
file
=
upload_file
,
reference
=
image_reference
)
reference
=
image_reference
)
...
@@ -878,7 +859,7 @@ return True
...
@@ -878,7 +859,7 @@ return True
"""
"""
portal
=
self
.
portal
portal
=
self
.
portal
module
=
portal
.
getDefaultModule
(
portal_type
=
portal_type
)
module
=
portal
.
getDefaultModule
(
portal_type
=
portal_type
)
upload_file
=
makeFileUpload
(
'%s.svg'
%
filename
)
upload_file
=
self
.
makeFileUpload
(
'%s.svg'
%
filename
)
image
=
module
.
newContent
(
portal_type
=
portal_type
,
image
=
module
.
newContent
(
portal_type
=
portal_type
,
file
=
upload_file
,
file
=
upload_file
,
reference
=
"NXD-DOCUMENT"
)
reference
=
"NXD-DOCUMENT"
)
...
@@ -887,10 +868,10 @@ return True
...
@@ -887,10 +868,10 @@ return True
self
.
assertEqual
(
image
.
getContentType
(),
'image/svg+xml'
)
self
.
assertEqual
(
image
.
getContentType
(),
'image/svg+xml'
)
mime
,
converted_data
=
image
.
convert
(
"png"
)
mime
,
converted_data
=
image
.
convert
(
"png"
)
self
.
assertEqual
(
mime
,
'image/png'
)
self
.
assertEqual
(
mime
,
'image/png'
)
expected_image
=
makeFileUpload
(
'%s.png'
%
filename
)
expected_image
=
self
.
makeFileUpload
(
'%s.png'
%
filename
)
# Compare images and accept some minimal difference,
# Compare images and accept some minimal difference,
difference_value
=
compare_image
(
String
IO
(
converted_data
),
expected_image
)
difference_value
=
compare_image
(
io
.
Bytes
IO
(
converted_data
),
expected_image
)
self
.
assertTrue
(
difference_value
<
IMAGE_COMPARE_TOLERANCE
,
self
.
assertTrue
(
difference_value
<
IMAGE_COMPARE_TOLERANCE
,
"Conversion from svg to png create one too small image, "
+
\
"Conversion from svg to png create one too small image, "
+
\
"so it failed to download the image. (%s >= %s)"
%
(
difference_value
,
"so it failed to download the image. (%s >= %s)"
%
(
difference_value
,
...
@@ -902,8 +883,8 @@ return True
...
@@ -902,8 +883,8 @@ return True
"""
"""
portal
=
self
.
portal
portal
=
self
.
portal
module
=
portal
.
getDefaultModule
(
portal_type
=
portal_type
)
module
=
portal
.
getDefaultModule
(
portal_type
=
portal_type
)
upload_file
=
makeFileUpload
(
'user-TESTSVG-CASE-URL-TEMPLATE.svg'
)
upload_file
=
self
.
makeFileUpload
(
'user-TESTSVG-CASE-URL-TEMPLATE.svg'
)
svg_content
=
upload_file
.
read
().
replace
(
"REPLACE_THE_URL_HERE"
,
image_url
)
svg_content
=
upload_file
.
read
().
replace
(
b"REPLACE_THE_URL_HERE"
,
image_url
.
encode
()
)
# Add image using data instead file this time as it is not the goal of
# Add image using data instead file this time as it is not the goal of
# This test assert this topic.
# This test assert this topic.
...
@@ -917,10 +898,10 @@ return True
...
@@ -917,10 +898,10 @@ return True
self
.
assertEqual
(
image
.
getContentType
(),
'image/svg+xml'
)
self
.
assertEqual
(
image
.
getContentType
(),
'image/svg+xml'
)
mime
,
converted_data
=
image
.
convert
(
"png"
)
mime
,
converted_data
=
image
.
convert
(
"png"
)
self
.
assertEqual
(
mime
,
'image/png'
)
self
.
assertEqual
(
mime
,
'image/png'
)
expected_image
=
makeFileUpload
(
'user-TESTSVG-CASE-URL.png'
)
expected_image
=
self
.
makeFileUpload
(
'user-TESTSVG-CASE-URL.png'
)
# Compare images and accept some minimal difference,
# Compare images and accept some minimal difference,
difference_value
=
compare_image
(
String
IO
(
converted_data
),
expected_image
)
difference_value
=
compare_image
(
io
.
Bytes
IO
(
converted_data
),
expected_image
)
self
.
assertTrue
(
difference_value
<
IMAGE_COMPARE_TOLERANCE
,
self
.
assertTrue
(
difference_value
<
IMAGE_COMPARE_TOLERANCE
,
"Conversion from svg to png create one too small image, "
+
\
"Conversion from svg to png create one too small image, "
+
\
"so it failed to download the image. (%s >= %s)"
%
(
difference_value
,
"so it failed to download the image. (%s >= %s)"
%
(
difference_value
,
...
@@ -944,7 +925,7 @@ return True
...
@@ -944,7 +925,7 @@ return True
"""
"""
portal
=
self
.
portal
portal
=
self
.
portal
module
=
portal
.
getDefaultModule
(
portal_type
=
portal_type
)
module
=
portal
.
getDefaultModule
(
portal_type
=
portal_type
)
upload_file
=
makeFileUpload
(
'user-TESTSVG-BACKGROUND-IMAGE.png'
)
upload_file
=
self
.
makeFileUpload
(
'user-TESTSVG-BACKGROUND-IMAGE.png'
)
background_image
=
module
.
newContent
(
portal_type
=
portal_type
,
background_image
=
module
.
newContent
(
portal_type
=
portal_type
,
file
=
upload_file
,
file
=
upload_file
,
reference
=
"NXD-BACKGROUND"
)
reference
=
"NXD-BACKGROUND"
)
...
@@ -965,14 +946,13 @@ return True
...
@@ -965,14 +946,13 @@ return True
"""
"""
portal
=
self
.
portal
portal
=
self
.
portal
module
=
portal
.
getDefaultModule
(
portal_type
=
portal_type
)
module
=
portal
.
getDefaultModule
(
portal_type
=
portal_type
)
upload_file
=
makeFileUpload
(
'user-TESTSVG-CASE-URL-TEMPLATE.svg'
)
upload_file
=
self
.
makeFileUpload
(
'user-TESTSVG-CASE-URL-TEMPLATE.svg'
)
svg_content
=
upload_file
.
read
().
replace
(
"REPLACE_THE_URL_HERE"
,
svg_content
=
upload_file
.
read
().
replace
(
b"REPLACE_THE_URL_HERE"
,
"http://soidjsoidjqsoijdqsoidjqsdoijsqd.idjsijds/../user-XXX-XXX"
)
b"http://soidjsoidjqsoijdqsoidjqsdoijsqd.idjsijds/../user-XXX-XXX"
)
upload_file
=
makeFileUpload
(
'user-TESTSVG-CASE-URL-TEMPLATE.svg'
)
svg2_content
=
upload_file
.
read
().
replace
(
"REPLACE_THE_URL_HERE"
,
"https://www.erp5.com/usXXX-XXX"
)
upload_file
=
self
.
makeFileUpload
(
'user-TESTSVG-CASE-URL-TEMPLATE.svg'
)
svg2_content
=
upload_file
.
read
().
replace
(
b"REPLACE_THE_URL_HERE"
,
b"https://www.erp5.com/usXXX-XXX"
)
# Add image using data instead file this time as it is not the goal of
# Add image using data instead file this time as it is not the goal of
# This test assert this topic.
# This test assert this topic.
...
@@ -1677,7 +1657,7 @@ return True
...
@@ -1677,7 +1657,7 @@ return True
break
break
else
:
else
:
raise
LookupError
(
"No action with reference 'web_view' found"
)
raise
LookupError
(
"No action with reference 'web_view' found"
)
assert
action
.
getVisible
()
is
1
self
.
assertTrue
(
action
.
getVisible
())
# check when the file is empty
# check when the file is empty
document_object
=
portal
[
module_id
].
newContent
(
portal_type
=
portal_type
)
document_object
=
portal
[
module_id
].
newContent
(
portal_type
=
portal_type
)
...
@@ -1689,6 +1669,10 @@ return True
...
@@ -1689,6 +1669,10 @@ return True
document_object
.
getId
())
document_object
.
getId
())
response_a
=
self
.
publish
(
path
)
response_a
=
self
.
publish
(
path
)
action
.
setVisible
(
0
)
action
.
setVisible
(
0
)
def
cleanup
():
action
.
setVisible
(
1
)
self
.
tic
()
self
.
addCleanup
(
cleanup
)
self
.
tic
()
self
.
tic
()
response_b
=
self
.
publish
(
path
)
response_b
=
self
.
publish
(
path
)
self
.
assertNotEqual
(
response_a
.
getBody
(),
response_b
.
getBody
())
self
.
assertNotEqual
(
response_a
.
getBody
(),
response_b
.
getBody
())
...
...
bt5/erp5_dms/TestTemplateItem/portal_components/test.erp5.testWebCrawler.py
View file @
ce2a1eda
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
#
#
##############################################################################
##############################################################################
import
six
import
unittest
import
unittest
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.ERP5TypeTestCase
import
ERP5TypeTestCase
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
,
removeZODBPythonScript
from
Products.ERP5Type.tests.utils
import
createZODBPythonScript
,
removeZODBPythonScript
...
@@ -209,11 +210,15 @@ class TestWebCrawler(ERP5TypeTestCase):
...
@@ -209,11 +210,15 @@ class TestWebCrawler(ERP5TypeTestCase):
</html>"""
</html>"""
web_page
.
edit
(
text_content
=
text_content
)
web_page
.
edit
(
text_content
=
text_content
)
self
.
assertEqual
(
web_page
.
getContentBaseURL
(),
"http://www.example.com"
)
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
\
xa9
crit'
self
.
assertEqual
(
web_page
.
getContentNormalisedURLList
(),
self
.
assertEqual
(
web_page
.
getContentNormalisedURLList
(),
[
"http://www.example.com/I don't care I put what/ I want/"
,
[
"http://www.example.com/I don't care I put what/ I want/"
,
'http://www.example.com/section'
,
'http://www.example.com/section'
,
'http://www.example.com/section2'
,
'http://www.example.com/section2'
,
'http://www.example.com/?title=
\
xc3
\
xa9
crit'
,])
expected_encoded_url
,
])
# relative links without base tag
# relative links without base tag
text_content
=
"""<html>
text_content
=
"""<html>
<head>
<head>
...
...
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