The "hashbang" ("#!") is for a very specific purpose where your whole page 
is coded in JavaScript. It was sort of popularized by Twitter who is 
actually now abandoning it. I'm not sure why you would want to use it.

If you have your routes set up with a default app and default controller, 
you could do something simple like:

def u():
    row = db(db.auth_user.shortname==request.args(0)).select().first()
    return dict(row=row)

Which should support URLs like:

http://www.myserver.com/u/johnsmith





On Wednesday, May 30, 2012 9:37:13 AM UTC-7, Annet wrote:
>
> Hi Anthony,
>
> I read the relevant part of the book: 
> http://www.web2py.com/books/default/chapter/29/4?search=url+rewrite#Parameter-based-systemand
>  had a look at 
> router.example.py file, I am not sure I completely understand the 
> solution you provided me with.
>
> If you use the parameter-based rewrite system to set a default app, 
>> controller, and function and specify the list of available functions in the 
>> default router
>
>
> By default router you mean this:
>
> #  The built-in default router supplies default values (undefined members 
> are None):
> #
> #     default_router = dict(
> #         default_application = 'init',
> #             applications = 'ALL',
> #         default_controller = 'default',
> #             controllers = 'DEFAULT',
> #         default_function = 'index',
> #             functions = None,
> #         default_language = None,
> #             languages = None,
> #         root_static = ['favicon.ico', 'robots.txt'],
> #         domains = None,
> #         map_hyphen = False,
> #         acfe_match = r'\w+$',              # legal app/ctlr/fcn/ext
> #         file_match = r'(\w+[-=./]?)+$',    # legal file (path) name
> #         args_match = r'([\w@ -]+[=.]?)+$', # legal arg in args
> #     )
>
> ... in router.example.py? In my case default_application = 'init', 
> default_controller = 'default' and default_function = 'index'  What do you 
> mean by 'and specify the list of available functions in the default router' 
> . My application contains 15 controllers and almost 100 functions, do I 
> have to list them all in functions = '' or do I have to just list the 
> functions in default_controller = 'default', controllers = 'DEFAULT',
>
>  
>
>> then in http://yourdomain.com/code/shortname, code and shortname will be 
>> interpreted as request.args[1:2], with the request being routed to the 
>> default app, controller, and function.
>
>
> In my case init/default/index which implies that in the index function I 
> have to do something like:
>
>
> def index():
>     if request.args(0)==code:
>         
> row=db(db.auth_user.shortname==request.args(1)).select(db.auth_user.nodeID).first()
>         
> account=db(db.NodeAccount.nodeID==row.nodeID).select(db.NodeAccount.accountID).first()
>         if account.accountID==BASICACCOUNTID:
>             redirect(URL('vcard',args=row.nodeID))
>         elif account.accountID==ADVANCEDACCOUNTID:
>             redirect(URL('site','index',args=row.nodeID))
>         elif account.accountID==HUBACCOUNTID:
>             redirect(URL('hub','index',args=row.nodeID))
>     else:
>         return dict()
>
>
> Kind regards,
>
> Annet
>     
>

Reply via email to