Commit 17f3e925 authored by Aymeric Augustin's avatar Aymeric Augustin
Browse files

Fixed #18397 -- Avoided referencing lawrence.com.

This commit includes multiple small related changes, see the ticket
for a full discussion.
parent 4ce5a5fe
Loading
Loading
Loading
Loading
+6 −6
Original line number Diff line number Diff line
@@ -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)
+4 −4
Original line number Diff line number Diff line
@@ -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
+3 −3
Original line number Diff line number Diff line
@@ -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):
+1 −1
Original line number Diff line number Diff line
@@ -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
+6 −6
Original line number Diff line number Diff line
@@ -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 </topics/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 </topics/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</ref/contrib/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<form-media-paths>` and the
Loading