On Thu, Jun 11, 2009 at 7:35 AM, AlienBaby<[email protected]> wrote:
>
> Hi,  I'm new to working with Turbogears2 and I have a problem
> accessing values from a dict in a template.
>
> This code gets executed in the root controller to query the DB and
> pass a couple of dictionaries back, exposed to a particular template.
>
> The query / returned data that is causing the problem comes from this
> table definition in the model;
>
> This table is queried in the controller with the following code;
>
>   �...@expose('browseeve.templates.ShowAllianceList')
>    def ShowAllianceList(self):
>        alinfo=DBSession.query(alliances)
>        XCinfo={};
>        for al in alinfo:
>            XC=DBSession.query(corporations).filter_by
> (corporationID=al.executorCorpID)
>            XCinfo[al.allianceID]=XC
>        """Display alliance table."""
>        return dict(alinfo=alinfo, XCinfo=XCinfo)
>
you aren't returning the "list" or "object" but a query that will get
them for you. XC is a "query" object that is ready to be executed but
it's not the result. you need to call one() on it.

> The alinfo dict is accessible in the following template no problem,
> but I have problems with XCinfo;
>
> In its current form, that template extract builds output lines similar
> to;
>
> GoonSwarm        OHGOD           824518128
> <browseeve.model.corporations.corporations object at 0x06109150>
> 5251     1149295800
>
ahhh I miss eve :( I wish I had the time to play that. I cancel my
subscription after I realized all I did was log in to change skills
and chat with the corp. At least I left BC 5 training ;)

>
> AlienBaby.
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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