I did happen to find a solution to this problem and want to pass that
knowledge on.
On May 24, 8:19 am, Jonathan LaCour <[EMAIL PROTECTED]>
wrote:
> AZMelwrote:
> > If I pass the results object to my template then the paginate fails:
>
> > File "/usr/lib/python2.4/site-packages/TurboGears-1.0.2.2-py2.4.egg/
> > turbogears/paginate.py", line 89, in decorated
> > raise 'Variable is not a list or SelectResults'
> > Variable is not a list or SelectResults
>
> Unfortunately, I think that the SelectResults extension only works on
> "query" objects, and not arbitrary selects like I instructed you to use.
> So you are going to have to build a query object to do what you want,
> which is to fetch two different mapped objects in one query. The
> SQLAlchemy
> documentation provides some insight on how to do this (rather advanced)
> operation in its section on advanced data mapping:
>
By doing a fetchAll() I am able to pass the results to my List
template and paginate works as it should.
It looks like this:
recs = select(
[ SubDivision.c.SubDivision_id,
SubDivision.c.Name,
SubDivision.c.DisplayOrder,
Division.c.Division_id,
Division.c.Name
], SubDivision.c.Division_id==Division.c.Division_id,
use_labels=True,
order_by=[Division.c.Division_id,SubDivision.c.DisplayOrder]).execute()
records = recs.fetchall()
return dict(records = records,
results = results,
modelname=self.modelname,
tg_paginate_limit=tg_paginate_limit,
tg_paginate_no=tg_paginate_no,
rootDir=self.rootDir)
Thanks again to all who helped originally.
Mel
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---