On Apr 2, 2006, at 11:31 AM, Kendall Clark wrote:
It's less typing because in either of our cases, we'd have all those methods. In my case there's one route, and in yours, there's a route for every method.
I'd usually consider a convention something thats more reliable during metaprogramming, than a totally ad-hoc system with no consistence for naming. Personally, maybe I'm just greedy, but I want both options. :) I want a convention that meets the common cases, AND a way for people to not follow it if they want.
When designing dispatch systems, its typically one of the more graceful approaches. I can't really think of any dispatch system in any framework that doesn't do something similar, while it may be ugly to you there's good reasons its the primary approach used for dispatching.
Yes, very true. :)
Yes, though naming conventions have great strengths. Surely you wouldn't want fellow developers not using the same style guide as you? Or having them all name their methods using totally different naming schemes? Conventions have great power when it comes to making systems predictable, usable, and more maintainable in the long run.
Having a consistent convention for supporting HTTP verbs in actions also seems quite explicit to me. As you noted, its definitely doing some method name munging and attempting to locate one action first.
I meant that a system requiring a ton of effort to use, vs a system requiring significantly less effort to use; people would jump to the easiest system that took the least effort to get the results they wanted.
I wasn't assuming for a degenerate case. I was assuming for the case where someone wants to implement REST web services using this technique. In which case its very common depending on how large of an API is being supported, to have dozens of actions, with various HTTP verb support each. This easily results in dozens or hundreds of methods, and would require all those corresponding Routes. I think your use-case is for lighter-weight REST stuff mainly, the subset of HTTP verbs supported by browsers (I think this was coined low-REST or something?). In your use-case, the decorator approach for the few cases you want HTTP verb toggles is probably a better solution.
Then let's discuss that. :) To continue that line of though, here's the sample implementation: controller TestController(BaseController): [EMAIL PROTECTED]rest.dispatch_on(method='POST', action='') def _edit_post(self): So my immediate thoughts on revisiting this. The dispatch_in scheme seems like it'd be a significant amount of effort to handle multiple methods as is. So in the second case I'd instead propose: [EMAIL PROTECTED]rest.restrict('POST') [EMAIL PROTECTED]rest.dispatch_on(POST='_edit_post', DELETE='_edit_delete') def _edit_post(self): To me, these two decorators deal with the most common cases as briefly as possible, and as explicitly as possible. Including the method= takes addition un-required effort since REST already implies that this deals with HTTP verbs IMO. How's that look? Cheers, Ben --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to [EMAIL PROTECTED] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/pylons-discuss -~----------~----~----~----~------~----~------~--~--- |
- Re: routes request Ben Bangert
- Re: routes request Kendall Clark
- Re: routes request Ben Bangert
- Re: routes request Kendall Clark
- Re: routes request Ben Bangert
- Re: routes request Jos Yule
- Re: routes request Kendall Clark
- Re: routes request Ben Bangert
- Re: routes request [EMAIL PROTECTED]
- Re: routes request [EMAIL PROTECTED]
- Re: routes request Ben Bangert
