web/views/basecontrollers.py
changeset 4914 dcb055f32d9b
parent 4913 083b4d454192
parent 4911 898c35be5873
child 4984 6cb91be7707f
--- a/web/views/basecontrollers.py	Mon Mar 01 11:26:14 2010 +0100
+++ b/web/views/basecontrollers.py	Tue Mar 16 16:32:36 2010 +0100
@@ -83,8 +83,19 @@
 
     def publish(self, rset=None):
         """logout from the instance"""
-        return self.appli.session_handler.logout(self._cw)
+        return self.appli.session_handler.logout(self._cw, self.goto_url())
 
+    def goto_url(self):
+        # * in http auth mode, url will be ignored
+        # * in cookie mode redirecting to the index view is enough : either
+        #   anonymous connection is allowed and the page will be displayed or
+        #   we'll be redirected to the login form
+        msg = self._cw._('you have been logged out')
+        if self._cw.https:
+            # XXX hack to generate an url on the http version of the site
+            self._cw._base_url =  self._cw.vreg.config['base-url']
+            self._cw.https = False
+        return self._cw.build_url('view', vid='index', __message=msg)
 
 class ViewController(Controller):
     """standard entry point :