Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #373 (closed defect: fixed)

Opened 13 years ago

Last modified 12 years ago

"visit.on = False" configuration not honored

Reported by: mscott@… Owned by: anonymous
Priority: normal Milestone:
Component: Identity Version:
Severity: normal Keywords:
Cc:

Description

When "visit.on" is set to False in dev.cfg, TurboGears still tries to add the VisitFilter? to the CherryPy? filters list.

Here is a patch that makes turbogears.startup honor this. (It also corrects a tab character used for indentation).

Index: turbogears/startup.py
===================================================================
--- turbogears/startup.py       (revision 40497)
+++ turbogears/startup.py       (working copy)
@@ -110,10 +110,10 @@
     from turbogears import visit, database
     if hasattr(cherrypy, "root"):
         if not hasattr(cherrypy.root, "_cpFilterList"):
-               cherrypy.root._cpFilterList= []
-        cherrypy.root._cpFilterList.extend(
-         [visit.VisitFilter(),
-         database.EndTransactionsFilter() ] )
+            cherrypy.root._cpFilterList= []
+        if cherrypy.config.get('visit.on', True):
+            cherrypy.root._cpFilterList.append(visit.VisitFilter())
+        cherrypy.root._cpFilterList.append(database.EndTransactionsFilter())

     global webpath
     webpath = cherrypy.config.get("server.webpath", "")

Change History

comment:1 Changed 13 years ago by anonymous

This is in HEAD of tg's trunk, btw.

comment:2 Changed 13 years ago by Jeff Watkins

This precludes visit tracking from being enabled for paths below the root because it is evaluated in the global space.

The config check *MUST* occur during the request processing.

The filter should check whether it's enabled on a per request basis and do its magic only when enabled.

comment:3 Changed 13 years ago by Jeff Watkins

  • Status changed from new to closed
  • Resolution set to fixed

In light of Kevin's request, Identity and Visit Tracking both check the global config to determine whether they should be enabled.

So basically, your patch was sort of applied...

Note: See TracTickets for help on using tickets.