2012-04-28 18:16:05 +02:00
|
|
|
from django.conf.urls.defaults import url, patterns, include
|
2012-06-03 09:43:49 +02:00
|
|
|
from django.contrib.auth.decorators import user_passes_test
|
|
|
|
|
|
|
|
from djcelery.views import apply
|
|
|
|
from djeuscan.views import registered_tasks
|
|
|
|
|
2012-05-13 14:09:22 +02:00
|
|
|
from djeuscan.feeds import PackageFeed, CategoryFeed, HerdFeed, \
|
|
|
|
MaintainerFeed, GlobalFeed
|
2011-08-25 15:39:54 +02:00
|
|
|
|
2012-06-03 09:43:49 +02:00
|
|
|
|
|
|
|
admin_required = user_passes_test(lambda u: u.is_superuser)
|
|
|
|
|
|
|
|
|
2012-04-04 17:31:54 +02:00
|
|
|
package_patterns = patterns('djeuscan.views',
|
2012-04-28 18:16:05 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/feed/$',
|
|
|
|
PackageFeed(), name='package_feed'),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/(?P<package>[\w+][\w+.-]*)/$',
|
|
|
|
'package', name="package"),
|
2011-08-25 15:39:54 +02:00
|
|
|
)
|
|
|
|
|
2012-04-04 17:31:54 +02:00
|
|
|
categories_patterns = patterns('djeuscan.views',
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/(view/)?$', 'category',
|
|
|
|
name="category"),
|
2012-04-28 18:16:05 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/feed/$', CategoryFeed(),
|
|
|
|
name='category_feed'),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<category>[\w+][\w+.-]*)/charts/(?P<chart>[\w\-]+).png$',
|
|
|
|
'chart_category', name="chart_category"),
|
|
|
|
url(r'^$', 'categories', name="categories"),
|
2011-08-25 15:39:54 +02:00
|
|
|
)
|
|
|
|
|
2012-04-04 17:31:54 +02:00
|
|
|
herds_patterns = patterns('djeuscan.views',
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<herd>[\@\{\}\w+.-]*)/(view/)?$', 'herd', name="herd"),
|
2011-08-26 13:27:46 +02:00
|
|
|
url(r'^(?P<herd>[\@\{\}\w+.-]*)/feed/$', HerdFeed(), name='herd_feed'),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<herd>[\@\{\}\w+.-]*)/charts/(?P<chart>[\w\-]+).png$',
|
|
|
|
'chart_herd', name="chart_herd"),
|
|
|
|
url(r'^$', 'herds', name="herds"),
|
2011-08-25 15:39:54 +02:00
|
|
|
)
|
|
|
|
|
2012-04-04 17:31:54 +02:00
|
|
|
maintainers_patterns = patterns('djeuscan.views',
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<maintainer_id>\d+)/(view/)?$', 'maintainer', name="maintainer"),
|
2012-04-28 18:16:05 +02:00
|
|
|
url(r'^(?P<maintainer_id>\d+)/feed/$', MaintainerFeed(),
|
|
|
|
name='maintainer_feed'),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<maintainer_id>\d+)/charts/(?P<chart>[\w\-]+).png$',
|
|
|
|
'chart_maintainer', name="chart_maintainer"),
|
|
|
|
url(r'^$', 'maintainers', name="maintainers"),
|
2011-08-25 15:39:54 +02:00
|
|
|
)
|
2011-04-13 08:50:24 +02:00
|
|
|
|
2012-04-04 17:31:54 +02:00
|
|
|
overlays_patterns = patterns('djeuscan.views',
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^(?P<overlay>[\w+][\w+.-]*)/(view/)?$', 'overlay', name="overlay"),
|
|
|
|
url(r'^$', 'overlays', name="overlays"),
|
2011-11-23 18:03:07 +01:00
|
|
|
)
|
|
|
|
|
2012-06-08 14:21:11 +02:00
|
|
|
tasks_patterns = patterns('djeuscan.views',
|
|
|
|
url(r'^refresh_package/(?P<query>(?:[\w+][\w+.-]*/[\w+][\w+.-]*))/$',
|
|
|
|
"refresh_package",
|
|
|
|
name="refresh_package"),
|
2012-06-03 09:43:49 +02:00
|
|
|
url(r'^registered_tasks/$', admin_required(registered_tasks),
|
|
|
|
name="registered_tasks"),
|
|
|
|
url(r'^apply/(?P<task_name>.*)/$', admin_required(apply),
|
|
|
|
name="apply_task"),
|
|
|
|
)
|
|
|
|
|
2012-04-04 17:31:54 +02:00
|
|
|
urlpatterns = patterns('djeuscan.views',
|
2011-11-15 17:08:29 +01:00
|
|
|
# Global stuff
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^api/', include('djeuscan.api.urls')),
|
2012-04-04 17:31:54 +02:00
|
|
|
|
2012-05-01 16:56:09 +02:00
|
|
|
url(r'^$', 'index', name="index"),
|
2011-08-25 15:39:54 +02:00
|
|
|
url(r'^feed/$', GlobalFeed(), name='global_feed'),
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^about/$', 'about', name="about"),
|
|
|
|
url(r'^about/api$', 'api', name="api"),
|
|
|
|
url(r'^statistics/$', 'statistics', name="statistics"),
|
|
|
|
url(r'^statistics/charts/(?P<chart>[\w\-]+).png$', 'chart', name="chart"),
|
|
|
|
url(r'^world/$', 'world', name="world"),
|
|
|
|
url(r'^world/scan/$', 'world_scan', name="world_scan"),
|
2011-11-15 17:08:29 +01:00
|
|
|
|
|
|
|
# Real data
|
2012-05-06 20:03:49 +02:00
|
|
|
url(r'^categories/', include(categories_patterns)),
|
|
|
|
url(r'^herds/', include(herds_patterns)),
|
|
|
|
url(r'^maintainers/', include(maintainers_patterns)),
|
|
|
|
url(r'^overlays/', include(overlays_patterns)),
|
|
|
|
url(r'^package/', include(package_patterns)),
|
2012-06-03 09:43:49 +02:00
|
|
|
url(r'^tasks/', include(tasks_patterns)),
|
2011-04-13 08:50:24 +02:00
|
|
|
)
|