From 17f3e9258e6050c274a7294213bd08bb71f2d2da Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Thu, 7 Jun 2012 11:50:20 +0200 Subject: [PATCH] Fixed #18397 -- Avoided referencing lawrence.com. This commit includes multiple small related changes, see the ticket for a full discussion. --- django/conf/global_settings.py | 12 ++++++------ .../conf/project_template/project_name/settings.py | 8 ++++---- django/contrib/messages/tests/cookie.py | 6 +++--- docs/ref/contrib/csrf.txt | 2 +- docs/ref/settings.txt | 12 ++++++------ docs/topics/http/sessions.txt | 2 +- 6 files changed, 21 insertions(+), 21 deletions(-) diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py index 4711baad66..13f7991b57 100644 --- a/django/conf/global_settings.py +++ b/django/conf/global_settings.py @@ -270,19 +270,19 @@ SECRET_KEY = '' DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage' # Absolute filesystem path to the directory that will hold user-uploaded files. -# Example: "/home/media/media.lawrence.com/media/" +# Example: "/var/www/example.com/media/" MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. -# Example: "http://media.lawrence.com/media/" +# Examples: "http://example.com/media/", "http://media.example.com/" MEDIA_URL = '' -# Absolute path to the directory that holds static files. -# Example: "/home/media/media.lawrence.com/static/" +# Absolute path to the directory static files should be collected to. +# Example: "/var/www/example.com/static/" STATIC_ROOT = '' # URL that handles the static files served from STATIC_ROOT. -# Example: "http://media.lawrence.com/static/" +# Example: "http://example.com/static/", "http://static.example.com/" STATIC_URL = None # List of upload handler classes to be applied in order. @@ -451,7 +451,7 @@ MIDDLEWARE_CLASSES = ( SESSION_COOKIE_NAME = 'sessionid' # Cookie name. This can be whatever you want. SESSION_COOKIE_AGE = 60 * 60 * 24 * 7 * 2 # Age of cookie, in seconds (default: 2 weeks). -SESSION_COOKIE_DOMAIN = None # A string like ".lawrence.com", or None for standard domain cookie. +SESSION_COOKIE_DOMAIN = None # A string like ".example.com", or None for standard domain cookie. SESSION_COOKIE_SECURE = False # Whether the session cookie should be secure (https:// only). SESSION_COOKIE_PATH = '/' # The path of the session cookie. SESSION_COOKIE_HTTPONLY = True # Whether to use the non-RFC standard httpOnly flag (IE, FF3+, others) diff --git a/django/conf/project_template/project_name/settings.py b/django/conf/project_template/project_name/settings.py index 0eccc4eaf5..99590d6fd5 100644 --- a/django/conf/project_template/project_name/settings.py +++ b/django/conf/project_template/project_name/settings.py @@ -44,22 +44,22 @@ USE_L10N = True USE_TZ = True # Absolute filesystem path to the directory that will hold user-uploaded files. -# Example: "/home/media/media.lawrence.com/media/" +# Example: "/var/www/example.com/media/" MEDIA_ROOT = '' # URL that handles the media served from MEDIA_ROOT. Make sure to use a # trailing slash. -# Examples: "http://media.lawrence.com/media/", "http://example.com/media/" +# Examples: "http://example.com/media/", "http://media.example.com/" MEDIA_URL = '' # Absolute path to the directory static files should be collected to. # Don't put anything in this directory yourself; store your static files # in apps' "static/" subdirectories and in STATICFILES_DIRS. -# Example: "/home/media/media.lawrence.com/static/" +# Example: "/var/www/example.com/static/" STATIC_ROOT = '' # URL prefix for static files. -# Example: "http://media.lawrence.com/static/" +# Example: "http://example.com/static/", "http://static.example.com/" STATIC_URL = '/static/' # Additional locations of static files diff --git a/django/contrib/messages/tests/cookie.py b/django/contrib/messages/tests/cookie.py index 19d0e08384..477eb72e56 100644 --- a/django/contrib/messages/tests/cookie.py +++ b/django/contrib/messages/tests/cookie.py @@ -39,7 +39,7 @@ def stored_cookie_messages_count(storage, response): return len(data) -@override_settings(SESSION_COOKIE_DOMAIN='.lawrence.com') +@override_settings(SESSION_COOKIE_DOMAIN='.example.com') class CookieTest(BaseTest): storage_class = CookieStorage @@ -65,7 +65,7 @@ class CookieTest(BaseTest): storage.add(constants.INFO, 'test') storage.update(response) self.assertTrue('test' in response.cookies['messages'].value) - self.assertEqual(response.cookies['messages']['domain'], '.lawrence.com') + self.assertEqual(response.cookies['messages']['domain'], '.example.com') self.assertEqual(response.cookies['messages']['expires'], '') # Test after the messages have been consumed @@ -76,7 +76,7 @@ class CookieTest(BaseTest): pass # Iterate through the storage to simulate consumption of messages. storage.update(response) self.assertEqual(response.cookies['messages'].value, '') - self.assertEqual(response.cookies['messages']['domain'], '.lawrence.com') + self.assertEqual(response.cookies['messages']['domain'], '.example.com') self.assertEqual(response.cookies['messages']['expires'], 'Thu, 01-Jan-1970 00:00:00 GMT') def test_get_bad_cookie(self): diff --git a/docs/ref/contrib/csrf.txt b/docs/ref/contrib/csrf.txt index 0ff9bd1a51..b11af3be28 100644 --- a/docs/ref/contrib/csrf.txt +++ b/docs/ref/contrib/csrf.txt @@ -441,7 +441,7 @@ Default: ``None`` The domain to be used when setting the CSRF cookie. This can be useful for easily allowing cross-subdomain requests to be excluded from the normal cross site request forgery protection. It should be set to a string such as -``".lawrence.com"`` to allow a POST request from a form on one subdomain to be +``".example.com"`` to allow a POST request from a form on one subdomain to be accepted by a view served from another subdomain. Please note that, with or without use of this setting, this CSRF protection diff --git a/docs/ref/settings.txt b/docs/ref/settings.txt index a1b76f65e1..566c167fec 100644 --- a/docs/ref/settings.txt +++ b/docs/ref/settings.txt @@ -314,7 +314,7 @@ Default: ``None`` The domain to be used when setting the CSRF cookie. This can be useful for easily allowing cross-subdomain requests to be excluded from the normal cross site request forgery protection. It should be set to a string such as -``".lawrence.com"`` to allow a POST request from a form on one subdomain to be +``".example.com"`` to allow a POST request from a form on one subdomain to be accepted by accepted by a view served from another subdomain. Please note that the presence of this setting does not imply that Django's CSRF @@ -1404,7 +1404,7 @@ Default: ``''`` (Empty string) Absolute path to the directory that holds media for this installation, used for :doc:`managing stored files `. -Example: ``"/home/media/media.lawrence.com/"`` +Example: ``"/var/www/example.com/media/"`` See also :setting:`MEDIA_URL`. @@ -1418,7 +1418,7 @@ Default: ``''`` (Empty string) URL that handles the media served from :setting:`MEDIA_ROOT`, used for :doc:`managing stored files `. -Example: ``"http://media.lawrence.com/"`` +Example: ``"http://media.example.com/"`` .. versionchanged:: 1.3 It must end in a slash if set to a non-empty value. @@ -1704,7 +1704,7 @@ SESSION_COOKIE_DOMAIN Default: ``None`` The domain to use for session cookies. Set this to a string such as -``".lawrence.com"`` for cross-domain cookies, or use ``None`` for a standard +``".example.com"`` for cross-domain cookies, or use ``None`` for a standard domain cookie. See the :doc:`/topics/http/sessions`. .. setting:: SESSION_COOKIE_HTTPONLY @@ -1885,7 +1885,7 @@ Default: ``''`` (Empty string) The absolute path to the directory where :djadmin:`collectstatic` will collect static files for deployment. -Example: ``"/home/example.com/static/"`` +Example: ``"/var/www/example.com/static/"`` If the :doc:`staticfiles` contrib app is enabled (default) the :djadmin:`collectstatic` management command will collect static @@ -1915,7 +1915,7 @@ Default: ``None`` URL to use when referring to static files located in :setting:`STATIC_ROOT`. -Example: ``"/site_media/static/"`` or ``"http://static.example.com/"`` +Example: ``"/static/"`` or ``"http://static.example.com/"`` If not ``None``, this will be used as the base path for :ref:`media definitions` and the diff --git a/docs/topics/http/sessions.txt b/docs/topics/http/sessions.txt index 4b0bbe4ed5..20dc61a222 100644 --- a/docs/topics/http/sessions.txt +++ b/docs/topics/http/sessions.txt @@ -503,7 +503,7 @@ SESSION_COOKIE_DOMAIN Default: ``None`` The domain to use for session cookies. Set this to a string such as -``".lawrence.com"`` (note the leading dot!) for cross-domain cookies, or use +``".example.com"`` (note the leading dot!) for cross-domain cookies, or use ``None`` for a standard domain cookie. SESSION_COOKIE_HTTPONLY