Permalink
Browse files

Transform udata_version jinja global into reusable package_version (#768

)
  • Loading branch information...
noirbizarre committed Feb 17, 2017
1 parent 930a382 commit 62ca496cf3ff3a345ab7b4441cdf1da8376fe094
Showing with 7 additions and 5 deletions.
  1. +1 −0 CHANGELOG.md
  2. +3 −3 udata/frontend/helpers.py
  3. +2 −2 udata/templates/footer.html
  4. +1 −0 udata/theme.py
@@ -3,6 +3,7 @@
## Current (in progress)
- Fix assets packaging for production [#763](https://github.com/opendatateam/udata/pull/763) [#765](https://github.com/opendatateam/udata/pull/765)
- Transform `udata_version` jinja global into a reusable (by themes) `package_version` [#768](https://github.com/opendatateam/udata/pull/768)
## 1.0.1 (2017-02-16)
@@ -25,8 +25,8 @@
@front.app_template_global()
def udata_version():
return pkg_resources.get_distribution('udata').version
def package_version(name):
return pkg_resources.get_distribution(name).version
@front.app_template_global()
@@ -39,7 +39,7 @@ def static_global(filename, _burst=True, **kwargs):
if current_app.config['DEBUG'] or current_app.config['TESTING']:
burst = time()
else:
burst = udata_version()
burst = package_version('udata')
if _burst:
kwargs['_'] = burst
return url_for('static', filename=filename, **kwargs)
@@ -1,12 +1,12 @@
{# Cache footer for 24h #}
{% cache 86400, 'footer', udata_version() %}
{% cache 86400, 'footer', package_version('udata') %}
<footer>
<div class="container">
<div class="row">
<div class="col-lg-12">
<p>
<a href="https://github.com/opendatateam/udata/">UData</a>
<a href="https://udata.readthedocs.io/en/latest/changelog/">v{{ udata_version() }}</a>
<a href="https://pypi.python.org/pypi/udata/{{ package_version('udata') }}/">v{{ package_version('udata') }}</a>
- Copyright &copy; Opendata Team {{ now()|dateformat(format='yyyy') }}
</p>
</div>
@@ -29,6 +29,7 @@ def get_current_theme():
g.theme.configure()
return g.theme
current = LocalProxy(get_current_theme)

0 comments on commit 62ca496

Please sign in to comment.