-
Notifications
You must be signed in to change notification settings - Fork 6
Description
needs to be fixed in
https://github.com/qld-gov-au/ckanext-data-qld/tree/develop/ckanext/data_qld/templates/activity_streams
ungettext changed to ngettext.
also:
jinja2.exceptions.UndefinedError: 'g' is undefined
jinja2.exceptions.UndefinedError: 'h' is undefined
File "/ckan_venv/src/ckanext-data-qld/ckanext/data_qld/templates/activity_streams/activity_stream_email_notifications.text", line 3, in top-level template code
{{ ungettext("You have {num} new activity on your {site_title} dashboard", "You have {num} new activities on your {site_title} dashboard", num).format(site_title=g.site_title, num=num) }}:
File "/ckan_venv/lib64/python3.7/site-packages/jinja2/utils.py", line 83, in from_obj
if hasattr(obj, "jinja_pass_arg"):
jinja2.exceptions.UndefinedError: 'ungettext' is undefined
2.10 is
{% set num = activities|length %}{{ ngettext("You have {num} new activity on your {site_title} dashboard", "You have {num} new activities on your {site_title} dashboard", num).format(site_title=g.site_title if g else site_title, num=num) }} {{ _('To view your dashboard, click on this link:') }}
{% url_for 'dashboard.index', _external=True %}
{{ _('You can turn off these email notifications in your {site_title} preferences. To change your preferences, click on this link:').format(site_title=g.site_title if g else site_title) }}
{% url_for 'user.edit', _external=True %}
ours is
{%- set num = activities|length -%}
{{ ungettext("You have {num} new activity on your {site_title} dashboard", "You have {num} new activities on your {site_title} dashboard", num).format(site_title=g.site_title, num=num) }}:
{% for activity in activities -%}
{%- set data = activity['data'] if activity['data'] else None -%}
{%- set activity_type = activity['activity_type'] if activity['activity_type'] else None -%}
{%- set id = activity['object_id'] -%}
{%- if data -%}
{%- if data['package'] -%}
{%- set name = data['package']['title'] -%}
{%- set action = 'dataset.read' -%}
{%- elif data['group'] -%}
{%- set name = data['group']['title'] -%}
{%- set action = 'organization.read' if activity_type == 'changed organization' else 'group.read' -%}
{%- endif -%}
{%- endif -%}
{% if action and id %}{{name}} ({{ h.activity_type_nice(activity_type)|capitalize }}) {{ h.url_for(action, id=id, _external=True) }}{% if activity_type %}{% endif %}{% endif %}
{% endfor %}
{{ _('To view your dashboard, click on this link:') }}
{{ g.site_url + '/dashboard' }}
{{ _('You can turn off these email notifications in your {site_title} preferences. To change your preferences, click on this link:').format(site_title=g.site_title) }}
{{ g.site_url + '/user/edit' }}