| 82 | |
| 83 | == The solution == |
| 84 | |
| 85 | I'm currently leaning towards two complementary methods: |
| 86 | |
| 87 | * '''get_url_path()''' - returns the URL's path component, starting at the root of the site - e.g. "/blog/2008/Aug/11/slug/" |
| 88 | * '''get_url()''' - returns the full URL, including the protocol and domain - e.g. http://example.com/blog/2008/Aug/11/slug/" |
| 89 | |
| 90 | Users should be able to define either or both of these methods. If they define one but not the other, the default implementation of the undefined method can attempt to figure it out based on the method that IS defined. This should actually work pretty well - get_url_path() is trival to derive from get_url(), whereas for sites that only exist on one domain get_url() could simply glue that domain (defined in settings.py, or derived from SITE_ID and the sites framework) on to get_url_path(). |
| 91 | |
| 92 | I don't think this needs to be all that complicated, and in fact the above scheme could allow us to delete a whole bunch of weird special case code scattered throughout Django. |