Esempio n. 1
0
def handleError(error, function, args, kwargs, user):
	if isinstance(error, xmlrpclib.Fault):
		fault.log(error)
	else:
		if not (isinstance(error, TypeError) and function.__name__ in str(error)):
			# not a wrong API call
			fault.log(error)
			logger.log("Exception: %s" % error, user=user.name)
		return fault.wrap(error)
Esempio n. 2
0
			fault.log(exc)
			raise
		except Exception, exc:
			fault.log(exc)
			self.logger.log("Exception: %s" % exc, user=user.name)
			raise fault.wrap(exc)

	def render(self, request):
		try:
			return self.handle(request)
		except xmlrpc.Fault, exc:
			fault.log(exc)
			raise
		except Exception, exc:
			fault.log(exc)
			raise fault.wrap(exc)
		
	def handle(self, request):
		username=request.getUser()
		passwd=request.getPassword()
		user=self.login(username, passwd)
		if not user:
			request.setResponseCode(http.UNAUTHORIZED)
			if username=='' and passwd=='':
				return 'Authorization required!'
			else:
				return 'Authorization Failed!'
		request.content.seek(0, 0)
		args, functionPath=xmlrpclib.loads(request.content.read())
		function = None
		if hasattr(self.api, functionPath):