• {# if both of them have URLs #} {% if change.new_url != "" and change.old_url != "" %} {{ _('Changed the license of {pkg_link} to {new_link} (previously {old_link})').format( pkg_link = '{pkg_name}'.format( pkg_url = h.url_for(controller='dataset', action='read', id=change.pkg_id), pkg_name = change.title )|safe, new_link = '{new_title}'.format( new_url = change.new_url, new_title = change.new_title )|safe, old_link = '{old_title}'.format( old_url = change.old_url, old_title = change.old_title )|safe ) }} {# if only the new one has a URL #} {% elif change.new_url != "" and change.old_url == "" %} {{ _('Changed the license of {pkg_link} to {new_link} (previously {old_title})').format( pkg_link = '{pkg_name}'.format( pkg_url = h.url_for(controller='dataset', action='read', id=change.pkg_id), pkg_name = change.title )|safe, new_link = '{new_title}'.format( new_url = change.new_url, new_title = change.new_title, )|safe, old_title = change.old_title ) }} {# if only the old one has a URL #} {% elif change.new_url == "" and change.old_url != "" %} {{ _('Changed the license of {pkg_link} to {new_title} (previously {old_link})').format( pkg_link = '{pkg_name}'.format( pkg_url = h.url_for(controller='dataset', action='read', id=change.pkg_id), pkg_name = change.title )|safe, new_title = change.new_title, old_link = '{old_title}'.format( old_url = change.old_url, old_title = change.old_title )|safe )}} {# otherwise neither has a URL #} {% else %} {{ _('Changed the license of {pkg_link} to {new_title} (previously {old_title})').format( pkg_link = '{pkg_name}'.format( pkg_url = h.url_for(controller='dataset', action='read', id=change.pkg_id), pkg_name = change.title )|safe, new_title = change.new_title, old_title = change.old_title )|safe }} {% endif %}