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 #257 (closed enhancement: wontfix)

Opened 14 years ago

Last modified 12 years ago

Keep reference to cherrypy.request in controllers

Reported by: jpellerin@… Owned by: anonymous
Priority: normal Milestone: 1.5
Component: TurboGears Version:
Severity: normal Keywords: controller

Description (last modified by jorge.vargas) (diff)

Controllers (at least those descending from turbogears.controllers.Controller) ought to have a local handle on the current request, for the sake of easier isolated testing and keeping objects near where they are used. This can be done with a 1-line patch to http://trac.turbogears.org/turbogears/browser/trunk/turbogears/controllers.py?rev=363#L262 (as of [363]). Replace what's there ('pass') with:

request = cherrypy.request

Change History

comment:1 Changed 13 years ago by fredlin

is this still valid?

comment:2 Changed 13 years ago by jorge.vargas

  • Description modified (diff)
  • Milestone set to 1.0

do we need this?

comment:3 Changed 13 years ago by alberto

  • Milestone changed from 1.0 to 1.1

comment:4 Changed 13 years ago by alberto

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

I don't see why this is needed. cherrypy.request is a thread-safe global that's shared amongs all controllers (in fact, every single place in your TG app) so a reference to it in inside a controller does not provide any significant advantage IMHO and might even be confusing as it implies it's related only related to the request the controller is handling.

I'll close this as wontfix unless convinced it's useful ;)


Note: See TracTickets for help on using tickets.