I am learning web2py and very new to Python, so I could be wrong or I
am not yet understand Massimo Di Pierro's principles, just some
opinions for discuss.
Looks like the URL rules /[applicaiton]/[controller]/[function] is
hard coded, I saw the code in main.py (lines near 140) :
request.application=items[0]
request.controller=items[1]
request.function=items[2]
And also I found /static/... is hard coded as well.
We can then refer to this "Products-Browse" rule explicitly within our Controllers and Views when we want to generate a URL to it. For example, we could use the Html.RouteLink view helper to indicate that we want to link to our "Products-Browse" route and pass it a "Food" category parameter using code in our view template like below:

This view helper would then access the routing system and output an appropriate HTML hyperlink URL like below (note: how it did automatic parameter substitution of the category parameter into the URL using the route rule):

this is powerful tech.
and you can also do
{{=A('link text',_href=URL('application','controller','function')))}}
which results in
<a href="/application/controller/function">link text</a>
Mind that the web2py also escapes "link text" while I am not sure
the .NET way does.
what about you define something like this in a model:
class __LINK__:def __getattr__(self,value): return self[value]def __getitem__(self,value):c,f=value.split('_',1)
return lambda *args,**vars: URL(r=request,c=c,f=f,args=args,vars=vars)link=__LINK__()
and then you use it like
{{=link.controller_action('bla','bla',name='value')}}would generate"/application/controller/action/bla/bla?name=value"
what about you define something like this in a model:class __LINK__:def __getattr__(self,value): return self[value]def __getitem__(self,value):c,f=value.split('_',1)return lambda args=[],vars={}: URL(r=request,c=c,f=f,args=args,vars=vars)link=__LINK__()and then you use it like{{=link.controller_action()}} or {{=link['controller_action']()}}would generate"/application/controller/action"?
Massimo
Massimo