Skip to content

Commit

Permalink
Add UTC timezone to xml (#360)
Browse files Browse the repository at this point in the history
* Add local_timezone filter to plugins.xml

* Retun directly utc date for plugins.xml
  • Loading branch information
Xpirix authored Feb 20, 2024
1 parent d8871b1 commit 8dec75d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 3 additions & 3 deletions qgis-app/plugins/templates/plugins/plugins.xml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% load static %}<?xml version = '1.0' encoding = 'UTF-8'?>
{% load static %}{% load local_timezone %}<?xml version = '1.0' encoding = 'UTF-8'?>
<?xml-stylesheet type="text/xsl" href="{% static "style/plugins.xsl" %}" ?>
<plugins>
{% for version in object_list %}<pyqgis_plugin name="{{version.plugin.name}}" version="{{ version.version }}" plugin_id="{{version.plugin.id }}">
Expand All @@ -14,8 +14,8 @@
<author_name><![CDATA[{% firstof version.plugin.author version.plugin.created_by %}]]></author_name>
<download_url>{% if request.is_secure %}https{% else %}http{% endif %}://{{ request.get_host }}{{ version.get_download_url }}</download_url>
<uploaded_by><![CDATA[{{ version.created_by }}]]></uploaded_by>
<create_date>{{ version.plugin.created_on.isoformat }}</create_date>
<update_date>{{ version.created_on.isoformat }}</update_date>
<create_date>{{ version.plugin.created_on|local_timezone:"WITH-UTC" }}</create_date>
<update_date>{{ version.created_on|local_timezone:"WITH-UTC" }}</update_date>
<experimental>{% if version.experimental %}True{% else%}False{% endif %}</experimental>
<deprecated>{{ version.plugin.deprecated }}</deprecated>
<tracker><![CDATA[{{ version.plugin.tracker }}]]></tracker>
Expand Down
2 changes: 2 additions & 0 deletions qgis-app/plugins/templatetags/local_timezone.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ def local_timezone(date, args="LONG"):
result = '<span class="user-timezone-short">%s</span>' % (utcdate,)
elif args and str(args) == "SHORT_NATURAL_DAY":
result = '<span class="user-timezone-short-naturalday">%s</span>' % (utcdate,)
elif args and str(args) == "WITH-UTC":
result = utcdate
else:
result = '<span class="user-timezone">%s</span>' % (utcdate,)
except AttributeError:
Expand Down

0 comments on commit 8dec75d

Please sign in to comment.