예제 #1
0
 def _unwrap_function(node):
     """Returns the value of the node if it is wrapped in a function, otherwise just returns the node
     """
     if not isinstance(node, FunctionCall):
         return node
     try:
         return XPATH_FUNCTIONS[node.name](node)
     except KeyError:
         raise CaseFilterError(
             _("We don't know what to do with the function \"{}\". Accepted functions are: {}"
               ).format(
                   node.name,
                   ", ".join(list(XPATH_FUNCTIONS.keys())),
               ), serialize(node))
     except XPathFunctionException as e:
         raise CaseFilterError(six.text_type(e), serialize(node))
예제 #2
0
 def _unwrap_function(node):
     """Returns the value of the node if it is wrapped in a function, otherwise just returns the node
     """
     if not isinstance(node, FunctionCall):
         return node
     try:
         return XPATH_FUNCTIONS[node.name](node)
     except KeyError:
         raise CaseFilterError(
             _("We don't know what to do with the function \"{}\". Accepted functions are: {}").format(
                 node.name,
                 ", ".join(list(XPATH_FUNCTIONS.keys())),
             ),
             serialize(node)
         )
     except XPathFunctionException as e:
         raise CaseFilterError(six.text_type(e), serialize(node))