From 9c8ca51c78b96835d4f2aa09bdf38d5c9dc01102 Mon Sep 17 00:00:00 2001 From: Paul Oswald Date: Tue, 14 Feb 2012 11:19:40 +0900 Subject: [PATCH] Delete robots.txt, favicon.ico views; Move style to a new static namespace --- AUTHORS | 1 + .../css/style.css} | 0 djangorestframework/static/favicon.ico | Bin 1286 -> 0 bytes djangorestframework/static/robots.txt | 2 -- djangorestframework/templates/api_login.html | 2 +- djangorestframework/templates/renderer.html | 2 +- djangorestframework/tests/views.py | 14 -------------- djangorestframework/urls.py | 10 ---------- djangorestframework/utils/staticviews.py | 9 --------- docs/howto/setup.rst | 7 +++---- 10 files changed, 6 insertions(+), 41 deletions(-) rename djangorestframework/static/{css/djangorestframework.css => djangorestframework/css/style.css} (100%) delete mode 100644 djangorestframework/static/favicon.ico delete mode 100644 djangorestframework/static/robots.txt diff --git a/AUTHORS b/AUTHORS index 7fae45784..e79cac9cb 100644 --- a/AUTHORS +++ b/AUTHORS @@ -30,6 +30,7 @@ Chris Pickett Ben Timby Michele Lazzeri Camille Harang +Paul Oswald THANKS TO: diff --git a/djangorestframework/static/css/djangorestframework.css b/djangorestframework/static/djangorestframework/css/style.css similarity index 100% rename from djangorestframework/static/css/djangorestframework.css rename to djangorestframework/static/djangorestframework/css/style.css diff --git a/djangorestframework/static/favicon.ico b/djangorestframework/static/favicon.ico deleted file mode 100644 index 1708010646f87b3690f64c48a56f2b461c8addcf..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1286 zcmc&!(MwZd6hBfZLLdhD96j}4^bpx>dN*+{({1UTWljTq(nRl<2!cWk!lH+g2pJ)P zge`jrWETb5TYo^Lh(e$Qrl{18zjL|Y3`+eu``xsFLKDD)k@5}V# zJW(AHT?J60D}dDh*Hb7Ig1}cGa@HBZtpuutZ`I!j#v+lE*K@BJwJ&G!criO$v$ndr z3I0CtI38`?hYzRXG4a?1mVk_xul?-_ZZ)vk(ir5KsVN>z_p#^&(U8SM1N}T{+iw1# zJ1L&WfIF}D@;nZ;u3QW^1lVz$=UQt<=$@6+>fXfon9T9n)Jl$805iJpFWj#7J8VB1 zNuWOZHk&<+TGpQSc-VViJOt~a6Fqu??pW+Zb0ofBTok|2mf)@8lj&)Gx3J**OTRbS z#o76J@!9b_c1(S1Q=_|2=w|(a)V*~E>m!rb)*Su~k9(d+Cwg0E|6?x4<0Hf0y;^2c z* - + diff --git a/djangorestframework/templates/renderer.html b/djangorestframework/templates/renderer.html index e396a58f5..bda49e6f8 100644 --- a/djangorestframework/templates/renderer.html +++ b/djangorestframework/templates/renderer.html @@ -6,7 +6,7 @@ {% load static %} - + Django REST framework - {{ name }} diff --git a/djangorestframework/tests/views.py b/djangorestframework/tests/views.py index ab5d75d6a..d41890878 100644 --- a/djangorestframework/tests/views.py +++ b/djangorestframework/tests/views.py @@ -46,8 +46,6 @@ class MockResource(ModelResource): fields = ('foo', 'bar', 'baz') urlpatterns = patterns('djangorestframework.utils.staticviews', - url(r'^robots.txt$', 'deny_robots'), - url(r'^favicon.ico$', 'favicon'), url(r'^accounts/login$', 'api_login'), url(r'^accounts/logout$', 'api_logout'), url(r'^mock/$', MockView.as_view()), @@ -123,18 +121,6 @@ class ExtraViewsTests(TestCase): """Test the extra views djangorestframework provides""" urls = 'djangorestframework.tests.views' - def test_robots_view(self): - """Ensure the robots view exists""" - response = self.client.get('/robots.txt') - self.assertEqual(response.status_code, 200) - self.assertEqual(response['Content-Type'], 'text/plain') - - def test_favicon_view(self): - """Ensure the favicon view exists""" - response = self.client.get('/favicon.ico') - self.assertEqual(response.status_code, 200) - self.assertEqual(response['Content-Type'], 'image/vnd.microsoft.icon') - def test_login_view(self): """Ensure the login view exists""" response = self.client.get('/accounts/login') diff --git a/djangorestframework/urls.py b/djangorestframework/urls.py index 827aac9cd..5c797bcdb 100644 --- a/djangorestframework/urls.py +++ b/djangorestframework/urls.py @@ -1,16 +1,6 @@ from django.conf.urls.defaults import patterns -from django.conf import settings urlpatterns = patterns('djangorestframework.utils.staticviews', - (r'robots.txt', 'deny_robots'), (r'^accounts/login/$', 'api_login'), (r'^accounts/logout/$', 'api_logout'), ) - -# Only serve favicon in production because otherwise chrome users will pretty much -# permanantly have the django-rest-framework favicon whenever they navigate to -# 127.0.0.1:8000 or whatever, which gets annoying -if not settings.DEBUG: - urlpatterns += patterns('djangorestframework.utils.staticviews', - (r'favicon.ico', 'favicon'), - ) diff --git a/djangorestframework/utils/staticviews.py b/djangorestframework/utils/staticviews.py index 12a36f6c2..9bae0ee78 100644 --- a/djangorestframework/utils/staticviews.py +++ b/djangorestframework/utils/staticviews.py @@ -6,15 +6,6 @@ from django.template import RequestContext import base64 -def deny_robots(request): - return HttpResponse('User-agent: *\nDisallow: /', mimetype='text/plain') - - -def favicon(request): - data = 'AAABAAEAEREAAAEAIADwBAAAFgAAACgAAAARAAAAIgAAAAEAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADLy8tLy8vL3svLy1QAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAy8vLBsvLywkAAAAATkZFS1xUVPqhn57/y8vL0gAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAJmVlQ/GxcXiy8vL88vLy4FdVlXzTkZF/2RdXP/Ly8vty8vLtMvLy5DLy8vty8vLxgAAAAAAAAAAAAAAAAAAAABORkUJTkZF4lNMS/+Lh4f/cWtq/05GRf9ORkX/Vk9O/3JtbP+Ef3//Vk9O/2ljYv/Ly8v5y8vLCQAAAAAAAAAAAAAAAE5GRQlORkX2TkZF/05GRf9ORkX/TkZF/05GRf9ORkX/TkZF/05GRf9ORkX/UElI/8PDw5cAAAAAAAAAAAAAAAAAAAAAAAAAAE5GRZZORkX/TkZ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se(base64.b64decode(data), mimetype='image/vnd.microsoft.icon') - - # BLERGH # Replicate django.contrib.auth.views.login simply so we don't have get users to update TEMPLATE_CONTEXT_PROCESSORS # to add ADMIN_MEDIA_PREFIX to the RequestContext. I don't like this but really really want users to not have to diff --git a/docs/howto/setup.rst b/docs/howto/setup.rst index f14e04999..22f98f0c6 100644 --- a/docs/howto/setup.rst +++ b/docs/howto/setup.rst @@ -37,16 +37,15 @@ The Python `markdown library `_ which will be rendered by the HTML documenting renderer. -robots.txt, favicon, login/logout +login/logout --------------------------------- -Django REST framework comes with a few views that can be useful including a deny robots view, a favicon view, and api login and logout views:: +Django REST framework comes with a few views that can be useful including an api +login and logout views:: from django.conf.urls.defaults import patterns urlpatterns = patterns('djangorestframework.views', - (r'robots.txt', 'deny_robots'), - (r'favicon.ico', 'favicon'), # Add your resources here (r'^accounts/login/$', 'api_login'), (r'^accounts/logout/$', 'api_logout'),