David, I can't figure out why you're returning dict(cherrypy.session).
dict() is a construct you can use with python 2.3 and above to create a
dictionary.

You're supposed to use it like this:
return dict(name="David", occupation="Web Developer")

Or if you have a dict you want to include you can do this:
info = {'name': "David", 'occupation': "Web Developer"}
return dict(**info)

cherrypy.session is a class, so I don't think it makes sense to pass it
into the dict() builtin.

Perhaps I'm missing something here?
-ian

On Dec 4, 2:12 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hello again TG saints,
>
> I've got a root method (actually, several) that apparently aren't
> playing well with Kid, though I'm not sure where the error is coming
> from.  Any insight would be much appreciated.
>
> Traceback (most recent call last):
>   File
> "e:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy\_cphttptools.py",
> line 105, in _run
>     self.main()
>   File
> "e:\python24\lib\site-packages\CherryPy-2.2.1-py2.4.egg\cherrypy\_cphttptools.py",
> line 254, in main
>     body = page_handler(*virtual_path, **self.params)
>   File "<string>", line 3, in sr
>   File
> "e:\python24\lib\site-packages\TurboGears-1.0b1-py2.4.egg\turbogears\controllers.py",
> line 326, in expose
>     output = database.run_with_transaction(
> <snip TG-specific traceback>
>   File "e:\python24\lib\site-packages\kid-0.9.3-py2.4.egg\kid\pull.py",
> line 210, in _coalesce
>     for ev, item in stream:
>   File "E:\Documents and
> Settings\David\Desktop\trendi\trendi\templates\main.py", line 1587, in
> _match_func
>   File
> "e:\python24\lib\site-packages\TurboGears-1.0b1-py2.4.egg\turbogears\util.py",
> line 316, in __getattr__
>     raise AttributeError
> AttributeError: <bound method Root.sr of <trendi.controllers.Root
> object at 0x016DCBB0>>
>
> This occurs with even the most basic templated methods like (in class
> Root):
>
>     @expose('trendi.templates.main')
>     def sr(self, *args, **kw):
>         return dict(cherrypy.session)
>
> This occurs with a few methods in Root, but not all.  I confirmed that
> the code is fine until it runs through the template by changing the
> @expose directive to merely @expose() and I get a plan-text dict in the
> browser, as expected.  However, I'm not sure what sort of template
> error this is, and the line number in the traceback is of no obvious
> use: main.kid is only 773 lines long (so the line number's coming from
> the generated phantom main.py template).
>
> I'm stumped, and thought I might ask the group.  Any hints, guidance,
> etc. would be much appreciated.
> 
> Thanks,
> 
> David


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

Reply via email to