On 26 Feb 2013, at 8:44 AM, [email protected] wrote:
> Thanks, I must have missed that.
> 
> Although I'm still a bit confused. The last framework I played with used 
> regex to determine the URL, so I could do something like:
> 
> welcome/default/products/(\d{2})     # shows overall product page for given 
> product primary id
> welcome/default/products/(\d{2})/description   # shows product description 
> for given product primary id
> welcome/default/products/(\d{2})/comments   # shows product comments for 
> given product primary id
> welcome/default/products/(\d{2})/comments/(\d{2})   # shows specific comment 
> for a specific product given comment id and product id
> 
> and each one of those would map to some function which would return the 
> corresponding webpage.
> 
> I noticed that the access control does almost exactly that:
> 
> http://.../[app]/default/user/register
> http://.../[app]/default/user/login
> http://.../[app]/default/user/logout
> http://.../[app]/default/user/profile
> 
> where everything falls under "/default/user/*" and I can define functions in 
> the controller to customize those pages (ie, "def register()" for 
> "/default/user/*").

Actually, not. 'register' and the others end up in request.args[0], and are 
dynamically processed in gluon.tools.Auth.__call__

In your example, the function default/product would find the product id in 
request.args[0] (or request.args(0)), 'description' or 'comments' in 
request.args[1], and the comment id in request.args[2].

> 
> I don't see this handled in routes.example.py or router.example.py, so I'm 
> confused how to handle this url dynamism. Especially in the case where I have 
> to handle multiple ids in a url (like in the comment id +product id url).
> 
> Could you please explain in a bit more detail? Thanks!
> 
> On Monday, February 25, 2013 5:48:08 PM UTC-5, Anthony wrote:
> Everything after the function name in the URL can be found in request.args.
> 
> 


-- 

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


Reply via email to