diff options
author | Dan McGee <dan@archlinux.org> | 2011-02-22 15:29:08 -0600 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-02-22 15:29:10 -0600 |
commit | b9fdcd06222c674d5fabcf5a4ab6bc55f268c757 (patch) | |
tree | 25a831e55a792b452526cfd035486230ff0b9102 | |
parent | 330048eab6cf9bacf2d7bb436a101a3b7469aca7 (diff) |
Modularize URLs
Make some additional URL config files that can be included so we aren't
trying to do so much in the top level config. This also allows us to
branch a bit more rather than go linear down the rather lengthy list.
Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r-- | mirrors/urls.py | 10 | ||||
-rw-r--r-- | mirrors/urls_mirrorlist.py | 12 | ||||
-rw-r--r-- | packages/urls_groups.py | 9 | ||||
-rw-r--r-- | urls.py | 65 |
4 files changed, 55 insertions, 41 deletions
diff --git a/mirrors/urls.py b/mirrors/urls.py new file mode 100644 index 00000000..fed9c807 --- /dev/null +++ b/mirrors/urls.py @@ -0,0 +1,10 @@ +from django.conf.urls.defaults import patterns + +urlpatterns = patterns('mirrors.views', + (r'^$', 'mirrors', {}, 'mirror-list'), + (r'^status/$', 'status', {}, 'mirror-status'), + (r'^status/json/$', 'status_json', {}, 'mirror-status-json'), + (r'^(?P<name>[\.\-\w]+)/$', 'mirror_details'), +) + +# vim: set ts=4 sw=4 et: diff --git a/mirrors/urls_mirrorlist.py b/mirrors/urls_mirrorlist.py new file mode 100644 index 00000000..70bc18d2 --- /dev/null +++ b/mirrors/urls_mirrorlist.py @@ -0,0 +1,12 @@ +from django.conf.urls.defaults import patterns + +urlpatterns = patterns('mirrors.views', + (r'^$', 'generate_mirrorlist', {}, 'mirrorlist'), + (r'^all/$', 'find_mirrors', {'countries': ['all']}), + (r'^all/ftp/$', 'find_mirrors', + {'countries': ['all'], 'protocols': ['ftp']}), + (r'^all/http/$', 'find_mirrors', + {'countries': ['all'], 'protocols': ['http']}), +) + +# vim: set ts=4 sw=4 et: diff --git a/packages/urls_groups.py b/packages/urls_groups.py new file mode 100644 index 00000000..c561e50d --- /dev/null +++ b/packages/urls_groups.py @@ -0,0 +1,9 @@ +from django.conf.urls.defaults import patterns + +urlpatterns = patterns('packages.views', + (r'^$', 'groups', {}, 'groups-list'), + (r'^(?P<arch>[A-z0-9]+)/$', 'groups'), + (r'^(?P<arch>[A-z0-9]+)/(?P<name>[A-z0-9\-+.]+)/$', 'group_details'), +) + +# vim: set ts=4 sw=4 et: @@ -17,47 +17,24 @@ sitemaps = { } admin.autodiscover() - -urlpatterns = patterns('packages.views', - (r'^groups/$', 'groups'), - (r'^groups/(?P<arch>[A-z0-9]+)/$', 'groups'), - (r'^groups/(?P<arch>[A-z0-9]+)/(?P<name>[A-z0-9\-+.]+)/$', - 'group_details'), - - (r'^opensearch/packages/$', 'opensearch', {}, 'opensearch-packages'), -) - -urlpatterns += patterns('todolists.views', - (r'^todolists/$', 'public_list'), -) - -urlpatterns += patterns('mirrors.views', - (r'^mirrors/status/$', 'status', {}, 'mirror-status'), - (r'^mirrors/status/json/$', 'status_json', {}, 'mirror-status-json'), - - (r'^mirrors/$', 'mirrors', {}, 'mirrors-list'), - (r'^mirrors/(?P<name>[\.\-\w]+)/$', 'mirror_details'), - - (r'^mirrorlist/$', 'generate_mirrorlist', {}, 'mirrorlist'), - (r'^mirrorlist/all/$', 'find_mirrors', {'countries': ['all']}), - (r'^mirrorlist/all/ftp/$', 'find_mirrors', - {'countries': ['all'], 'protocols': ['ftp']}), - (r'^mirrorlist/all/http/$', 'find_mirrors', - {'countries': ['all'], 'protocols': ['http']}), -) - -# Feeds and sitemaps -urlpatterns += patterns('', - (r'^feeds/$', 'public.views.feeds', {}, 'feeds-list'), - (r'^feeds/news/$', NewsFeed()), - (r'^feeds/packages/$', PackageFeed()), - (r'^feeds/packages/(?P<arch>[A-z0-9]+)/$', +urlpatterns = [] + +# Feeds patterns, used later +feeds_patterns = patterns('', + (r'^$', 'public.views.feeds', {}, 'feeds-list'), + (r'^news/$', NewsFeed()), + (r'^packages/$', PackageFeed()), + (r'^packages/(?P<arch>[A-z0-9]+)/$', PackageFeed()), - (r'^feeds/packages/(?P<arch>[A-z0-9]+)/(?P<repo>[A-z0-9\-]+)/$', + (r'^packages/(?P<arch>[A-z0-9]+)/(?P<repo>[A-z0-9\-]+)/$', PackageFeed()), - (r'^sitemap.xml$', 'django.contrib.sitemaps.views.index', +) + +# Sitemaps +urlpatterns += patterns('django.contrib.sitemaps.views', + (r'^sitemap.xml$', 'index', {'sitemaps': sitemaps}), - (r'^sitemap-(?P<section>.+)\.xml$', 'django.contrib.sitemaps.views.sitemap', + (r'^sitemap-(?P<section>.+)\.xml$', 'sitemap', {'sitemaps': sitemaps}), ) @@ -88,13 +65,19 @@ urlpatterns += patterns('public.views', # Includes and other remaining stuff urlpatterns += patterns('', - (r'^admin/', include(admin.site.urls)), - (r'^jsi18n/$', 'django.views.i18n.null_javascript_catalog'), - + (r'^jsi18n/$', 'django.views.i18n.null_javascript_catalog'), + (r'^admin/', include(admin.site.urls)), (r'^devel/', include('devel.urls')), + (r'^feeds/', include(feeds_patterns)), + (r'^groups/', include('packages.urls_groups')), + (r'^mirrorlist/',include('mirrors.urls_mirrorlist')), + (r'^mirrors/', include('mirrors.urls')), (r'^news/', include('news.urls')), (r'^packages/', include('packages.urls')), (r'^todo/', include('todolists.urls')), + (r'^opensearch/packages/$', 'packages.views.opensearch', + {}, 'opensearch-packages'), + (r'^todolists/$','todolists.views.public_list'), ) if settings.DEBUG == True: |