[gen] Bigfixees in cleaning of XHTML fields.
This commit is contained in:
parent
f4e40caf5c
commit
90e46f11e7
|
@ -1067,6 +1067,12 @@ class ToolMixin(BaseMixin):
|
||||||
names are normalized.'''
|
names are normalized.'''
|
||||||
tool = self.appy()
|
tool = self.appy()
|
||||||
if not login: login = tool.user.getId()
|
if not login: login = tool.user.getId()
|
||||||
|
# Manage the special case of an anonymous user.
|
||||||
|
if login == 'Anonymous User':
|
||||||
|
name = self.translate('anonymous')
|
||||||
|
if normalized: name = normalizeString(name)
|
||||||
|
return name
|
||||||
|
# Manage the case of a "real" user.
|
||||||
user = tool.search1('User', noSecurity=True, login=login)
|
user = tool.search1('User', noSecurity=True, login=login)
|
||||||
if not user: return login
|
if not user: return login
|
||||||
firstName = user.firstName
|
firstName = user.firstName
|
||||||
|
|
|
@ -29,7 +29,7 @@ appyLabels = [
|
||||||
('appy_title', 'Title'),
|
('appy_title', 'Title'),
|
||||||
('data_change', 'Data change'),
|
('data_change', 'Data change'),
|
||||||
('modified_field', 'Modified field'),
|
('modified_field', 'Modified field'),
|
||||||
('previous_value', 'Previous value'),
|
('previous_value', 'Previous value or modification'),
|
||||||
('phase', 'phase'),
|
('phase', 'phase'),
|
||||||
('choose_a_value', ' - '),
|
('choose_a_value', ' - '),
|
||||||
('choose_a_doc', '[ Documents ]'),
|
('choose_a_doc', '[ Documents ]'),
|
||||||
|
@ -200,6 +200,7 @@ appyLabels = [
|
||||||
('history_delete', 'Deleted by ${userName}'),
|
('history_delete', 'Deleted by ${userName}'),
|
||||||
('changes_show', 'Show changes'),
|
('changes_show', 'Show changes'),
|
||||||
('changes_hide', 'Hide changes'),
|
('changes_hide', 'Hide changes'),
|
||||||
|
('anonymous', 'an anonymous user'),
|
||||||
]
|
]
|
||||||
|
|
||||||
# Some default values for labels whose ids are not fixed (so they can't be
|
# Some default values for labels whose ids are not fixed (so they can't be
|
||||||
|
|
|
@ -190,7 +190,7 @@
|
||||||
</tal:accessHistory>
|
</tal:accessHistory>
|
||||||
|
|
||||||
<tal:comment replace="nothing">Document creator</tal:comment>
|
<tal:comment replace="nothing">Document creator</tal:comment>
|
||||||
<tal:creator condition="python: creator != 'Anonymous User'">
|
<tal:creator>
|
||||||
<tal:by replace="python: _('object_created_by')"/>
|
<tal:by replace="python: _('object_created_by')"/>
|
||||||
<tal:creator replace="python: tool.getUserName(creator)"/>
|
<tal:creator replace="python: tool.getUserName(creator)"/>
|
||||||
</tal:creator>
|
</tal:creator>
|
||||||
|
|
|
@ -1085,10 +1085,12 @@ class XhtmlCleaner(XmlParser):
|
||||||
# This is the end of a sub-tag within a region that we must ignore.
|
# This is the end of a sub-tag within a region that we must ignore.
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
if self.env.currentContent:
|
||||||
self.res.append(self.env.currentContent)
|
self.res.append(self.env.currentContent)
|
||||||
# Add a line break after the end tag if required (ie: xhtml differ
|
# Add a line break after the end tag if required (ie: xhtml differ
|
||||||
# needs to get paragraphs and other elements on separate lines).
|
# needs to get paragraphs and other elements on separate lines).
|
||||||
if elem in self.lineBreakTags:
|
if (elem in self.lineBreakTags) and self.res and \
|
||||||
|
(self.res[-1][-1] != '\n'):
|
||||||
suffix = '\n'
|
suffix = '\n'
|
||||||
else:
|
else:
|
||||||
suffix = ''
|
suffix = ''
|
||||||
|
@ -1098,10 +1100,11 @@ class XhtmlCleaner(XmlParser):
|
||||||
def characters(self, content):
|
def characters(self, content):
|
||||||
if self.env.ignoreContent: return
|
if self.env.ignoreContent: return
|
||||||
# Remove blanks that ckeditor may add just after a start tag
|
# Remove blanks that ckeditor may add just after a start tag
|
||||||
if not self.env.currentContent or (self.env.currentContent == ' '):
|
if not self.env.currentContent or \
|
||||||
toAdd = ' ' + content.lstrip()
|
self.env.currentContent[-1] in ('\n', ' '):
|
||||||
|
toAdd = content.lstrip()
|
||||||
else:
|
else:
|
||||||
toAdd = content
|
toAdd = content
|
||||||
# Re-transform XML special chars to entities.
|
# Re-transform XML special chars to entities.
|
||||||
self.env.currentContent += cgi.escape(content)
|
self.env.currentContent += cgi.escape(toAdd)
|
||||||
# ------------------------------------------------------------------------------
|
# ------------------------------------------------------------------------------
|
||||||
|
|
Loading…
Reference in a new issue