On Tue, Dec 8, 2009 at 6:43 AM, Simon Willison <si...@simonwillison.net> wrote: > This made it to the 1.2 feature list: > > http://code.djangoproject.com/wiki/ReplacingGetAbsoluteUrl > > If we want this in 1.2, it could be as simple as merging the get_url / > get_url_path methods in to the base Model class, rolling a few unit > tests and writing some documentation.
It could be, but I don't think it is :-) > It feels like we should discuss > it a bit first though - the proposal hasn't really seen much > discussion since it was originally put together back in September last > year. I'm +1 to addressing this problem. Looking over the wiki and past discussions on django-dev, I see some suggestions that the wiki doesn't mention or discount, and I can see some additional issues that the wiki doesn't address: 1. The wiki identifies existing usage, but doesn't address the migration path. The admin currently has (documented) behavior for objects that define get_absolute_url(). ABSOLUTE_URL_OVERRIDES is a documented setting with influence over get_absolute_url. Sitemaps rely on obj.get_absolute_url. What is the migration path for objects that define get_absolute_url? 2. For that matter - which method (get_url or get_url_path) is used preferentially if the user defines both? 3. There is the potential for conflicting implementations because the methods have overlapping return content. For example: def get_url(self): return 'http://example.com/foo/' def get_url_path(self): return '/bar/' Which one is correct? Both methods provide for the definition of the url path. In this case, the exact order of inspection from (2) becomes even more important. 4. I share Mike's concern about using settings.SITE_ID to determine the current host, but I'm not sure I have any suggestions on how we could practically use request, short of encouraging the use of a template tag like {% obj_url %} that can use data from the request context if it is available. 5. The most recent discussion [1] had some talk about using urlparse.ParseResult to make it easier to use the output of get_url. Jacob was +1 to the idea at the time, and I'm inclined to agree with him, although it's unclear how that would affect the rest of the proposal. [1] http://groups.google.com/group/django-developers/browse_thread/thread/7e69c39c23ec1079 Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.