From 1ab795172026bc585b890f8e53f56b68f6541fe6 Mon Sep 17 00:00:00 2001 From: Aurélien Bompard Date: Mon, 4 Feb 2013 11:55:03 +0100 Subject: Rethink urls to be more hierarchic and less RPC --- hyperkitty/urls.py | 78 ++++++++++++++++++++++-------------------------------- 1 file changed, 31 insertions(+), 47 deletions(-) (limited to 'hyperkitty/urls.py') diff --git a/hyperkitty/urls.py b/hyperkitty/urls.py index 10b52ba..ae38fe7 100644 --- a/hyperkitty/urls.py +++ b/hyperkitty/urls.py @@ -44,71 +44,55 @@ urlpatterns = patterns('hyperkitty.views', url(r'^/$', 'pages.index', name='index'), url(r'^$', 'pages.index', name='root'), - # Archives - url(r'^archives/(?P.*@.*)/(?P\d{4})/(?P\d\d?)/(?P\d\d?)/$', + # List archives and overview + url(r'^list/(?P[^/@]+@[^/@]+)/(?P\d{4})/(?P\d\d?)/(?P\d\d?)/$', 'list.archives', name='archives_with_day'), - url(r'^archives/(?P.*@.*)/(?P\d{4})/(?P\d\d?)/$', + url(r'^list/(?P[^/@]+@[^/@]+)/(?P\d{4})/(?P\d\d?)/$', 'list.archives', name='archives_with_month'), - url(r'^archives/(?P.*@.*)/$', - 'list.archives', name='archives'), + url(r'^list/(?P[^/@]+@[^/@]+)/latest$', + 'list.archives', name='archives_latest'), + url(r'^list/(?P[^/@]+@[^/@]+)/$', + 'list.overview', name='list_overview'), - # Lists - url(r'^list/$', 'pages.index'), # Can I remove this URL? - url(r'^list/(?P.*@.*)/$', - 'list.list', name='list_overview'), - - # Search Tag - url(r'^tag/(?P.*@.*)\/(?P.*)\/(?P\d+)/$', - 'list.search_tag'), - url(r'^tag/(?P.*@.*)\/(?P.*)/$', - 'list.search_tag', name='search_tag'), - - # Search - # If page number is present in URL - url(r'^search/(?P.*@.*)\/(?P.*)\/(?P.*)\/(?P\d+)/$', - 'list.search_keyword'), - # Show the first page as default when no page number is present in URL - url(r'^search/(?P.*@.*)\/(?P.*)\/(?P.*)/$', - 'list.search_keyword', name="search_keyword"), - url(r'^search/(?P.*@.*)/$', - 'list.search', name="search_list"), - - - ### MESSAGE LEVEL VIEWS ### - url(r'^message/(?P.*@.*)/(?P\w+)/$', + # Message + url(r'^list/(?P[^/@]+@[^/@]+)/message/(?P\w+)/$', 'message.index', name='message_index'), - - url(r'^message/(?P.*@.*)/(?P\w+)/attachment/(?P\d+)/(?P.+)$', + url(r'^list/(?P[^/@]+@[^/@]+)/message/(?P\w+)/attachment/(?P\d+)/(?P.+)$', 'message.attachment', name='message_attachment'), - - url(r'^vote/(?P.*@.*)/$', + url(r'^list/(?P[^/@]+@[^/@]+)/message/(?P\w+)/vote$', 'message.vote', name='message_vote'), - ### MESSAGE LEVEL VIEW ENDS ### - - - ### THREAD LEVEL VIEWS ### - # Thread view page - url(r'^thread/(?P.*@.*)/(?P.+)/$', + # Thread + url(r'^list/(?P[^/@]+@[^/@]+)/thread/(?P\w+)/$', 'thread.thread_index', name='thread'), - # Add Tag to a thread - url(r'^thread/(?P.*@.*)\/(?P.*)/addtag$', + url(r'^list/(?P[^/@]+@[^/@]+)/thread/(?P\w+)/addtag$', 'thread.add_tag', name='add_tag'), - # Thread favorites - url(r'^thread/(?P.*@.*)\/(?P.*)/favorite$', + url(r'^list/(?P[^/@]+@[^/@]+)/thread/(?P\w+)/favorite$', 'thread.favorite', name='favorite'), - ### THREAD LEVEL VIEW ENDS ### + # Search Tag + url(r'^list/(?P[^/@]+@[^/@]+)/tag/(?P.*)/(?P\d+)/$', + 'list.search_tag'), + url(r'^list/(?P[^/@]+@[^/@]+)/tag/(?P.*)/$', + 'list.search_tag', name='search_tag'), + + # Search + url(r'^list/(?P[^/@]+@[^/@]+)/search/(?P.*)/(?P.*)/(?P\d+)/$', + 'list.search_keyword'), + url(r'^list/(?P[^/@]+@[^/@]+)/search/(?P.*)/(?P.*)/$', + 'list.search_keyword', name="search_keyword"), + url(r'^list/(?P[^/@]+@[^/@]+)/search/$', + 'list.search', name="search_list"), # REST API url(r'^api/$', 'api.api'), - url(r'^api/email\/(?P.*@.*)\/(?P.*)/', + url(r'^api/email\/(?P[^/@]+@[^/@]+)\/(?P.*)/', EmailResource.as_view(), name="api_email"), - url(r'^api/thread\/(?P.*@.*)\/(?P.*)/', + url(r'^api/thread\/(?P[^/@]+@[^/@]+)\/(?P.*)/', ThreadResource.as_view(), name="api_thread"), - url(r'^api/search\/(?P.*@.*)\/(?P.*)\/(?P.*)/', + url(r'^api/search\/(?P[^/@]+@[^/@]+)\/(?P.*)\/(?P.*)/', SearchResource.as_view(), name="api_search"), # Uncomment the admin/doc line below to enable admin documentation: -- cgit