simplify parse_as_rest pattern?

57 views
Skip to first unread message

chuan137

unread,
Jul 21, 2014, 5:02:57 PM7/21/14
to web...@googlegroups.com
Example of parse_as_rest function, there define tables

db.define_table('person',Field('name'),Field('info'))
db
.define_table('pet',Field('ownedby',db.person),Field('name'),Field('info'))

which are served with the pattern

 "/{person.name}/pets[pet.ownedby]/{pet.name}".


That means a valid URL is for instance
/Tom/pets/BlackCat 

Is it possible to simplify the pattern, so that
/Tom/BlackCat
is also valid?

I am aware that url routing does the trick, but I just wonder if there is a more direct way to set up the pattern?

Thanks

Massimo Di Pierro

unread,
Jul 22, 2014, 2:40:28 AM7/22/14
to web...@googlegroups.com
currently no.

chuan137

unread,
Jul 22, 2014, 8:43:08 AM7/22/14
to web...@googlegroups.com
Maybe you want to expand the functionality for parse_as_rest(),  since from the menu, there reads "experimental feature". I would be interesting to get involved in the discussions.

Massimo Di Pierro

unread,
Jul 23, 2014, 5:20:41 AM7/23/14
to web...@googlegroups.com
Actually I wanted to deprecate it in favor of the new hypermedia API.

chuan137

unread,
Jul 23, 2014, 10:07:04 AM7/23/14
to web...@googlegroups.com
Aha, I was not followed it yet.

Quick question, would it be able to filter one-to-many or many-to-many relationship?
Reply all
Reply to author
Forward
0 new messages