#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright (C) 2008-2010 Étienne Loks # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as # published by the Free Software Foundation, either version 3 of the # License, or (at your option) any later version. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # You should have received a copy of the GNU General Public License # along with this program. If not, see . # See the file COPYING for details. from django.conf.urls.defaults import * from django.contrib import admin admin.autodiscover() from settings import ROOT_PATH, EXTRA_URL from main.models import Area js_info_dict = { 'packages': 'chimere', } base = '^' + EXTRA_URL urlpatterns = patterns('', (base + r'admin/(.*)', admin.site.root), (base + r'static/(?P.*)$', 'django.views.static.serve', {'document_root': ROOT_PATH + 'static/'}), (base + r'media/(?P.*)$', 'django.views.static.serve', {'document_root': ROOT_PATH + 'media/'}), (base + r'jsi18n/$', 'django.views.i18n.javascript_catalog', js_info_dict), ) urlpatterns += patterns('chimere.main.views', ) url_areas = Area.objects.filter(urn__isnull=False) urlpatterns += patterns('chimere.main.views', (base + r'$', 'index'), (base + r'simple/?$', 'index', {'simple':True}) ) for area in url_areas: urlpatterns += patterns('chimere.main.views', (base + '(' + area.urn + ')/?$', 'index', {'default_area':area}), (base + '(' + area.urn + ')/simple/?$', 'index', {'default_area':area, 'simple':True}),) extra = "|".join([area.urn for area in url_areas]) default_dct = {} if extra: extra = "(?P%s)?/?" % extra else: default_dct = {'area_name':''} urlpatterns += patterns('chimere.main.views', (base + extra + r'contact/$', 'contactus', default_dct), (base + extra + r'edit/$', 'edit', default_dct), (base + extra + r'edit_route/$', 'editRoute', default_dct), (base + extra + r'submited/(?P\w+)/$', 'submited', default_dct), (base + extra + r'getDetail/(?P\d+)/$', 'getDetail', default_dct), (base + extra + r'getDescriptionDetail/(?P\d+)/$', 'getDescriptionDetail', default_dct), (base + extra + r'getGeoObjects/(?P\w+)(/(?P\w+))?$', 'getGeoObjects', default_dct), (base + extra + r'getAvailableCategories/((?P\w+))?(/(?P\w+))?(/(?P\w+))?$', 'getAvailableCategories', default_dct), (base + extra + r'getTinyUrl/(?P.*)$', 'getTinyfiedUrl', default_dct), (base + extra + r'ty/(?P\w+)$', 'redirectFromTinyURN', default_dct), )