1 # -*- coding: utf-8 -*-
2 # This file is part of django-ssify, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See README.md for more information.
5 from __future__ import unicode_literals
6 from django import template
7 from ssify import ssi_variable
8 from tests.views import QUOTES
10 register = template.Library()
13 @ssi_variable(register)
14 def random_number(request, limit):
15 # Guaranteed to be random as of XKCD#221
16 return min(limit - 1, 4)
19 @ssi_variable(register)
20 def number_of_quotes(request):
24 @ssi_variable(register)
25 def quote_len_odd(request, which):
26 return bool(len(QUOTES[which]) % 1)