This isn't exactly the solution you're looking for, in that it may not work
for 1.99 (I no longer have that version running), but I have the same
problem.
As far as I can tell (broken apps), this code created buttons at the bottom
of a form to access child records.
example:
original coding for (in my case) vehicle_read.html accessing table
t_vehicle:
{{=form}}
{{for t,f in db.t_vehicle._referenced_by:}}{{if not
t[-8:]=='_archive':}}[{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f,form.record.id)))}}]{{pass}}{{pass}}
revised coding:
{{=form}}
{{for f in db.t_vehicle._referenced_by:}}{{t=f.tablename}}{{if not
t[-8:]=='_archive':}}[{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f.name,form.record.id)))}}]{{pass}}{{pass}}
substituions:
*for t,f in* becomes *for f in*
*_referenced_by:}}* becomes *_referenced_by:}}{{t=f.tablename}}*
*args=(f,* becomes *args=(f.name,*
*
*
*try:*
{{for f in db.t_sys_config._referenced_by:}}{{t=f.tablename}}{{if not
t[-8:]=='_archive':}}[{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f.name,
form.record.id)))}}]{{pass}}{{pass}}
Alternatively, if the buttons/link_urls are not required, the {{for t,f
..... pass}}{{pass}} stanza could just be removed. This would be more
efficient in any event for leaf tables which have no children.
..Keith
On Wednesday, May 1, 2013 6:37:29 PM UTC-3, Michael Ellis wrote:
>
> I've got an app from before 2.0 with wizard-generated code in multiple
> views that looks similar to this.
>
> {{=form}}
> {{for t,f in db.t_sys_config._referenced_by:}}{{if not
> t[-8:]=='_archive':}}[{{=A(t[2:],_href=URL('%s_select'%t[2:],args=(f,
> form.record.id)))}}]{{pass}}{{pass}}
>
> Under web2py 2.4.6, the for loop throws a ticket because *_referenced_by*is
> returning a list of Field objects instead of tuples. The app is running
> in almost 100 different servers on 1.99. How can I modify the app code
> (without doing something kludgey like detecting web2py versions) so it will
> run under any web2py version?
>
> Thanks,
> Mike
>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.