diff options
| author | Paul Oswald | 2012-02-14 11:19:40 +0900 | 
|---|---|---|
| committer | Paul Oswald | 2012-02-14 11:25:59 +0900 | 
| commit | 9c8ca51c78b96835d4f2aa09bdf38d5c9dc01102 (patch) | |
| tree | 0e6b92150d11e359bc01071a3db62926bb057b21 | |
| parent | ba1e3b46998254e12578d75428669751e105735b (diff) | |
| download | django-rest-framework-9c8ca51c78b96835d4f2aa09bdf38d5c9dc01102.tar.bz2 | |
Delete robots.txt, favicon.ico views; Move style to a new static namespace
| -rw-r--r-- | AUTHORS | 1 | ||||
| -rw-r--r-- | djangorestframework/static/djangorestframework/css/style.css (renamed from djangorestframework/static/css/djangorestframework.css) | 0 | ||||
| -rw-r--r-- | djangorestframework/static/favicon.ico | bin | 1286 -> 0 bytes | |||
| -rw-r--r-- | djangorestframework/static/robots.txt | 2 | ||||
| -rw-r--r-- | djangorestframework/templates/api_login.html | 2 | ||||
| -rw-r--r-- | djangorestframework/templates/renderer.html | 2 | ||||
| -rw-r--r-- | djangorestframework/tests/views.py | 14 | ||||
| -rw-r--r-- | djangorestframework/urls.py | 10 | ||||
| -rw-r--r-- | djangorestframework/utils/staticviews.py | 9 | ||||
| -rw-r--r-- | docs/howto/setup.rst | 7 | 
10 files changed, 6 insertions, 41 deletions
| @@ -30,6 +30,7 @@ Chris Pickett <bunchesofdonald>  Ben Timby <btimby>  Michele Lazzeri <michelelazzeri-nextage>  Camille Harang <mammique> +Paul Oswald <poswald>  THANKS TO: diff --git a/djangorestframework/static/css/djangorestframework.css b/djangorestframework/static/djangorestframework/css/style.css index 1e75b8e8..1e75b8e8 100644 --- a/djangorestframework/static/css/djangorestframework.css +++ b/djangorestframework/static/djangorestframework/css/style.css diff --git a/djangorestframework/static/favicon.ico b/djangorestframework/static/favicon.icoBinary files differ deleted file mode 100644 index 17080106..00000000 --- a/djangorestframework/static/favicon.ico +++ /dev/null diff --git a/djangorestframework/static/robots.txt b/djangorestframework/static/robots.txt deleted file mode 100644 index 1f53798b..00000000 --- a/djangorestframework/static/robots.txt +++ /dev/null @@ -1,2 +0,0 @@ -User-agent: * -Disallow: / diff --git a/djangorestframework/templates/api_login.html b/djangorestframework/templates/api_login.html index 016a4e10..07929f0c 100644 --- a/djangorestframework/templates/api_login.html +++ b/djangorestframework/templates/api_login.html @@ -2,7 +2,7 @@  <html>      <head> -        <link rel="stylesheet" type="text/css" href='{% get_static_prefix %}css/djangorestframework.css'/> +        <link rel="stylesheet" type="text/css" href='{% get_static_prefix %}djangorestframework/css/style.css'/>      </head>      <body class="login"> diff --git a/djangorestframework/templates/renderer.html b/djangorestframework/templates/renderer.html index e396a58f..bda49e6f 100644 --- a/djangorestframework/templates/renderer.html +++ b/djangorestframework/templates/renderer.html @@ -6,7 +6,7 @@  {% load static %}  <html xmlns="http://www.w3.org/1999/xhtml">    	<head> -      	<link rel="stylesheet" type="text/css" href='{% get_static_prefix %}css/djangorestframework.css'/> +      	<link rel="stylesheet" type="text/css" href='{% get_static_prefix %}djangorestframework/css/style.css'/>    		<title>Django REST framework - {{ name }}</title>    	</head>    <body> diff --git a/djangorestframework/tests/views.py b/djangorestframework/tests/views.py index ab5d75d6..d4189087 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 827aac9c..5c797bcd 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 12a36f6c..9bae0ee7 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/2R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AAAAAAABORkXhTkZF/2JbWv7Ly8tgAAAAAAAAAABORkUGAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAE5GRWBORkX2TkZFYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA//+AAP9/gAD+P4AA4AOAAMADgADAA4AAwAOAAMMBgACCAIAAAAGAAIBDgADAA4AAwAOAAMADgADAB4AA/H+AAP7/gAA=' -    return HttpResponse(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 f14e0499..22f98f0c 100644 --- a/docs/howto/setup.rst +++ b/docs/howto/setup.rst @@ -37,16 +37,15 @@ The Python `markdown library <http://www.freewisdom.org/projects/python-markdown  If markdown is installed your :class:`.Resource` descriptions can include `markdown style formatting   <http://daringfireball.net/projects/markdown/syntax>`_ 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'), | 
