1.0.5 doesn't play nice with Kid?

View: New views
5 Messages — Rating Filter:   Alert me  

1.0.5 doesn't play nice with Kid?

by Matt Wilson-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


I just submitted a patch to fix a problem I found after upgrading to
1.0.5:

http://trac.turbogears.org/ticket/1878

It's very possible that I'm doing something wrong in my setup.

But as soon as I tried to hit any page after upgrading, I got 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
    self.main()
  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
    fragment=fragment)
  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'

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group.
To post to this group, send email to turbogears-trunk@...
To unsubscribe from this group, send email to turbogears-trunk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: 1.0.5 doesn't play nice with Kid?

by Florent Aide :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Thu, Jul 3, 2008 at 9:20 PM, Matt Wilson <mw44118@...> wrote:
>
> I just submitted a patch to fix a problem I found after upgrading to
> 1.0.5:
>
> http://trac.turbogears.org/ticket/1878
>
> It's very possible that I'm doing something wrong in my setup.

maybe your config files because I run 1.0.5 with kid on some instances
without problem. I'll look into this tomorrow if Christoph Zwerschke
does not answer that thread with a solution by then :)

Florent.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group.
To post to this group, send email to turbogears-trunk@...
To unsubscribe from this group, send email to turbogears-trunk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: 1.0.5 doesn't play nice with Kid?

by Christoph Zwerschke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Matt Wilson schrieb:
>     content_format = content_format.split()[0].split('-' , 1)[0]
> AttributeError: 'HTMLSerializer' object has no attribute 'split'

The problem seems to be that you set your kid.format not to as 'html'
but as a HTMLSerializer object, which is actually possible, but the
problem is that TG 1.0.5 tries to derive the content type from the
format and fails here if the format is not a string.

Workarounds:
1) Use a string instead of the HTMLSerializer, e.g.
    'html' instead of HTMLSerializer(doctype='html') or
    'html-quirks' instead of HTMLSerializer(doctype='html-quirks')
2) Explicitly set the content_type in the expose decorator,
    so the content type doesn't need to be derived from the format
3) Apply the patch in r4885.

A better solution than patch r4885 would also handle the cases where
format is XTMLSerializer, XMLSerializer or PlainSerializer and derive
the proper content type. Maybe TurboKid (and other engines) should
provide an auxiliary function for deriving a proper content type from
the format parameter? (TurboJson provided a similar function for
deriving the content type from the user agent).

-- Christoph


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group.
To post to this group, send email to turbogears-trunk@...
To unsubscribe from this group, send email to turbogears-trunk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: 1.0.5 doesn't play nice with Kid?

by Matt Wilson-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Jul 3, 6:44 pm, Christoph Zwerschke <c...@...> wrote:
> Matt Wilson schrieb:
>
> >     content_format = content_format.split()[0].split('-' , 1)[0]
> > AttributeError: 'HTMLSerializer' object has no attribute 'split'
>
> The problem seems to be that you set your kid.format not to as 'html'
> but as a HTMLSerializer object, which is actually possible, but the
> problem is that TG 1.0.5 tries to derive the content type from the
> format and fails here if the format is not a string.

I have no idea how I did that.  My app.cfg is from a TG project I
started a year ago.  Maybe the cfg files changed since then?

I found this in my app.cfg:
# The commented out values below are the defaults
<snip>
# One of (html|xml|json)
# kid.outputformat="html"

I've tried running my app after removing the comment in front of
kid.outputformat = "html" and I've also added a line kid.format =
"html" and still got the error.

How do I set my kid.format?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group.
To post to this group, send email to turbogears-trunk@...
To unsubscribe from this group, send email to turbogears-trunk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---


Re: 1.0.5 doesn't play nice with Kid?

by Christoph Zwerschke :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Matt Wilson schrieb:
> I've tried running my app after removing the comment in front of
> kid.outputformat = "html" and I've also added a line kid.format =
> "html" and still got the error.
>
> How do I set my kid.format?

kid.format is the default format, but you can overwrite it in the expose
decorator. Probably you have done this in one of your controllers.

-- Christoph

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "TurboGears Trunk" group.
To post to this group, send email to turbogears-trunk@...
To unsubscribe from this group, send email to turbogears-trunk-unsubscribe@...
For more options, visit this group at http://groups.google.com/group/turbogears-trunk?hl=en
-~----------~----~----~----~------~----~------~--~---

LightInTheBox - Buy quality products at wholesale price