Ejemplo n.º 1
0
 def loadRelation(self, dbObject, relationName):
     if not relationName in dir(dbObject):
         raise InternalError('Relation %s not valid for class %s' %
                             (relationName, dbObject.__class__.__name__))
     o = None
     exec 'o = dbObject.%s' % (relationName)
     return o
Ejemplo n.º 2
0
 def execute(cls, func):
     def decorate(*args, **kwargs):
         try:
             response = func(*args, **kwargs)
         except CdbException, ex:
             cls.getLogger().error('%s' % ex)
             cls.handleException(ex)
             response = ex.getFullJsonRep()
         except Exception, ex:
             cls.getLogger().error('%s' % ex)
             cls.handleException(ex)
             response = InternalError(ex).getFullJsonRep()
Ejemplo n.º 3
0
 def execute(cls, func):
     def decorate(*args, **kwargs):
         try:
             response = func(*args, **kwargs)
             cherrypy.response.headers["Access-Control-Allow-Origin"] = "*"
         except CdbException, ex:
             cls.getLogger().error('%s' % ex)
             cls.handleException(ex)
             response = ex.getFullJsonRep()
         except Exception, ex:
             cls.getLogger().error('%s' % ex)
             cls.handleException(ex)
             response = InternalError(ex).getFullJsonRep()
Ejemplo n.º 4
0
 def runCommand(self):
     """ This method must be implemented by the derived class. """
     raise InternalError(
         'Method runCommand() must be overriden in the derived class.')
Ejemplo n.º 5
0
 def handleCpException(cls):
     cherrypy.response.status = httplib.OK
     ex = exc_info()[1]
     if ex == None:
         ex = InternalError('Internal Webservice Error')
     cls.handleException(ex)