Hello all, I hope I didn't scare anyone away with the word "revamp". The patch is in fact pretty simple and backward compatible.
I don't mean to be pushy and I totally understand that some issues might have higher priority on the road to 1.0, but I think this is something that might be of interest for quite a few people as in [1] [2] [3] [4]. It has been somewhat validated by Malcom [1] [4] and Simon [5]. I believe that small change would make the creation of template tags even more trivial and save a lot of boiler plate code. If you're interested, let me know what you think of the code, it's all in the super_simple_tag.diff patch on ticket #1105 [6]. Thanks! ;) [1] http://groups.google.com/group/django-users/browse_thread/thread/b3b3d7894f48b609 [2] http://groups.google.com/group/django-users/browse_thread/thread/ee830466be465704 [3] http://groups.google.com/group/django-users/browse_thread/thread/36ef798d6f6e46c8/19146dc1f092a59f?lnk=gst&q=simple_tag#19146dc1f092a59f [4] http://groups.google.com/group/django-users/browse_thread/thread/179b206a75fbb456/89eb87ca142a724e?lnk=gst&q=simple_tag+context#89eb87ca142a724e [5] http://groups.google.com/group/django-developers/browse_thread/thread/62d0cefde54a50a3# [6] http://code.djangoproject.com/ticket/1105 On Jun 18, 5:24 pm, Julien Phalip <[EMAIL PROTECTED]> wrote: > Hi, > > I have just posted a patch that improves the simple_tag by allowing it > to take the context and/or the inner block. See the patch in ticket > #1105 [1]. > > It is backward compatible, and while the patch is quite simple it > would make the creation of template tag even more super easy. For > example: > > @register.simple_tag(takes_block=True, takes_context=True) > def customspaceless(context, block_nodelist): > from django.utils.html import strip_spaces_between_tags > return > strip_spaces_between_tags(block_nodelist.render(context).strip()) > > It is nearly completed. There is just a small glitch with block > support, and I haven't been able to figure it out yet. So your > feedback would be very welcome! > > I'd be keen to have it checked in as it makes life much easier ;) > I also believe that many default tags could be revamped using that new > simple_tag, and that way we could shrink the code quite a lot in > django.templates. > > Cheers, > > Julien > > [1]http://code.djangoproject.com/ticket/1105 --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---