969376ac31e8deb4463586d222cf6221c49a21f9
[zzz-floof.git] / floof / config / routing.py
1 """Routes configuration
2
3 The more specific and detailed routes should be defined first so they
4 may take precedent over the more generic routes. For more information
5 refer to the routes manual at http://routes.groovie.org/docs/
6 """
7 from pylons import config
8 from routes import Mapper
9
10 def make_map():
11 """Create, configure and return the routes Mapper"""
12 map = Mapper(directory=config['pylons.paths']['controllers'],
13 always_scan=config['debug'])
14 map.minimization = False
15
16 require_POST = dict(conditions={'method': ['POST']})
17
18 # The ErrorController route (handles 404/500 error pages); it should
19 # likely stay at the top, ensuring it can always be resolved
20 map.connect('/error/{action}', controller='error')
21 map.connect('/error/{action}/{id}', controller='error')
22
23 map.connect('/', controller='main', action='index')
24
25 # User stuff
26 map.connect('/account/login', controller='account', action='login')
27 map.connect('/account/login_begin', controller='account', action='login_begin', **require_POST)
28 map.connect('/account/login_finish', controller='account', action='login_finish')
29 map.connect('/account/logout', controller='account', action='logout', **require_POST)
30 map.connect('/account/register', controller='account', action='register')
31 map.connect('/account/register_finish', controller='account', action='register_finish', **require_POST)
32
33 map.connect('/users', controller='users', action='list')
34 map.connect('/users/{name}', controller='users', action='view')
35
36 # Art stuff
37 map.connect('/art/new', controller='art', action='new')
38 map.connect('/art/upload', controller='art', action='upload')
39 map.connect('/art/{id}', controller='art', action='show')
40 map.connect('/art/{id}/tag', controller='art', action='tag')
41
42 map.connect('/tag/{id}/delete', controller='tag', action='delete')
43
44 map.connect('/search', controller='search', action='index')
45 map.connect('/search/list', controller='search', action='list')
46
47
48 # default routing is back so we can test stuff.
49 # please don't take it away until we have some more core features in.
50 map.connect('/{controller}/{action}')
51 map.connect('/{controller}/{action}/{id}')
52
53 return map