Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple Optional objects #6

Open
jonas-grgt opened this issue May 10, 2011 · 1 comment
Open

Multiple Optional objects #6

jonas-grgt opened this issue May 10, 2011 · 1 comment

Comments

@jonas-grgt
Copy link

Having more then one Optional Object fails parsing the parameters.

@tag(register, [Constant('as'), Name(), Optional([Constant('for'), Variable()]), Optional([Constant('count'), Variable()])])
def get_tagcloud(context, asvar, forvar=None, countvar=None):

I think the problem lies inside the call method of the Parser Class, which assumes that all parameters are present in the order they are defined.

@domguard
Copy link

Alex, this is a real problem, as it prevents us to add more than one optional argument to - for example - django-taggit-templatetag because it depends on templatetag-sugar.
See for yourself, on this abandoned but much used project, 3 forks at last have tried to implement a simple "limit" additionnal argument to limit the number of tags ouputted by the templatetag, only jonas did it, but he had to fix django-template-sugar first.

The rewrite of django-template-sugar by jonasgeiregat fixes this problem and introduces a simpler API, but there's a bunch of other apps relying on your original template-sugar app, and turning onto jonas version to solve this simple bug implies a syntax change that breaks other pluggable apps elsewhere...

Could you please have a look at this issue when you find 5 minutes ?
thanks...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants