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 #879 (closed defect: fixed)

Opened 13 years ago

Last modified 10 years ago

Incorrect handling when serveFile returns []

Reported by: anonymous Owned by: anonymous
Priority: normal Milestone: 1.0b1
Component: TurboGears Version: 0.9a6
Severity: normal Keywords:


When CP's serveFile detects that a file has not been modified, it returns a [] instead of generator. This causes the assertion in trunk/turbogears/controllers.py (_execute_func()) to fail, when instead TG should return a 304 response to the browser.

Related ticket: #686

Reference:  http://groups.google.com/group/turbogears/browse_frm/thread/0f3ce472c8786ed6/25adf0a9708dbcfd#25adf0a9708dbcfd


serveFile.patch Download (646 bytes) - added by fforw 13 years ago.
patch to solve #879

Change History

comment:1 Changed 13 years ago by arnarbi@…

Sorry, forgot to add my email.

comment:2 Changed 13 years ago by arnarbi@…

Here's a workaround until this is fixed:

Just before calling serveFile, add this line

del cherrypy.request.headers['If-Modified-Since']

comment:3 Changed 13 years ago by arnarbi@…

  • Milestone set to 1.0b1

Changed 13 years ago by fforw

patch to solve #879

comment:4 Changed 13 years ago by fforw

There is a simple solution to this, and I think it should work in all cases, but I am not sure. It involves checking for the return value to be a list and just return it instead of going through the normal TG handling.

comment:5 Changed 13 years ago by elvelind

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

commited in 1715.

comment:6 Changed 10 years ago by chrisz

Reverted in r6141 since CherryPy? >=2.3 does not show this behavior any more. Instead, lists are treated the same way as generators now.

Note: See TracTickets for help on using tickets.