def process(self): """ Processes the request, analyzing the parameters, and feeding them to the _getAnswer() method (implemented by derived classes) """ self._setLang() self._checkParams() self._checkProtection() try: security.sanitizationCheck(self._target, self._params, self._aw) except (htmlScriptError, htmlForbiddenTag), e: raise HTMLSecurityError('ERR-X0','HTML Security problem - you might be using forbidden tags: %s ' % str(e))
def process(self): """ Processes the request, analyzing the parameters, and feeding them to the _getAnswer() method (implemented by derived classes) """ self._setLang() self._checkParams() self._checkProtection() try: security.sanitizationCheck(self._target, self._params, self._aw) except (htmlScriptError, htmlForbiddenTag), e: raise HTMLSecurityError( 'ERR-X0', 'HTML Security problem - you might be using forbidden tags: %s ' % str(e))
def process( self, params ): """ """ profile = False proffilename = "" res = "" retry = 10 textLog = [] self._startTime = datetime.now() # create the context ContextManager.create() #redirect to https if necessary if self._checkHttpsRedirect(): return res DBMgr.getInstance().startRequest() self._startRequestSpecific2RH() # I.e. implemented by Room Booking request handlers textLog.append("%s : Database request started"%(datetime.now() - self._startTime)) Logger.get('requestHandler').info('[pid=%s] Request %s started (%s)' % (os.getpid(),id(self._req), self._req.unparsed_uri)) try: while retry>0: try: Logger.get('requestHandler').info('\t[pid=%s] from host %s' % (os.getpid(), self.getHostIP())) try: DBMgr.getInstance().sync() # keep a link to the web session in the access wrapper # this is used for checking access/modification key existence # in the user session self._aw.setIP( self.getHostIP() ) self._aw.setSession(self._getSession()) #raise(str(dir(self._websession))) self._setSessionUser() self._setLang() if self._getUser(): Logger.get('requestHandler').debug('Request %s identified with user %s (%s)' % (id(self._req), self._getUser().getFullName(), self._getUser().getId())) #if self._getUser() != None and self._getUser().getId() == "893": # profile = True self._reqParams = copy.copy( params ) self._checkParams( self._reqParams ) self._checkProtection() security.sanitizationCheck(self._target, self._reqParams, self._aw) if self._doProcess: if profile: import hotshot, hotshot.stats proffilename = os.path.join(Config.getInstance().getTempDir(), "stone%s.prof" % str(random.random())) prof = hotshot.Profile(proffilename) res = prof.runcall(self._process) prof.close() else: res = self._process() self._endRequestSpecific2RH( True ) # I.e. implemented by Room Booking request handlers DBMgr.getInstance().endRequest( True ) Logger.get('requestHandler').info('Request %s successful' % (id(self._req))) #request succesfull, now, doing tas that must be done only once try: self._sendEmails() self._deleteTempFiles() except: pass break except MaKaCError, e: #DBMgr.getInstance().endRequest(False) res = self._processError(e) except ConflictError: self._abortSpecific2RH() DBMgr.getInstance().abort() retry -= 1 continue except ClientDisconnected: self._abortSpecific2RH() DBMgr.getInstance().abort() retry -= 1 time.sleep(10-retry) continue except AccessError, e: #Access error treatment res = self._processAccessError( e ) self._endRequestSpecific2RH( False ) DBMgr.getInstance().endRequest(False)