Le 16 oct. 2009 à 23:15, Sean Brant a écrit : > Using a decorator allows you to do cool things like > > @provides_html('myapp/mypage.html') > @provides_json(optional_serialize_callback_can_go_here) > def my_view(request): > return {'foo': 'bar') > > Then your provides_* could check the accept-header and know how to > response. Html renders a template and json would serialize the dict.
It reminds me a proof of concept: http://code.welldev.org/djangorators You can chain a lot of decorators but it will lead to hardly readable code, mostly because the order matters. Anyway, it's interesting to see that a lot of people are thinking about the same approach... David --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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 -~----------~----~----~----~------~----~------~--~---