diff options
author | Andy Doan <andy.doan@linaro.org> | 2015-12-03 11:05:23 -0600 |
---|---|---|
committer | Paul Sokolovsky <paul.sokolovsky@linaro.org> | 2015-12-05 17:24:52 +0000 |
commit | 616129ff91ba0b9140546db7e7ef5ff64534dbb5 (patch) | |
tree | 183e4ca0bec99c63c52b3c35a11886bd9cf1a2d4 /urls.py | |
parent | aca215423454bd94e5c6dbdfb91d271f208e5e3c (diff) |
reports: hide reports URL's when feature not enabled
If this feature isn't enabled we should disable the URL's since it just
causes our code to crash.
Change-Id: I0e12d70236f32cbca5c0bc90e3d64ec1f30c2f8e
Reviewed-on: https://review.linaro.org/9431
Reviewed-by: Paul Sokolovsky <paul.sokolovsky@linaro.org>
Diffstat (limited to 'urls.py')
-rw-r--r-- | urls.py | 35 |
1 files changed, 21 insertions, 14 deletions
@@ -71,21 +71,28 @@ urlpatterns = patterns( 'license_protected_downloads.api.v3.publish'), url(r'^api/v3/link_latest/(?P<path>.*)$', 'license_protected_downloads.api.v3.link_latest'), +) - url(r'^reports/$', - 'license_protected_downloads.views.reports'), - - url(r'^reports/(?P<year_month>\d{4}\.\d{2})/downloads/', - 'license_protected_downloads.views.reports_month_downloads'), - url(r'^reports/(?P<year_month>\d{4}\.\d{2})/country/$', - 'license_protected_downloads.views.reports_month_country'), - url(r'^reports/(?P<year_month>\d{4}\.\d{2})/region/$', - 'license_protected_downloads.views.reports_month_region'), - url(r'^reports/(?P<year_month>\d{4}\.\d{2})/country/(?P<country>.*)/', - 'license_protected_downloads.views.reports_month_country_details'), - url(r'^reports/(?P<year_month>\d{4}\.\d{2})/region/(?P<region>.*)/', - 'license_protected_downloads.views.reports_month_region_details'), - +if settings.TRACK_DOWNLOAD_STATS: + urlpatterns += patterns( + '', + url(r'^reports/$', + 'license_protected_downloads.views.reports'), + + url(r'^reports/(?P<year_month>\d{4}\.\d{2})/downloads/', + 'license_protected_downloads.views.reports_month_downloads'), + url(r'^reports/(?P<year_month>\d{4}\.\d{2})/country/$', + 'license_protected_downloads.views.reports_month_country'), + url(r'^reports/(?P<year_month>\d{4}\.\d{2})/region/$', + 'license_protected_downloads.views.reports_month_region'), + url(r'^reports/(?P<year_month>\d{4}\.\d{2})/country/(?P<country>.*)/', + 'license_protected_downloads.views.reports_month_country_details'), + url(r'^reports/(?P<year_month>\d{4}\.\d{2})/region/(?P<region>.*)/', + 'license_protected_downloads.views.reports_month_region_details'), + ) + +urlpatterns += patterns( + '', # Catch-all. We always return a file (or try to) if it exists. # This handler does that. url(r'(?P<path>.*)', 'license_protected_downloads.views.file_server'), |