Commit 61ba0e3f authored by Yoshinori Okuji's avatar Yoshinori Okuji

If a substitution mapping method is not found, skip substitutions rather than...

If a substitution mapping method is not found, skip substitutions rather than raising an exception. This may happen when a web page is viewed directly, for example.

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@21993 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3828cae9
...@@ -157,7 +157,11 @@ class TextDocument(Document, TextContent): ...@@ -157,7 +157,11 @@ class TextDocument(Document, TextContent):
# avoid encoding errors. # avoid encoding errors.
method_id = self.getTextContentSubstitutionMappingMethodId() method_id = self.getTextContentSubstitutionMappingMethodId()
if method_id: if method_id:
try:
mapping = guarded_getattr(self, method_id)(**kw) mapping = guarded_getattr(self, method_id)(**kw)
except AttributeError:
LOG('TextDocument', WARNING, 'could not get the substitution mapping method %s from %r, so the content will not be substituted.' % (method_id, self))
mapping = {}
is_str = isinstance(text, str) is_str = isinstance(text, str)
if is_str: if is_str:
......
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