File: __init__.py

package info (click to toggle)
django-distill 3.2.7-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 316 kB
  • sloc: python: 2,144; makefile: 4
file content (39 lines) | stat: -rw-r--r-- 1,274 bytes parent folder | download
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
__version__ = '3.2.7'


from django import __version__ as django_version
from django_distill.errors import DistillError
from django_distill.distill import urls_to_distill
from django_distill.renderer import generate_urls


try:
    from django_distill.distill import distill_url
except ImportError:
    def distill_url(*args, **kwargs):
        err = ('Your installed version of Django ({}) does not supprt '
               'django.urls.url or django.conf.urls.url, use '
               'django_distill.distill_re_path or django_distill.distill_path')
        raise DistillError(err.format(django_version))


try:
    from django_distill.distill import distill_re_path
except ImportError:
    def distill_re_path(*args, **kwargs):
        err = ('Your installed version of Django ({}) does not supprt '
               'django.urls.re_path, please upgrade')
        raise DistillError(err.format(django_version))


try:
    from django_distill.distill import distill_path
except ImportError:
    def distill_path(*args, **kwargs):
        err = ('Your installed version of Django ({}) does not supprt '
               'django.urls.path, please upgrade')
        raise DistillError(err.format(django_version))


def distilled_urls():
    return generate_urls(urls_to_distill)