Ejemplo n.º 1
0
def raw_json(argument):
    if argument is None:
        return directives.unchanged(argument)
    try:
        json.loads(argument)
    except json.decoder.JSONDecodeError:
        return ''
    return argument
Ejemplo n.º 2
0
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
Ejemplo n.º 3
0
def _clean_download_name_value(argument):
    if argument.endswith(".svg"):
        return argument.replace(".svg", "")
    return directives.unchanged(argument)
Ejemplo n.º 4
0
def directives_unchanged_list(argument):
    return [directives.unchanged(argument)]
Ejemplo n.º 5
0
 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]))
Ejemplo n.º 6
0
 def entries(argument):
     """ Option spec for entries option """
     return directives.unchanged(argument).split()