Statistics
| Branch: | Tag: | Revision:

root / snf-cyclades-app / synnefo / app_settings / urls.py @ 4911365b

History | View | Annotate | Download (4 kB)

1 adee02b8 Giorgos Verigakis
# Copyright 2011 GRNET S.A. All rights reserved.
2 2ce0636e Kostas Papadimitriou
#
3 adee02b8 Giorgos Verigakis
# Redistribution and use in source and binary forms, with or
4 adee02b8 Giorgos Verigakis
# without modification, are permitted provided that the following
5 adee02b8 Giorgos Verigakis
# conditions are met:
6 2ce0636e Kostas Papadimitriou
#
7 adee02b8 Giorgos Verigakis
#   1. Redistributions of source code must retain the above
8 adee02b8 Giorgos Verigakis
#      copyright notice, this list of conditions and the following
9 adee02b8 Giorgos Verigakis
#      disclaimer.
10 2ce0636e Kostas Papadimitriou
#
11 adee02b8 Giorgos Verigakis
#   2. Redistributions in binary form must reproduce the above
12 adee02b8 Giorgos Verigakis
#      copyright notice, this list of conditions and the following
13 adee02b8 Giorgos Verigakis
#      disclaimer in the documentation and/or other materials
14 adee02b8 Giorgos Verigakis
#      provided with the distribution.
15 2ce0636e Kostas Papadimitriou
#
16 adee02b8 Giorgos Verigakis
# THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 adee02b8 Giorgos Verigakis
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 adee02b8 Giorgos Verigakis
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 adee02b8 Giorgos Verigakis
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 adee02b8 Giorgos Verigakis
# CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 adee02b8 Giorgos Verigakis
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 adee02b8 Giorgos Verigakis
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 adee02b8 Giorgos Verigakis
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 adee02b8 Giorgos Verigakis
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 adee02b8 Giorgos Verigakis
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 adee02b8 Giorgos Verigakis
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 adee02b8 Giorgos Verigakis
# POSSIBILITY OF SUCH DAMAGE.
28 2ce0636e Kostas Papadimitriou
#
29 adee02b8 Giorgos Verigakis
# The views and conclusions contained in the software and
30 adee02b8 Giorgos Verigakis
# documentation are those of the authors and should not be
31 adee02b8 Giorgos Verigakis
# interpreted as representing official policies, either expressed
32 adee02b8 Giorgos Verigakis
# or implied, of GRNET S.A.
33 00b4f1be Faidon Liambotis
34 6b256427 Christos Stavrakakis
from django.conf.urls import patterns, include
35 a6b17d33 Christos Stavrakakis
36 7bdf51c4 Georgios D. Tsoukalas
from snf_django.lib.api.proxy import proxy
37 e3ff6830 Georgios D. Tsoukalas
from snf_django.lib.api.utils import prefix_pattern
38 347b2ba1 Giorgos Korfiatis
from snf_django.utils.urls import \
39 347b2ba1 Giorgos Korfiatis
    extend_with_root_redirects, extend_endpoint_with_slash
40 56a76611 Kostas Papadimitriou
from snf_django.lib.api.urls import api_patterns
41 e3ff6830 Georgios D. Tsoukalas
from synnefo.cyclades_settings import (
42 4691814d Ilias Tsitsimpis
    BASE_PATH, COMPUTE_PREFIX, VMAPI_PREFIX,
43 b1fb3aac Kostas Papadimitriou
    PLANKTON_PREFIX, HELPDESK_PREFIX, UI_PREFIX, ASTAKOS_BASE_URL,
44 4691814d Ilias Tsitsimpis
    USERDATA_PREFIX, ADMIN_PREFIX, BASE_ASTAKOS_PROXY_PATH,
45 aca448cf Kostas Papadimitriou
    ASTAKOS_ACCOUNTS_PREFIX, ASTAKOS_VIEWS_PREFIX, PROXY_USER_SERVICES,
46 aca448cf Kostas Papadimitriou
    cyclades_services)
47 7bdf51c4 Georgios D. Tsoukalas
48 7bdf51c4 Georgios D. Tsoukalas
from functools import partial
49 7bdf51c4 Georgios D. Tsoukalas
50 78dec216 Vassilios Karakoidas
51 347b2ba1 Giorgos Korfiatis
urlpatterns = []
52 347b2ba1 Giorgos Korfiatis
53 347b2ba1 Giorgos Korfiatis
# Redirects should be first, otherwise they may get overridden by wildcards
54 347b2ba1 Giorgos Korfiatis
extend_endpoint_with_slash(urlpatterns, cyclades_services, 'cyclades_ui')
55 347b2ba1 Giorgos Korfiatis
extend_endpoint_with_slash(urlpatterns, cyclades_services, 'cyclades_helpdesk')
56 347b2ba1 Giorgos Korfiatis
extend_endpoint_with_slash(urlpatterns, cyclades_services, 'admin')
57 347b2ba1 Giorgos Korfiatis
extend_endpoint_with_slash(urlpatterns, cyclades_services, 'cyclades_userdata')
58 347b2ba1 Giorgos Korfiatis
59 e3ff6830 Georgios D. Tsoukalas
astakos_proxy = partial(proxy, proxy_base=BASE_ASTAKOS_PROXY_PATH,
60 e3ff6830 Georgios D. Tsoukalas
                        target_base=ASTAKOS_BASE_URL)
