def split_contents2(token):
"""
Is an updated way of splitting contents for a token,
it does the split, but fixes the list..
EX:
From a tag call like this: {% partial "partials/template.html" %}
usually you get: ['partial','"partials/template.html"'] (notice the " double quotes)
fixes it with: ['partial','partials/template.html'] (takes out the " quotes)
"""
import types,re
value=token.split_contents()
newvalues=[]
for val in value:
if (type(val)==types.UnicodeType or isinstance(val,str)) and val[0]=='"' and val[-1]=='"':
val=re.sub(r'^\"','',val)
val=re.sub(r'\"$','',val)
newvalues.append(val)
return newvalues
Comments