From 3c3b4ed706f571e7d24fb916edd9f49e229b7952 Mon Sep 17 00:00:00 2001 From: str4d <str4d@mail.i2p> Date: Thu, 20 Dec 2012 04:46:37 +0000 Subject: [PATCH] Moved ver() into templatevars so only need to change I2P version in one place --- i2p2www/pages/global/layout.html | 2 +- i2p2www/pages/global/macros | 6 ------ i2p2www/templatevars.py | 8 +++++++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/i2p2www/pages/global/layout.html b/i2p2www/pages/global/layout.html index b6d01ae62..3d375aa31 100644 --- a/i2p2www/pages/global/layout.html +++ b/i2p2www/pages/global/layout.html @@ -1,4 +1,4 @@ -{%- from "global/macros" import change_lang, ver with context -%} +{%- from "global/macros" import change_lang with context -%} <!DOCTYPE html> <html lang="en"> <head> diff --git a/i2p2www/pages/global/macros b/i2p2www/pages/global/macros index 074b2b7b0..1d709ff09 100644 --- a/i2p2www/pages/global/macros +++ b/i2p2www/pages/global/macros @@ -8,12 +8,6 @@ {%- endif -%} {%- endmacro -%} -{%- macro ver(string=None) -%} -{%- if string -%}{{ string % '0.9.4' }} -{%- else -%}{{ '0.9.4' }} -{%- endif -%} -{%- endmacro -%} - {%- macro render_pagination(pagination) %} <div class="pagination"> {%- if pagination.has_prev %} diff --git a/i2p2www/templatevars.py b/i2p2www/templatevars.py index 3790f5055..cef67d246 100644 --- a/i2p2www/templatevars.py +++ b/i2p2www/templatevars.py @@ -1,6 +1,6 @@ from flask import g, request, url_for -from i2p2www import CANONICAL_DOMAIN, app +from i2p2www import CANONICAL_DOMAIN, CURRENT_I2P_VERSION, app I2P_TO_CLEAR = { 'www.i2p2.i2p': 'www.i2p2.de', @@ -79,10 +79,16 @@ def utility_processor(): # Probably a 404 error page return url_for('main_index', **args) + def get_current_version(string=None): + if string: + return string % CURRENT_I2P_VERSION + return CURRENT_I2P_VERSION + return dict(i2pconv=convert_url_to_clearnet, url_for_other_page=url_for_other_page, change_theme=change_theme, site_url=get_site_url, get_url=get_url_with_lang, get_flag=get_flag, + ver=get_current_version, canonical=get_canonical_link) -- GitLab