I'm using the restful pattern with my web2py app today, and I find it to be 
a very powerful concept.  I think I'm having a conceptual difficulty, tho, 
with the different levels at which web2py helpers operate to make my life 
easier.

In one specific case, I have a swimmer record that, along with other 
fields, contains the id of the club the swimmer belongs to (id_club).  When 
obtaining records via REST, I would prefer to see the default 
representation for the club, a 6-character string unique to that club.  But 
the restful helpers in web2py return only the simplest underlying data, 
with no processing of "represents". 

Should I add fields to the table to save the club name and id separately? 
 That seems like a recipe for inconsistent tables.  Should I use some sort 
of virtual or computed Field to add the name of the club to the table? 
 (Would virtuals even work with restful apis?)  Or should I just return the 
id and write the javascript needed to call another rest api to get the name 
of the club from its id?

This is a philosophical question because I have dozens of tables and views 
I need to do.  I need to work *with* the philosophy of web2py and not swim 
against it.  So what would be the path with lowest resistance to having a 
restful api that returns the table row of a swimmer with id's like 
"id_club" translated into more human-readable versions?

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to