#14385: Standardize Site/RequestSite access; looser coupling of sites framework 
in
contrib
---------------------------+------------------------------------------------
 Reporter:  gabrielhurley  |       Owner:  gabrielhurley
   Status:  new            |   Milestone:  1.3          
Component:  Contrib apps   |     Version:  SVN          
 Keywords:                 |       Stage:  Unreviewed   
Has_patch:  1              |  
---------------------------+------------------------------------------------
 A few days ago I started [http://groups.google.com/group/django-
 developers/browse_frm/thread/0584c60ba9969052 this thread on the Django
 Developers list] in order to solve a number of tickets at the same time.
 The gist:

 All of these tickets relate to needing access to the current domain,
 whether that's through a Site instance, or through a RequestSite instance.
 To facilitate this, the provided patch adds a utility function,
 `django.contrib.sites.models.get_current_site` which takes a request as an
 argument and returns either a Site or RequestSite instance.

 Using that utility function, a lot of repetitious code could be removed
 and streamlined, and several tickets were trivial to resolve.

 Included in this patch:

  * Adds the `django.contrib.sites.models.get_current_site` function.
  * Provides a note in the contrib.sites docs regarding the function.
  * Converts to contrib.sites tests from doctests to unit tests and adds a
 test for `get_current_site`
  * Resolves #8960 by allowing `django.contrib.contenttypes.views.shortcut`
 to use either a Site or RequesSite object.
  * Converts contrib.contenttypes tests from doctests to unit tests and
 adds a test for #8960.
  * Resolves #10235 and #10909 by using `get_current_site` in the Sitemaps
 framework.
  * Adds test case for #10235/#10909.
  * Updates `django.contrib.syndication.views` to use `get_current_site.
  * Updates `django.contrib.gis.sitemaps.views` to use `get_current_site`
 as per #10608.
  * Updates `django.contrib.auth.views.login` to use `get_current_site`.

 The patch passes the full test suite under WinXP/Py2.6/SQLite.

 This patch would completely fix #8960, #10235, and #10909. The remainder
 of #10608 is actually invalid, because the remaining places where contrib
 apps rely on contrib.sites the model has a direct relation to Site, or
 there is no way to access a request object to use RequestSite. Any further
 decoupling in contrib would require backwards-incompatible rewrites.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14385>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to