Here are the examples of the python api twisted.web.xmlrpc.NoSuchFunction taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
3
Example 1
def _getFunction(self, functionPath):
"""
"""
if functionPath.find(self.separator) != -1:
prefix, functionPath = functionPath.split(self.separator, 1)
handler = self.getSubHandler(prefix)
if handler is None:
raise xmlrpc.NoSuchFunction(self.NOT_FOUND,
"no such subHandler %s" % prefix)
return handler._getFunction(functionPath)
f = getattr(self.api, functionPath, None)
if not f:
raise xmlrpc.NoSuchFunction(self.NOT_FOUND,
"function %s not found" % functionPath)
elif not callable(f):
raise xmlrpc.NoSuchFunction(self.NOT_FOUND,
"function %s not callable" % functionPath)
return f
3
Example 2
def lookupProcedure(self, procedurePath):
try:
return XMLRPC.lookupProcedure(self, procedurePath)
except xmlrpc.NoSuchFunction:
if procedurePath.startswith("SESSION"):
raise xmlrpc.Fault(self.SESSION_EXPIRED,
"Session non-existant/expired.")
else:
raise
3
Example 3
def lookupProcedure(self, procedureName):
"""
Lookup a procedure from a fixed set of choices, either I{echo} or
I{system.listeMethods}.
"""
if procedureName == 'echo':
return self.echo
raise xmlrpc.NoSuchFunction(
self.NOT_FOUND, 'procedure %s not found' % (procedureName,))
0
Example 4
def lookupProcedure(self, procedurePath):
"""
Lookup a method dynamically.
1. First, see if it's provided by a sub-handler.
2. Or try a self-defined method (prefixed with `xmlrpc_`)
3. Lastly, try dynamically mapped methods.
4. Or fail loudly.
"""
log.msg("LOOKING UP:", procedurePath)
if procedurePath.find(self.separator) != -1:
prefix, procedurePath = procedurePath.split(self.separator, 1)
handler = self.getSubHandler(prefix)
if handler is None:
raise xmlrpc.NoSuchFunction(self.NOT_FOUND,
"no such subHandler %s" % prefix)
return handler.lookupProcedure(procedurePath)
# Try self-defined methods first...
f = getattr(self, "xmlrpc_%s" % procedurePath, None)
# Try mapped methods second...
if f is None:
f = self._procedure_map.get(procedurePath, None)
if not f:
raise xmlrpc.NoSuchFunction(self.NOT_FOUND,
"procedure %s not found" % procedurePath)
elif not callable(f):
raise xmlrpc.NoSuchFunction(self.NOT_FOUND,
"procedure %s not callable" % procedurePath)
else:
return f