web/application.py
branchstable
changeset 5865 af414723598d
parent 5721 3a9cd70bcfdc
child 5868 c4380d8cfc25
equal deleted inserted replaced
5864:9b7c11e80d20 5865:af414723598d
   372         # don't log form values they may contains sensitive information
   372         # don't log form values they may contains sensitive information
   373         self.info('publish "%s" (form params: %s)', path, req.form.keys())
   373         self.info('publish "%s" (form params: %s)', path, req.form.keys())
   374         # remove user callbacks on a new request (except for json controllers
   374         # remove user callbacks on a new request (except for json controllers
   375         # to avoid callbacks being unregistered before they could be called)
   375         # to avoid callbacks being unregistered before they could be called)
   376         tstart = clock()
   376         tstart = clock()
       
   377         commited = False
   377         try:
   378         try:
   378             try:
   379             try:
   379                 ctrlid, rset = self.url_resolver.process(req, path)
   380                 ctrlid, rset = self.url_resolver.process(req, path)
   380                 try:
   381                 try:
   381                     controller = self.vreg['controllers'].select(ctrlid, req,
   382                     controller = self.vreg['controllers'].select(ctrlid, req,
   389                 if req.cnx:
   390                 if req.cnx:
   390                     # no req.cnx if anonymous aren't allowed and we are
   391                     # no req.cnx if anonymous aren't allowed and we are
   391                     # displaying some anonymous enabled view such as the cookie
   392                     # displaying some anonymous enabled view such as the cookie
   392                     # authentication form
   393                     # authentication form
   393                     req.cnx.commit()
   394                     req.cnx.commit()
       
   395                     commited = True
   394             except (StatusResponse, DirectResponse):
   396             except (StatusResponse, DirectResponse):
   395                 if req.cnx:
   397                 if req.cnx:
   396                     req.cnx.commit()
   398                     req.cnx.commit()
   397                 raise
   399                 raise
   398             except (AuthenticationError, LogOut):
   400             except (AuthenticationError, LogOut):
   432                 self.error_handler(req, ex, tb=True)
   434                 self.error_handler(req, ex, tb=True)
   433             except:
   435             except:
   434                 self.critical('Catch all triggered!!!')
   436                 self.critical('Catch all triggered!!!')
   435                 self.exception('this is what happened')
   437                 self.exception('this is what happened')
   436         finally:
   438         finally:
   437             if req.cnx:
   439             if req.cnx and not commited:
   438                 try:
   440                 try:
   439                     req.cnx.rollback()
   441                     req.cnx.rollback()
   440                 except:
   442                 except:
   441                     pass # ignore rollback error at this point
   443                     pass # ignore rollback error at this point
   442         self.info('query %s executed in %s sec', req.relative_path(), clock() - tstart)
   444         self.info('query %s executed in %s sec', req.relative_path(), clock() - tstart)