def raw_json(argument): if argument is None: return directives.unchanged(argument) try: json.loads(argument) except json.decoder.JSONDecodeError: return '' return argument
def raw_json(argument): """Type of direction attribute.""" if argument is None: return directives.unchanged(argument) try: json.loads(argument) except json.decoder.JSONDecodeError: return "" return argument
def _clean_download_name_value(argument): if argument.endswith(".svg"): return argument.replace(".svg", "") return directives.unchanged(argument)
def directives_unchanged_list(argument): return [directives.unchanged(argument)]
def test_unchanged(self): self.assertEqual('', directives.unchanged('')) self.assertTrue('something' == directives.unchanged('something')) self.assertEqual(3, directives.unchanged(3)) self.assertEqual([3], directives.unchanged([3]))
def entries(argument): """ Option spec for entries option """ return directives.unchanged(argument).split()