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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kasra Jamshidi
erp5
Commits
10445878
Commit
10445878
authored
Jan 20, 2012
by
Ivan Tyagov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Only textual conversions can use substitution. Add testing for this change.
parent
f7ea2361
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
8 deletions
+12
-8
product/ERP5/Document/TextDocument.py
product/ERP5/Document/TextDocument.py
+7
-5
product/ERP5OOo/tests/testDms.py
product/ERP5OOo/tests/testDms.py
+5
-3
No files found.
product/ERP5/Document/TextDocument.py
View file @
10445878
...
@@ -36,7 +36,7 @@ from Products.ERP5.Document.Document import Document, ConversionError, _MARKER,
...
@@ -36,7 +36,7 @@ from Products.ERP5.Document.Document import Document, ConversionError, _MARKER,
from
Products.ERP5.Document.File
import
File
from
Products.ERP5.Document.File
import
File
from
Products.ERP5Type.WebDAVSupport
import
TextContent
from
Products.ERP5Type.WebDAVSupport
import
TextContent
import
re
import
re
from
Products.ERP5.Document.Document
import
VALID_IMAGE_FORMAT_LIST
from
Products.ERP5.Document.Document
import
VALID_IMAGE_FORMAT_LIST
,
VALID_TEXT_FORMAT_LIST
import
cStringIO
import
cStringIO
from
string
import
Template
from
string
import
Template
...
@@ -179,10 +179,12 @@ class TextDocument(CachedConvertableMixin, BaseConvertableFileMixin,
...
@@ -179,10 +179,12 @@ class TextDocument(CachedConvertableMixin, BaseConvertableFileMixin,
self
.
setConversion
(
result
,
original_mime_type
,
**
kw
)
self
.
setConversion
(
result
,
original_mime_type
,
**
kw
)
else
:
else
:
mime_type
,
result
=
self
.
getConversion
(
**
kw
)
mime_type
,
result
=
self
.
getConversion
(
**
kw
)
if
substitution_method_parameter_dict
is
None
:
if
format
in
VALID_TEXT_FORMAT_LIST
:
substitution_method_parameter_dict
=
{}
# only textual content can be sustituted
result
=
self
.
_substituteTextContent
(
result
,
safe_substitute
=
safe_substitute
,
if
substitution_method_parameter_dict
is
None
:
**
substitution_method_parameter_dict
)
substitution_method_parameter_dict
=
{}
result
=
self
.
_substituteTextContent
(
result
,
safe_substitute
=
safe_substitute
,
**
substitution_method_parameter_dict
)
return
original_mime_type
,
result
return
original_mime_type
,
result
else
:
else
:
# text_content is not set, return empty string instead of None
# text_content is not set, return empty string instead of None
...
...
product/ERP5OOo/tests/testDms.py
View file @
10445878
...
@@ -2091,7 +2091,9 @@ return 1
...
@@ -2091,7 +2091,9 @@ return 1
image_document
.
edit
(
file
=
upload_file
)
image_document
.
edit
(
file
=
upload_file
)
web_page_document
=
self
.
portal
.
web_page_module
.
newContent
(
portal_type
=
"Web Page"
)
web_page_document
=
self
.
portal
.
web_page_module
.
newContent
(
portal_type
=
"Web Page"
)
web_page_document
.
setTextContent
(
'<b> test </b>'
)
web_page_document
.
setTextContent
(
'<b> test </b> $website_url $website_url'
)
# a Web Page can generate dynamic text so test is as well
web_page_document
.
setTextContentSubstitutionMappingMethodId
(
'WebPage_getStandardSubstitutionMappingDict'
)
self
.
stepTic
()
self
.
stepTic
()
ooo_document_url
=
'%s/%s'
%
(
self
.
portal
.
absolute_url
(),
ooo_document
.
getRelativeUrl
())
ooo_document_url
=
'%s/%s'
%
(
self
.
portal
.
absolute_url
(),
ooo_document
.
getRelativeUrl
())
...
@@ -2704,8 +2706,8 @@ class TestDocumentPerformance(TestDocumentMixin):
...
@@ -2704,8 +2706,8 @@ class TestDocumentPerformance(TestDocumentMixin):
def
test_suite
():
def
test_suite
():
suite
=
unittest
.
TestSuite
()
suite
=
unittest
.
TestSuite
()
suite
.
addTest
(
unittest
.
makeSuite
(
TestDocument
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestDocument
))
suite
.
addTest
(
unittest
.
makeSuite
(
TestDocumentWithSecurity
))
#
suite.addTest(unittest.makeSuite(TestDocumentWithSecurity))
suite
.
addTest
(
unittest
.
makeSuite
(
TestDocumentPerformance
))
#
suite.addTest(unittest.makeSuite(TestDocumentPerformance))
return
suite
return
suite
...
...
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