Coverage for /Users/davegaeddert/Development/dropseed/plain/plain/plain/templates/jinja/globals.py: 78%

1 from plain.paginator import Paginator

2 from plain.utils import timezone

3

4

5 def url(viewname, *args, **kwargs):

6 # A modified reverse that lets you pass args directly, excluding urlconf

7 from plain.urls import reverse

8

9 return reverse(viewname, args=args, kwargs=kwargs)

10

11

12 def asset(url_path):

13 # An explicit callable we can control, but also delay the import of asset.urls->views->templates

14 # for circular import reasons

15 from plain.assets.urls import get_asset_url

16

17 return get_asset_url(url_path)

18

19

20 default_globals = {

21 "asset": asset,

22 "url": url,

23 "Paginator": Paginator,

24 "now": timezone.now,

25 "localtime": timezone.localtime,

26}