| Paste number 59141: | routes asdf |
| Pasted by: | deemon |
| 7 months, 2 weeks ago | |
| #pylons | Context in IRC logs | |
| Paste contents: |
| # ROUTE#1 map.connect('domain', 'domain/:domainname/:controller/:action', controller='whois', action='index') # URL-s for ROUTE#1 will be generated like this: url_for('domain', domainname='example.com', controller='nameservers', action='edit') # And generated URL would be: /domain/example.com/nameservers/edit # ROUTE#2 map.connect(':controller/:action/:id', controller='login', action='signin') # ROUTE#3, but I don't care about it right now map.connect('*url', controller='template', action='view') # CASE#1 # /news/view -> ROUTE#2 # controller=news, action=view # use class NewsController # CASE#2 # /login/signout -> ROUTE#2 # controller=login, action=signout # use class LoginController # CASE#3 # /domain/example.com/nameservers/edit -> ROUTE#1 # domainname=example.com, controller=nameservers, action=edit # use class DomainNameserversController # CASE#4 # /domain/random.tld/nameservers/view -> ROUTE#1 # domainname=random.tld, controller=nameservers, action=view # use class DomainNameserversController (like in CASE#3) # In cases #3 and #4 it seems that routes matches ROUTE#3 right away # and since that template doesn't exist it returns 404. # # This is supposed to be a workaround for urls like "/domain/random.tld/domain_nameservers/edit" # which have redundant 'domain_' that I want to avoid. # I want that final controller/class would be domainname+controller # I tried hacking with routes conditions=dict(function=hack_this), where hack_this(env, res) # would modify res['controller'], but routes matching never reaches that far |
This paste has no annotations.