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

Opened 11 years ago

Last modified 11 years ago

PATCH: Kid crashes on 1.0.5

Reported by: mw44118 Owned by: anonymous
Priority: normal Milestone: 1.0.x bugfix
Component: TurboGears Version: 1.0.5
Severity: normal Keywords:


I just upgraded from 1.0.4 to 1.0.5 this morning. Every page I loaded triggers this traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/CherryPy-2.3.0-py2.5.egg/cherrypy/_cphttptools.py", line 121, in _run
  File "/usr/lib/python2.5/site-packages/CherryPy-2.3.0-py2.5.egg/cherrypy/_cphttptools.py", line 264, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in login
  File "/home/matt/virtualenvs/staffknex/lib/python2.5/site-packages/TurboGears-1.0.5-py2.5.egg/turbogears/controllers.py", line 359, in expose
    *args, **kw)
  File "<string>", line 5, in run_with_transaction
  File "/home/matt/virtualenvs/staffknex/lib/python2.5/site-packages/TurboGears-1.0.5-py2.5.egg/turbogears/database.py", line 358, in so_rwt
    retval = func(*args, **kw)
  File "<string>", line 5, in _expose
  File "/home/matt/virtualenvs/staffknex/lib/python2.5/site-packages/TurboGears-1.0.5-py2.5.egg/turbogears/controllers.py", line 372, in <lambda>
    mapping, fragment, args, kw)))
  File "/home/matt/virtualenvs/staffknex/lib/python2.5/site-packages/TurboGears-1.0.5-py2.5.egg/turbogears/controllers.py", line 414, in _execute_func
    return _process_output(output, template, format, content_type, mapping, fragment)
  File "/home/matt/virtualenvs/staffknex/lib/python2.5/site-packages/TurboGears-1.0.5-py2.5.egg/turbogears/controllers.py", line 87, in _process_output
  File "/home/matt/virtualenvs/staffknex/lib/python2.5/site-packages/TurboGears-1.0.5-py2.5.egg/turbogears/view/base.py", line 134, in render
    content_format = content_format.split()[0].split('-' , 1)[0]
AttributeError: 'HTMLSerializer' object has no attribute 'split'

It is the first split call on content_format.split() that crashes. The content_format variable is a kid HTMLSerializer instance, which doesn't have a split method.

The submitted patch isn't very sophisticated, but it does seem to stop this crash. I welcome some oversight from others.


my_patch.diff Download (709 bytes) - added by mw44118 11 years ago.

Change History

Changed 11 years ago by mw44118


comment:1 Changed 11 years ago by chrisz

Fixed in r4885 with a similar patch.

A better solution would also handle the cases where format is XTMLSerializer, XMLSerializer or PlainSerializer and derive the proper content type.

Solution 1: TurboKid (and other engines) could provide an auxiliary function for deriving a proper content type from the format parameter. (TurboJson had a similar function for deriving the content type from the user agent, but this is not used any more).

Solution 2: Or, this auxiliary function could be put into tg.util. We already have a similar function get_template_encoding_default(enginename) there.

comment:2 Changed 11 years ago by Chris Arndt

  • Milestone set to 1.0.x bugfix

comment:3 Changed 11 years ago by Chris Arndt

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

Since the original bug is fixed. I'm closing this ticket as fixed. I have opened a new ticket (#1971) for the future enhancement of the content type handling.

Note: See TracTickets for help on using tickets.