I know what the problem is. Please open a ticket about this so I do not 
forget and I may fix it tonight.

This is a change in grid behavior and we do not promise backward 
compatibility in grid because it is "experimental".

Basically the we speeded up the grid but not generating the full Row(s) 
objects thus your row.routedetails is missing.

In any case it is debatable whether the changes that lead to this are worth 
it, considering the problem you mention. I will probably revert the old 
behavior.

massimo


On Tuesday, 2 October 2012 11:04:30 UTC-5, Nate Atkinson wrote:
>
> I seem to have run into a backwards compatibility issue.
>
> This weekend, I did some system upgrades. I moved my web2py (1.99.7) + 
> MySQL application off a single server running Ubuntu to two VM's running 
> Debian stable (one VM for web2py + apache, one for MySQL). Web2py was 
> deployed using the script in the deployment recipes book section (which 
> downloaded whatever version was current as of Oct 1). MySQL data was moved 
> using mysqldump.
>
> It seems that one-to-many relations are broken in the DAL.
>
> Example code snippets:
>
> From the model:
>
> ....
> gaia.define_table('routes',
>     Field("Name", required=True),
>     Field("Active", "boolean", required=True, default=True),
>     format='%(Name)s')
>
> gaia.define_table('routedetails',
>     Field('route', gaia.routes),
>     Field('site', gaia.sites),
>     Field('sortable', 'integer', default = 
> 0,writable=False,readable=False),
>     singular = 'RouteDetail', plural = 'RouteDetails')
> ....
>
>
> From the controller (making a link field for SQLForm.grid):
>
> ....
>     boxeslink = dict(
>                     header = 'Number of Boxes',
>                     body = lambda row: sum([x.site.NumBoxes for x in 
> row.routedetails.select()])
>                     )
> ....
>
>
> I should be able to access related routedetails rows from a routes row. I 
> can't. I get an exception telling me that the <Row> object doesn't have 
> that attribute.
>
>
> Sorry for the vague details-- I installed the new version, saw that it 
> didn't work, installed 1.99.7 and it worked perfectly again. I'll get a 
> 2.0.7 instance up and running later and can provide exact details.
>

-- 



Reply via email to