Remove quotes from bits in a custom tag

1
2
3
def dequote(arg):
    "Given a list, will return a list with any leading and trailing quotes from the items in the list removed"
    return [ ( arg[1:-1] if arg[0] == arg[-1] and arg[0] in ('"', "'") else arg ) for arg in args ]

More like this

  1. split_contents2 for template tags by bl4th3rsk1t3 3 years, 11 months ago
  2. "Youtube watch link to embed" custom tag. by I159 1 year, 7 months ago
  3. Convert Microsoft "smart quotes" to standard quotes by nomadjourney 2 years, 7 months ago
  4. keywords arguments parser for custom template tags by bruno 4 years, 3 months ago
  5. Parse TemplateTag Variables Safely by evan_schulz 4 years, 10 months ago

Comments

(Forgotten your password?)