1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
Description: Removed function which wouldn't work in Python 3.2
Author: Thomas Goirand <zigo@debian.org>
Forwarded: no
Last-Update: 2014-08-12
--- python-jingo-0.7.orig/jingo/helpers.py
+++ python-jingo-0.7/jingo/helpers.py
@@ -58,18 +58,6 @@ def nl2br(string):
@register.filter
-def datetime(t, fmt=None):
- """Call ``datetime.strftime`` with the given format string."""
- if fmt is None:
- fmt = _(u'%B %e, %Y')
- if not six.PY3:
- # The datetime.strftime function strictly does not
- # support Unicode in Python 2 but is Unicode only in 3.x.
- fmt = fmt.encode('utf-8')
- return smart_text(t.strftime(fmt)) if t else ''
-
-
-@register.filter
def ifeq(a, b, text):
"""Return ``text`` if ``a == b``."""
return jinja2.Markup(text if a == b else '')
--- python-jingo-0.7.orig/jingo/tests/test_helpers.py
+++ python-jingo-0.7/jingo/tests/test_helpers.py
@@ -61,23 +61,6 @@ def test_nl2br():
eq_(s, '')
-def test_datetime():
- time = datetime(2009, 12, 25, 10, 11, 12)
- s = render('{{ d|datetime }}', {'d': time})
- eq_(s, 'December 25, 2009')
-
- s = render('{{ d|datetime("%Y-%m-%d %H:%M:%S") }}', {'d': time})
- eq_(s, '2009-12-25 10:11:12')
-
- s = render('{{ None|datetime }}')
- eq_(s, '')
-
-
-def test_datetime_unicode():
- fmt = u"%Y 年 %m 月 %e 日"
- helpers.datetime(datetime.now(), fmt)
-
-
def test_ifeq():
eq_context = {'a': 1, 'b': 1}
neq_context = {'a': 1, 'b': 2}
|