Patch: Indefinite args for simpletags and inclusion tags

4 views
Skip to first unread message

Stephen Burrows

unread,
Jul 16, 2010, 1:07:25 PM7/16/10
to Django developers
Hi,
I've patched django to allow indefinite args for simple tags and
inclusion tags. My impetus for doing so was as follows:

I have a project that registers inclusion template tags for methods on
objects in a registry. (http://github.com/melinath/pipettes/blob/
master/templatetags/pipettes.py) In order to correctly set the tag's
name (and provide other basic functionality in the future) I have to
wrap the method.

However, I have no way of knowing how many arguments the method will
have, and I don't want to restrict people who might register objects
to a certain number of arguments. So the wrapper should accept *args.

Unfortunately, django seems to purposely ignore the possibility of
*args in creating simple tags and inclusion tags, instead checking
only how many args and default args have been specified for the node's
function.

Before posting the patch to django's ticketing system, I wanted to
check whether this would be a non-trivial patch and whether there
might be any good alternatives.

Thanks!
--Stephen

Tobias McNulty

unread,
Jul 16, 2010, 1:25:49 PM7/16/10
to django-d...@googlegroups.com
On Fri, Jul 16, 2010 at 1:07 PM, Stephen Burrows <stephen....@gmail.com> wrote:
Before posting the patch to django's ticketing system, I wanted to
check whether this would be a non-trivial patch and whether there
might be any good alternatives.

Hard to tell without seeing the patch. :-)

Could you stick it somewhere we can see it?  Personally I like to see them in Trac, since it comes with pretty colors.  If there isn't a ticket already out there for this I see no problem with creating one.  We can always close it if it gets rejected.

Cheers
Tobias
--
Tobias McNulty
Caktus Consulting Group, LLC
P.O. Box 1454
Carrboro, NC 27510
USA: +1 (919) 951-0052
http://www.caktusgroup.com

Stephen Burrows

unread,
Jul 16, 2010, 1:52:47 PM7/16/10
to Django developers
I went ahead and made a ticket with the patch. Thanks!
http://code.djangoproject.com/ticket/13956

--Stephen

On Jul 16, 1:25 pm, Tobias McNulty <tob...@caktusgroup.com> wrote:
> On Fri, Jul 16, 2010 at 1:07 PM, Stephen Burrows <
>

Gregor Müllegger

unread,
Jul 17, 2010, 5:36:56 AM7/17/10
to django-d...@googlegroups.com
Hi,

a quick +1 from me - the patch doesn't seem to introduce
backwards-compatibility issues or implement a YAGNI feature - since there is
already a usecase.

Only documentation and tests are missing.

--
Servus,
Gregor Müllegger

2010/7/16 Stephen Burrows <stephen....@gmail.com>:

> --
> You received this message because you are subscribed to the Google Groups "Django developers" group.
> To post to this group, send email to django-d...@googlegroups.com.
> To unsubscribe from this group, send email to django-develop...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.
>
>

Russell Keith-Magee

unread,
Jul 21, 2010, 10:45:34 PM7/21/10
to django-d...@googlegroups.com
On Sat, Jul 17, 2010 at 1:52 AM, Stephen Burrows
<stephen....@gmail.com> wrote:
> I went ahead and made a ticket with the patch. Thanks!
> http://code.djangoproject.com/ticket/13956

Seems like a reasonable suggestion. As noted on the ticket, your patch
needs docs and tests before it would be accepted for inclusion in
trunk.

Yours,
Russ Magee %-)

Reply all
Reply to author
Forward
0 new messages