aboutsummaryrefslogtreecommitdiff
path: root/urls.py
blob: 8399ee9804f0e3b506de33c232770d8b056ab144 (plain)
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
from django.conf import settings
from django.views.generic import RedirectView

try:
    from django.conf.urls.defaults import patterns, include, url
except:
    # django >= 1.6
    from django.conf.urls import patterns, include, url

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()


urlpatterns = patterns(
    '',
    url(r'^admin/', include(admin.site.urls)),

    # Use "linaro-openid" to allow peaceful coexistence of both
    # python-apache-openid and django-openid authentication on the
    # same server.  When we get rid of apache openid protection,
    # we can go back to using just "openid" here.
    url(r'^linaro-openid/', include('django_openid_auth.urls')),
    url(r'^login/?$', RedirectView.as_view(url='/linaro-openid/login/')),
    url(r'^logout/?$', 'django.contrib.auth.views.logout'),

    # Handle JS libs and CSS.
    url(r'^js/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.JS_PATH}),
    url(r'^css/(?P<path>.*)$', 'django.views.static.serve',
        {'document_root': settings.CSS_PATH}),

    # The license page...
    url(r'^license$',
        'license_protected_downloads.views.show_license',
        name='show_license'),

    # Exceptions redirected to root...
    url(r'^license',
        'license_protected_downloads.views.redirect_to_root',
        name='redirect_to_root'),

    # Accept the license
    url(r'^accept-license',
        'license_protected_downloads.views.accept_license',
        name='accept_license'),

    # Recursively get files for rendering (async calls accepted only).
    url(r'^get-textile-files',
        'license_protected_downloads.views.get_textile_files',
        name='get_textile_files'),

    url(r'^api/ls/(?P<path>.*)$',
        'license_protected_downloads.api.v1.list_files_api'),

    url(r'^api/license/(?P<path>.*)$',
        'license_protected_downloads.api.v1.get_license_api'),

    url(r'^api/v2/token/(?P<token>.*)$',
        'license_protected_downloads.api.v2.token'),

    url(r'^api/v2/publish/(?P<path>.*)$',
        'license_protected_downloads.api.v2.publish'),

    url(r'^api/v2/link_latest/(?P<path>.*)$',
        'license_protected_downloads.api.v2.link_latest'),

    # Catch-all. We always return a file (or try to) if it exists.
    # This handler does that.
    url(r'(?P<path>.*)', 'license_protected_downloads.views.file_server'),
)

handler500 = 'license_protected_downloads.views.error_view'