On Sun, Apr 14, 2013 at 4:56 AM, Łukasz Langa <[email protected]> wrote:

> On 13 kwi 2013, at 23:48, Brantley Harris <[email protected]> wrote:
>
> > It would be extremely easy to implement
>
> Such a statement suggests that the you didn't really think the problem
> through. Few things are "extremely easy to implement", especially in a
> framework with years of legacy projects in the wild.


Which is why I bring up the idea, to hear if anyone has some gotchas or
implementation advice.


>
> > and would lead to vastly better code across new projects, including a
> simpler way of writing rest style interfaces:
> >
> > url('^objects/$', 'views.create_object', methods=['post', 'put'],
> name='create_object'),
> > url('^objects/$', 'views.get_objects', name='list_objects'),
>
> How would you implement a reverse() variant having this functionality in?
>

Reverse deals only with the url, not the method.  Two names "create_object"
and "list_objects" would now point to the same url.  Of course the urls
could change at some point and the urls could diverge, but since you've
already separated the two views by name, you don't have to do any more work.


> Does get_objects respond to DELETE as well?
>

Yes, it's the fall through, accepts all methods just as a url does in
Django now.


> If create_objects raises Http404, do we continue traversing the urlconf?
> What about reverse() in that case?
>

No, since Django does not do this with any other urls.


>
> > I will gladly implement the code required for this, but don't wish to do
> so if it's going to be quashed, which is why I bring it up here.
>
> Often you can find tricky edge cases and other obstacles only through an
> implementation effort. Realistically, no-one will agree to merge a
> functionality based only on a vague mailing list post. Working code wins
> arguments, as they say. Alternatively, a careful up-front design document
> (this is what the core Python team does with PEPs).
>
>
I've brought the topic up for discussion, I'm not looking to see it
pre-approved for merging.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to