コード例 #1
0
 def evaluate(self, context):
     arg0 = self._arg0.evaluate(context)
     if not self._func:
         (prefix, local) = self._key
         uri = context.processorNss.get(prefix)
         if prefix and not uri:
             raise RuntimeException(RuntimeException.UNDEFINED_PREFIX, prefix)
         expanded = (prefix and uri or EMPTY_NAMESPACE, local)
         self._func = (g_extFunctions.get(expanded) or
                       CoreFunctions.CoreFunctions.get(expanded, self.error))
     try:
         result = self._func(context, arg0)
     except TypeError:
         raise RuntimeException(RuntimeException.WRONG_ARGUMENTS, str(expanded), '')
     return result
コード例 #2
0
ファイル: ParsedExpr.py プロジェクト: KGerring/xpath
 def evaluate(self, context):
     arg0 = self._arg0.evaluate(context)
     if not self._func:
         (prefix, local) = self._key
         uri = context.processorNss.get(prefix)
         if prefix and not uri:
             raise RuntimeException(RuntimeException.UNDEFINED_PREFIX,
                                    prefix)
         expanded = (prefix and uri or EMPTY_NAMESPACE, local)
         self._func = g_extFunctions.get(
             expanded) or CoreFunctions.CoreFunctions.get(
                 expanded, self.error)
     try:
         result = self._func(context, arg0)
     except TypeError:
         raise RuntimeException(RuntimeException.WRONG_ARGUMENTS,
                                str(expanded), "")
     return result