~jcsackett/charmworld/bac-tag-constraints

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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# Copyright 2012, 2013 Marco Ceppi, Canonical Ltd.  This software is
# licensed under the GNU Affero General Public License version 3 (see
# the file LICENSE).

"""Create routes here and gets returned into __init__ main()"""
from charmworld.ubuntusso import add_ubuntu_sso_login


def build_routes(config):
    """Add any routes to the config"""

    config.add_route(
        "json-charm-change", "/reports/charm-activity.json")
    config.add_route(
        "json-contributor-growth", "/reports/charm-contributors.json")
    config.add_route(
        "json-charm-growth", "/reports/charm-count.json")

    config.add_route("reports", "/reports")

    config.add_route("charmers", "/charmers")

    # Distro/Curated Charms
    config.add_route("charm-collection", "/charms")
    config.add_route("series-collection", "/charms/{series}")
    config.add_route("charm", "/charms/{series}/{charm}")
    config.add_route("charm-revision-json",
                     "/charms/{series}/{charm}-{revision}/json")
    config.add_route("charm-json", "/charms/{series}/{charm}/json")
    config.add_route("charm-changes", "/charms/{series}/{charm}/changes")
    config.add_route("hook", "/charms/{series}/{charm}/hooks/{hook}")
    config.add_route("config", "/charms/{series}/{charm}/config")

    # Personal Charms
    config.add_route("personal-collection", "/~{owner}")
    config.add_route("personal-series", "/~{owner}/{series}")
    config.add_route("personal-charm-revision",
                     "/~{owner}/{series}/{charm}-{revision}")
    config.add_route("personal-charm", "/~{owner}/{series}/{charm}")
    config.add_route("personal-charm-revision-json",
                     "/~{owner}/{series}/{charm}-{revision}/json")
    config.add_route("personal-charm-json", "/~{owner}/{series}/{charm}/json")

    config.add_route(
        "personal-charm-changes", "/~{owner}/{series}/{charm}/changes")
    config.add_route(
        "personal-hook", "/~{owner}/{series}/{charm}/hooks/{hook}")
    config.add_route(
        "personal-config", "/~{owner}/{series}/{charm}/config")

    config.add_route("interface", "/interfaces/{interface}")
    config.add_route("interface-collection", "/interfaces")
    config.add_route("interface-collection-map", "/interface-charm-map")

    # Personal Bundles
    config.add_route("personal-bundle-json-revision",
                     "/bundle/~{owner}/{basket}/{rev}/{bundle}/json")
    config.add_route("personal-bundle-json",
                     "/bundle/~{owner}/{basket}/{bundle}/json")
    config.add_route("personal-bundle-revision",
                     "/bundle/~{owner}/{basket}/{rev}/{bundle}")
    config.add_route("personal-bundle",
                     "/bundle/~{owner}/{basket}/{bundle}")

    # Official (promulgated) Bundles
    config.add_route("official-bundle-json",
                     "/bundle/{basket}/{rev}/{bundle}/json")
    config.add_route("official-bundle-revision",
                     "/bundle/{basket}/{rev}/{bundle}")

    # Tools
    config.add_route("tools", "/tools")
    config.add_route("tools-review", "/tools/review-queue")

    # Experiment
    config.add_route("charm-graph", "/charm-graph")
    config.add_route("json-interface-graph", "/interface-json-graph")

    # Feeds
    config.add_route("recently-changed", "/recently-changed")
    config.add_route("recently-changed-feed", "/feed/charm-changes")

    # Quality Assessment
    config.add_route('charm-qa-edit', 'charms/{series}/{charm}/qa/edit')

    # Featured charms and bundles.
    config.add_route('charm-featured-edit',
                     'charms/{series}/{charm}/featured/edit')
    config.add_route('bundle-featured-edit',
                     'bundle/{basket}/{bundle}/featured/edit')

    # Search
    config.add_route("search", "/search")
    config.add_route("search-json-obsolete", "/search/json")

    # Home page
    config.add_route("home", "/")

    config.add_route('auth_callback', '/auth_callback')
    config.add_route('logout', '/logout')

    config.add_route('api-obsolete-0', '/api/0/*remaining')
    config.add_route('api-obsolete-1', '/api/1/*remaining')

    config.add_route('api_2_single', '/api/2/{endpoint}')
    config.add_view('charmworld.views.api.API2', route_name='api_2_single')
    config.add_route('api_2', '/api/2/{endpoint}/*remainder')
    config.add_view('charmworld.views.api.API2', route_name='api_2')

    config.add_route('api_3', '/api/3/{endpoint}')
    config.add_view('charmworld.views.api.API3', route_name='api_3')
    config.add_route('api_3_with_path', '/api/3/{endpoint}/*remainder')
    config.add_view('charmworld.views.api.API3', route_name='api_3_with_path')

    # Monitoring support.
    config.add_route('heartbeat', '/heartbeat')

    # Add login support.  It must precede the promulgated-charm route so it
    # doesn't get clobbered.
    add_ubuntu_sso_login(config, callback_path='/auth_callback')

    # Unnamespaced promulgated charms.
    config.add_route("promulgated-charm-revision",
                     "/{series}/{charm}-{revision}")
    config.add_route("promulgated-charm", "/{series}/{charm}")

    return config