Skip to content

Commit

Permalink
Fix of incorrect output of datapusher logs
Browse files Browse the repository at this point in the history
  • Loading branch information
smotornyuk committed Jul 5, 2017
1 parent fa17596 commit a91c397
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Expand Up @@ -20,6 +20,7 @@ v2.5.5 2017-06-29
* Fix filter results button not working for organization/group (#3620)
* Allow underscores in URL slug preview on create dataset (#3612)
* Create new resource view if resource format changed (#3515)
* Fixed incorrect escaping in `mail_to` and datapusher's log

v2.5.5 2017-03-22
=================
Expand Down
12 changes: 10 additions & 2 deletions ckan/lib/helpers.py
Expand Up @@ -19,8 +19,7 @@
from urllib import urlencode

from paste.deploy.converters import asbool
from webhelpers.html import escape, HTML, literal, url_escape
from webhelpers.html.tools import mail_to
from webhelpers.html import HTML, literal, url_escape
from webhelpers.html.tags import *
from webhelpers import paginate
from webhelpers.text import truncate
Expand All @@ -47,6 +46,7 @@
from ckan.common import (
_, ungettext, g, c, request, session, json, OrderedDict
)
from markupsafe import Markup, escape


MARKDOWN_TAGS = set([
Expand Down Expand Up @@ -2157,6 +2157,13 @@ def license_options(existing_license_id=None):
for license_id in license_ids]


def mail_to(email_address, name):
email = escape(email_address)
author = escape(name)
html = Markup(u'<a href=mailto:{0}>{1}</a>'.format(email, author))
return html


# these are the functions that will end up in `h` template helpers
__allowed_functions__ = [
# functions defined in ckan.lib.helpers
Expand Down Expand Up @@ -2277,4 +2284,5 @@ def license_options(existing_license_id=None):
'check_config_permission',
'view_resource_url',
'license_options',
'clean_html',
]
2 changes: 1 addition & 1 deletion ckan/templates/package/resource_data.html
Expand Up @@ -71,7 +71,7 @@ <h3>{{ _('Upload Log') }}</h3>
{{ item.message | urlize }}<br>
<span class="date" title="{{ h.render_datetime(item.timestamp, with_hours=True) }}">
{{ h.time_ago_from_timestamp(item.timestamp) }}
<a href="#" data-target="popover" data-content="<dl>{% for key, value in item.iteritems() %}<dt>{{ key }}</dt><dd>{{ value }}</dd>{% endfor %}</dl>" data-html="true">{{ _('Details') }}</a>
<a href="#" data-target="popover" data-content="<dl>{% for key, value in item.iteritems() %}<dt>{{ key }}</dt><dd>{{ h.clean_html(value) }}</dd>{% endfor %}</dl>" data-html="true">{{ _('Details') }}</a>
</span>
</p>
</li>
Expand Down

0 comments on commit a91c397

Please sign in to comment.