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 #423 (closed defect: duplicate)

Opened 13 years ago

Last modified 12 years ago

request.app_path is not always set

Reported by: kevin Owned by: anonymous
Priority: normal Milestone: 0.9
Component: CherryPy Version:
Severity: normal Keywords:
Cc:

Description

From Rick Richardson:

When I call turbogears.url() I get this error, basically cherrypy has
not yet placed the app_path in the request object. I put a trace in the
function that sets the app_path and it does seem to call successfully
on its own. I'm not sure if it's a different request object that it is
trying to reference or what.


Page handler: <bound method Reseller.Configuration of
<eltopiacomm.reseller.Reseller instance at 0x01253E18>>
Traceback (most recent call last):
 File
"d:\python24\lib\site-packages\CherryPy-2.2.0beta-py2.4.egg\cherrypy\_cphttptools.py",
line 98, in _run
   self.main()
 File
"d:\python24\lib\site-packages\CherryPy-2.2.0beta-py2.4.egg\cherrypy\_cphttptools.py",
line 246, in main
   body = page_handler(*virtual_path, **self.params)
 File
"d:\python24\lib\site-packages\turbogears-0.9a0dev_r519-py2.4.egg\turbogears\controllers.py",
line 240, in newfunc
   html, fragment, *args, **kw)
 File
"d:\python24\lib\site-packages\turbogears-0.9a0dev_r519-py2.4.egg\turbogears\database.py",
line 189, in run_with_transaction
   retval = func(*args, **kw)
 File
"d:\python24\lib\site-packages\turbogears-0.9a0dev_r519-py2.4.egg\turbogears\controllers.py",
line 257, in _execute_func
   output = func(self, *args, **kw)
 File
"d:\python24\lib\site-packages\turbogears-0.9a0dev_r519-py2.4.egg\turbogears\identity\conditions.py",
line 230, in _wrapper
   return fn( self, *args, **kwargs )
 File "D:\devstuff\EltopiaComm\eltopiacomm\reseller.py", line 48, in
Configuration
   self.cpnydict, self.condict, self.voipdict =
createConfigDicts(oper)
 File "D:\devstuff\EltopiaComm\eltopiacomm\reseller_content.py", line
41, in createConfigDicts

constraintUrl=turbogears.url('/modCountry?countryID=##+tg_format=json')),
 File
"d:\python24\lib\site-packages\turbogears-0.9a0dev_r519-py2.4.egg\turbogears\util.py",
line 87, in url
   if cherrypy.request.app_path != "/":
 File
"d:\python24\lib\site-packages\CherryPy-2.2.0beta-py2.4.egg\cherrypy\__init__.py",
line 42, in __getattr__
   return getattr(childobject, name)
AttributeError: 'Request' object has no attribute 'app_path'

Attachments

tg_bug_443_patch.patch Download (578 bytes) - added by krys@… 13 years ago.
Patch to make the problem go away.

Change History

comment:1 Changed 13 years ago by krys@…

I've been bitten by this one too.

After a lot of searching in cherrypy and turbogears, I cannot find any other reference to app_path. Are you sure that is the right variable name?

Closest thing I can find would be turbogears.startup.webpath, but the url function already uses it.

I am submitting a small patch (calid against turbogears reversion 589) which makes the problem go away, but I do not know if it is the *best* solution.

Anyway, hope it helps.

Krys

Changed 13 years ago by krys@…

Patch to make the problem go away.

comment:2 Changed 13 years ago by krys@…

Oops, wrong ticket number in the patch file name. The patch is good though.

comment:3 Changed 13 years ago by krys@…

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

This was also reported on #466 and seems to be fixed in revision r599.

Note: See TracTickets for help on using tickets.