61 e3ff6830 Georgios D. Tsoukalas
62 32e4e343 Christos Stavrakakis
cyclades_patterns = api_patterns(
63 32e4e343 Christos Stavrakakis
    '',
64 e3ff6830 Georgios D. Tsoukalas
    (prefix_pattern(VMAPI_PREFIX), include('synnefo.vmapi.urls')),
65 e3ff6830 Georgios D. Tsoukalas
    (prefix_pattern(PLANKTON_PREFIX), include('synnefo.plankton.urls')),
66 e3ff6830 Georgios D. Tsoukalas
    (prefix_pattern(COMPUTE_PREFIX), include('synnefo.api.urls')),
67 b47b110d Kostas Papadimitriou
    (prefix_pattern(USERDATA_PREFIX), include('synnefo.userdata.urls')),
68 4a8667dc Christos Stavrakakis
    (prefix_pattern(ADMIN_PREFIX), include('synnefo.admin.urls')),
69 2cc9d3a5 Markos Gogoulos
)
70 2ce0636e Kostas Papadimitriou
71 32e4e343 Christos Stavrakakis
cyclades_patterns += patterns(
72 32e4e343 Christos Stavrakakis
    '',
73 56a76611 Kostas Papadimitriou
    (prefix_pattern(UI_PREFIX), include('synnefo.ui.urls')),
74 56a76611 Kostas Papadimitriou
    (prefix_pattern(HELPDESK_PREFIX), include('synnefo.helpdesk.urls')),
75 56a76611 Kostas Papadimitriou
)
76 56a76611 Kostas Papadimitriou
77 347b2ba1 Giorgos Korfiatis
urlpatterns += patterns(
78 e3ff6830 Georgios D. Tsoukalas
    '',
79 e3ff6830 Georgios D. Tsoukalas
    (prefix_pattern(BASE_PATH), include(cyclades_patterns)),
80 b1fb3aac Kostas Papadimitriou
)
81 e3ff6830 Georgios D. Tsoukalas
82 11bb4341 Kostas Papadimitriou
if PROXY_USER_SERVICES:
83 e3ff6830 Georgios D. Tsoukalas
    astakos_proxy = partial(proxy, proxy_base=BASE_ASTAKOS_PROXY_PATH,
84 e3ff6830 Georgios D. Tsoukalas
                            target_base=ASTAKOS_BASE_URL)
85 e3ff6830 Georgios D. Tsoukalas
86 32e4e343 Christos Stavrakakis
    proxy_patterns = patterns(
87 32e4e343 Christos Stavrakakis
        '',
88 56a76611 Kostas Papadimitriou
        (prefix_pattern(ASTAKOS_VIEWS_PREFIX), astakos_proxy),
89 56a76611 Kostas Papadimitriou
    )
90 56a76611 Kostas Papadimitriou
    proxy_patterns += api_patterns(
91 11bb4341 Kostas Papadimitriou
        '',
92 3f1bee22 Georgios D. Tsoukalas
        (r'^login/?$', astakos_proxy),
93 3f1bee22 Georgios D. Tsoukalas
        (r'^feedback/?$', astakos_proxy),
94 3f1bee22 Georgios D. Tsoukalas
        (r'^user_catalogs/?$', astakos_proxy),
95 e3ff6830 Georgios D. Tsoukalas
        (prefix_pattern(ASTAKOS_ACCOUNTS_PREFIX), astakos_proxy),
96 e3ff6830 Georgios D. Tsoukalas
    )
97 e3ff6830 Georgios D. Tsoukalas
98 e3ff6830 Georgios D. Tsoukalas
    urlpatterns += patterns(
99 e3ff6830 Georgios D. Tsoukalas
        '',
100 e3ff6830 Georgios D. Tsoukalas
        (prefix_pattern(BASE_ASTAKOS_PROXY_PATH), include(proxy_patterns)),
101 a6a2112e Kostas Papadimitriou
    )
102 aca448cf Kostas Papadimitriou
103 aca448cf Kostas Papadimitriou
# set utility redirects
104 aca448cf Kostas Papadimitriou
extend_with_root_redirects(urlpatterns, cyclades_services, 'cyclades_ui',
105 aca448cf Kostas Papadimitriou
                           BASE_PATH)