-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathurls.py
37 lines (32 loc) · 1.47 KB
/
urls.py
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
# -*- coding: utf-8 -*-
"""
urls
~~~~
URL definitions.
:copyright: 2009 by tipfy.org.
:license: BSD, see LICENSE.txt for more details.
"""
import tipfy
def get_rules():
"""Returns a list of URL rules for the application. The list can be defined
entirely here or in separate ``urls.py`` files. Here we show an example of
joining all rules from the ``apps_installed`` listed in config.
"""
rules = [
tipfy.Rule('/', endpoint='home', handler='home.HomeHandler'),
tipfy.Rule('/submit', endpoint='submit', handler='submit.SubmitHandler'),
tipfy.Rule('/review', endpoint='review-start', handler='review.ReviewStartHandler'),
tipfy.Rule('/review/<int:id>', endpoint='review-quote', handler='review.ReviewQuoteHandler'),
tipfy.Rule('/review/remind', endpoint='review-remind', handler='review.ReviewRemindHandler'),
tipfy.Rule('/quote/<int:id>', endpoint='quote-view', handler='quote.QuoteViewHandler'),
tipfy.Rule('/random', endpoint='random-quote', handler='random_quote.RandomQuoteHandler'),
tipfy.Rule('/atom', endpoint='atom-view', handler='atom.AtomViewHandler'),
]
for app_module in tipfy.get_config('tipfy', 'apps_installed'):
try:
# Load the urls module from the app and extend our rules.
app_rules = tipfy.import_string('%s.urls' % app_module)
rules.extend(app_rules.get_rules())
except ImportError:
pass
return rules