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