[Python-checkins] r85167 - in tracker/instances/python-dev/rietveld: roundup_helper/middleware.py settings.py

martin.v.loewis python-checkins at python.org
Sat Oct 2 11:41:00 CEST 2010


Author: martin.v.loewis
Date: Sat Oct  2 11:40:59 2010
New Revision: 85167

Log:
Fetch cookie name from config.ini.


Modified:
   tracker/instances/python-dev/rietveld/   (props changed)
   tracker/instances/python-dev/rietveld/roundup_helper/middleware.py
   tracker/instances/python-dev/rietveld/settings.py

Modified: tracker/instances/python-dev/rietveld/roundup_helper/middleware.py
==============================================================================
--- tracker/instances/python-dev/rietveld/roundup_helper/middleware.py	(original)
+++ tracker/instances/python-dev/rietveld/roundup_helper/middleware.py	Sat Oct  2 11:40:59 2010
@@ -1,5 +1,6 @@
 from models import Session, User
 from codereview.models import Account
+from django.conf import settings
 from django.contrib import auth
 from django.contrib.auth.backends import RemoteUserBackend
 
@@ -11,7 +12,7 @@
 class LookupRoundupUser(object):
 
     def process_request(self, request):
-        session_key = request.COOKIES.get('roundup_session_Tracker', None)
+        session_key = request.COOKIES.get(settings.TRACKER_COOKIE_NAME, None)
         if not session_key:
             self.logout(request)
             return

Modified: tracker/instances/python-dev/rietveld/settings.py
==============================================================================
--- tracker/instances/python-dev/rietveld/settings.py	(original)
+++ tracker/instances/python-dev/rietveld/settings.py	Sat Oct  2 11:40:59 2010
@@ -2,7 +2,7 @@
 
 # NOTE: Keep the settings.py in examples directories in sync with this one!
 
-import os, ConfigParser
+import os, ConfigParser, re
 
 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
@@ -15,6 +15,7 @@
 
 _c = ConfigParser.ConfigParser({'password':'', 'port':''})
 _c.read(os.path.dirname(__file__)+"/../config.ini")
+TRACKER_COOKIE_NAME=re.sub('[^a-zA-Z]', '', _c.get('tracker','name'))
 
 DATABASE_ENGINE = 'postgresql_psycopg2'
 DATABASE_NAME = _c.get('rdbms', 'name')


More information about the Python-checkins mailing list