django-ttag icon indicating copy to clipboard operation
django-ttag copied to clipboard

smarter_split parsing problems

Open svevang opened this issue 13 years ago • 0 comments

Hello,

I'm trying to create a template tag that uses a little bit of JSON as a keyword arg. I'm getting exceptions thrown in the Arg class code. I believe I have the issue traced to the regular expressions used in the smarter_split function.


In [37]: tag_args = "tagname asdf='embedded=true&locations=[\"blah\", \"asdf\"]'"

In [38]: print tag_args
tagname asdf='embedded=true&locations=["blah", "asdf"]'

In [39]: list(smarter_split(tag_args))
Out[39]: [u'tagname', [u'asdf=\'embedded=true&locations=["blah"', u'"asdf"]\'']]

Later on , the code in Arg tries to use the result of the string split and I get:

line 191, in _process_named_args
   arg = self._meta.named_args[arg_name]

TypeError: unhashable type: 'list'

So it seems that the regex should not be returning a list?

Thanks a lot!

svevang avatar Jul 26 '11 23:07 svevang