On Mon, Jul 27, 2009 at 7:55 AM, Alexandru Nedelcu<a...@lexoft.eu> wrote: > > Hi, > > I'm a newbie when it comes to Django ... I picked it up for a personal > project because it seemed like a good fit. > > I do miss a feature from Catalyst ... chained actions. > I added this functionality to Django by myself (just a few hours > hack), see here (example + code): > http://code.google.com/p/django-catalyst/ > > It's all about code-reuse in views. What I'd like to ask you guys ... > what's the recommended practice for achieving the same thing in > Django? I hate repeating myself, and the chained actions from Catalyst > allow for some neat tricks.
When Dean Kamen announced the Segway, PR departments went into overdrive writing about the fantastic advances in gyroscopes that were necessary to make a two wheeled vehicle remain stable and upright. Those that weren't enthralled by the reality distortion field asked "What about using a third wheel?" Perhaps I'm missing some of the "neat tricks" that are only possible using this approach, but my immediate reaction is that you appear to be going to great lengths to avoid the obvious solution - a method call. The example you provide with articles(), list(), and item() could be just as elegantly expressed using methods that return a list of objects or a single object. Method calls can accept multiple arguments, and can return multiple values; they can be conditionally executed; and they can be combined in infinite variation - not just 'chained'. Of course, if I'm missing something, feel free to enlighten me. I'm always interested in finding elegant ways to express complex ideas. However, outside of academic circles, cleverness for cleverness' sake isn't really a desirable goal. Yours, Russ Magee %-) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---