changeset 5414:b0c8c2f225f3

Changed default of cfg.cookie_name to use some URL components to make up some name. This was the previous named 'urlmagic' (cs 5408:4226fde63931). If you want to set the cfg.siteid as name for the cookie set cfg.cookie_name = "siteidmagic". If name is not None (and not 'siteidmagic'), we just use the given name.
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Sun, 10 Jan 2010 13:12:26 +0100
parents b19f3bd50324
children f483516b49c0
files MoinMoin/config/multiconfig.py MoinMoin/web/session.py
diffstat 2 files changed, 10 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/config/multiconfig.py	Sun Jan 10 13:40:35 2010 +0300
+++ b/MoinMoin/config/multiconfig.py	Sun Jan 10 13:12:26 2010 +0100
@@ -718,7 +718,7 @@
     ('session_service', DefaultExpression('web.session.FileSessionService()'),
      "The session service."),
     ('cookie_name', None,
-     'The variable part of the session cookie name. (None = use siteid, "urlmagic" = determine from URL, any other string = use that)'),
+     'The variable part of the session cookie name. (None = determine from URL, siteidmagic = use siteid, any other string = use that)'),
     ('cookie_secure', None,
      'Use secure cookie. (None = auto-enable secure cookie for https, True = ever use secure cookie, False = never use secure cookie).'),
     ('cookie_httponly', False,
--- a/MoinMoin/web/session.py	Sun Jan 10 13:40:35 2010 +0300
+++ b/MoinMoin/web/session.py	Sun Jan 10 13:12:26 2010 +0100
@@ -75,25 +75,24 @@
     Instead of using the cookie path, we use differently named cookies, so we get
     the right cookie no matter at what URL the wiki currently is "mounted".
 
-    If name is None, we just use cfg.siteid, which is unique within a wiki farm
+    If name is None, we use some URL components to make up some name.
+    For example the cookie name for the default desktop wiki: MOIN_SESSION_8080_ROOT
+
+    If name is siteidmagic, we just use cfg.siteid, which is unique within a wiki farm
     created by a single farmconfig. If you only run ONE(!) wikiconfig wiki, it
     is also unique, of course, but not if you run multiple wikiconfig wikis under
     same domain.
 
-    If name is not None (and not 'urlmagic'), we just use the given name (you
+    If name is not None (and not 'siteidmagic'), we just use the given name (you
     want to use that to share stuff between several wikis - just give same name
     and it will use the same cookie. same thing if you don't want to share, just
-    give a different name then [e.g. if cfg.siteid or 'urlmagic' doesn't work
+    give a different name then [e.g. if cfg.siteid or 'siteidmagic' doesn't work
     for you]).
 
-    If name is 'urlmagic', we use some URL components to make up some name.
     Moving a wiki to a different URL will break all sessions. Exchanging URLs
     of wikis might lead to confusion (requiring the client to purge the cookies).
     """
     if name is None:
-        name = request.cfg.siteid  # == config name, unique per farm
-
-    elif name == 'urlmagic':
         url_components = [
             # cookies do not store the port, thus we add it to the cookie name:
             request.environ['SERVER_PORT'],
@@ -102,6 +101,9 @@
         ]
         name = '_'.join(url_components)
 
+    elif name is 'siteidmagic':
+        name = request.cfg.siteid  # == config name, unique per farm
+
     return "%s_%s_%s" % (software, usage, name)