cubicweb/pyramid/bwcompat.py
changeset 12741 90348f847b4b
parent 12355 c703dc95c82e
child 12764 fb97669efcaa
equal deleted inserted replaced
12740:6e98699d3a9a 12741:90348f847b4b
    19 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    19 # with CubicWeb.  If not, see <http://www.gnu.org/licenses/>.
    20 
    20 
    21 """Backward compatibility layer for CubicWeb to run as a Pyramid application."""
    21 """Backward compatibility layer for CubicWeb to run as a Pyramid application."""
    22 
    22 
    23 import sys
    23 import sys
       
    24 import inspect
    24 import logging
    25 import logging
    25 
    26 
    26 from pyramid import security
    27 from pyramid import security
    27 from pyramid import tweens
    28 from pyramid import tweens
    28 from pyramid.httpexceptions import HTTPSeeOther
    29 from pyramid.httpexceptions import HTTPSeeOther
    86                                                                    req.path)
    87                                                                    req.path)
    87 
    88 
    88                     try:
    89                     try:
    89                         controller = vreg['controllers'].select(
    90                         controller = vreg['controllers'].select(
    90                             ctrlid, req, appli=self.appli)
    91                             ctrlid, req, appli=self.appli)
       
    92                         log.info("REQUEST [%s] '%s' selected controller %s at %s:%s",
       
    93                                  ctrlid, req.path, controller,
       
    94                                  inspect.getsourcefile(controller.__class__),
       
    95                                  inspect.getsourcelines(controller.__class__)[1])
    91                     except cubicweb.NoSelectableObject:
    96                     except cubicweb.NoSelectableObject:
       
    97                         log.warn("WARNING '%s' unauthorized request", req.path)
    92                         raise httpexceptions.HTTPUnauthorized(
    98                         raise httpexceptions.HTTPUnauthorized(
    93                             req._('not authorized'))
    99                             req._('not authorized'))
    94 
   100 
    95                     req.update_search_state()
   101                     req.update_search_state()
    96                     content = controller.publish(rset=rset)
   102                     content = controller.publish(rset=rset)