web/application.py
changeset 2476 1294a6bdf3bf
parent 2293 7ded2a1416e4
child 2613 5e19c2bb370e
equal deleted inserted replaced
2475:b6753521129d 2476:1294a6bdf3bf
   199         if path == 'login':
   199         if path == 'login':
   200             path = 'view'
   200             path = 'view'
   201         raise Redirect(req.build_url(path, **args))
   201         raise Redirect(req.build_url(path, **args))
   202 
   202 
   203     def logout(self, req):
   203     def logout(self, req):
   204         """logout from the application by cleaning the session and raising
   204         """logout from the instance by cleaning the session and raising
   205         `AuthenticationError`
   205         `AuthenticationError`
   206         """
   206         """
   207         self.session_manager.close_session(req.cnx)
   207         self.session_manager.close_session(req.cnx)
   208         req.remove_cookie(req.get_cookie(), self.SESSION_VAR)
   208         req.remove_cookie(req.get_cookie(), self.SESSION_VAR)
   209         raise AuthenticationError()
   209         raise AuthenticationError()
   216 
   216 
   217     def __init__(self, config, debug=None,
   217     def __init__(self, config, debug=None,
   218                  session_handler_fact=CookieSessionHandler,
   218                  session_handler_fact=CookieSessionHandler,
   219                  vreg=None):
   219                  vreg=None):
   220         super(CubicWebPublisher, self).__init__()
   220         super(CubicWebPublisher, self).__init__()
   221         # connect to the repository and get application's schema
   221         # connect to the repository and get instance's schema
   222         if vreg is None:
   222         if vreg is None:
   223             vreg = cwvreg.CubicWebRegistry(config, debug=debug)
   223             vreg = cwvreg.CubicWebRegistry(config, debug=debug)
   224         self.vreg = vreg
   224         self.vreg = vreg
   225         self.info('starting web application from %s', config.apphome)
   225         self.info('starting web instance from %s', config.apphome)
   226         self.repo = config.repository(vreg)
   226         self.repo = config.repository(vreg)
   227         if not vreg.initialized:
   227         if not vreg.initialized:
   228             self.config.init_cubes(self.repo.get_cubes())
   228             self.config.init_cubes(self.repo.get_cubes())
   229             vreg.init_properties(self.repo.properties())
   229             vreg.init_properties(self.repo.properties())
   230         vreg.set_schema(self.repo.get_schema())
   230         vreg.set_schema(self.repo.get_schema())