Hi Derek,

Thank you for your reaction!

I did read the manual, but I could not find the solution that I needed. 
That's why I asked what I asked ;)

Let me see if this is solution we can work with. 



Op vrijdag 1 augustus 2014 00:30:22 UTC+2 schreef Derek:
>
> RTFM 
>
>
> http://www.web2py.com/books/default/chapter/29/04/the-core#Dispatching
>
> web2py maps GET/POST requests of the form:
>
> http://127.0.0.1:8000/a/c/f.html/x/y/z?p=1&q=2
>
> to function f in controller "c.py" in application a, and it stores the 
> URL parameters in the request variable as follows:
>
> request.args = ['x', 'y', 'z']
>
>
> so you could say /a/c/f.html/customernumber and customernumber would be 
> request.args[0]
> On Wednesday, July 30, 2014 2:53:34 AM UTC-7, Eric wrote:
>>
>> Hi,
>>
>> We need a way to get the customer number into web2py by it's url so we 
>> can display the corresponding data to the visitor. To keep it easy for the 
>> visitor this number needs to be visible in every url.
>>
>> Since the site runs under SSL and we don't want to buy another SSL 
>> certificate, we're looking for a different solution, so this isn't an 
>> option:
>> https://<number>.sub.domain.com
>>
>> That would be the easy way :)
>>
>> I was looking at the routers, but I can't figure out how to do something 
>> like this in an router and have <number> available in the Python scripts:
>> https://sub.domain.com/<number>/c/f/a?vars=example
>>
>> Is here anyone with an idea how to create this and have the "<number>" 
>> accessible in Python? The <number> is a dynamic value, so zero maintenance 
>> in the routes would be really, really nice ;)
>>
>> The number can probably be retrieved from the HTTP_HOST that is available 
>> in Web2Py, but how to handle the number in a router? I've tried this, but 
>> that's not working:
>>
>> # # -*- coding: utf-8 -*-
>>
>> default_controller = 'default'
>> default_function = 'index'
>>
>> routers = dict(
>>                BASE=dict(default_application='app',
>>                            map_static=True,
>>                            map_hyphen=True)
>> )
>>
>> routes_in = (
>>              # Keep admin working
>>              ('/admin', '/admin'),
>>              ('/admin/$anything', '/admin/$anything'),
>>
>>              # Keep appadmin working
>>              ('/$app/appadmin', '/$app/appadmin'),
>>              ('/$app/appadmin/$anything', '/$app/appadmin/$anything'),
>>
>>              ('/$app/$number/$anything', '/$app/$anything'),
>>
>> )
>>
>> routes_out = [(x, y) for (y, x) in routes_in]
>>
>> Thanks for the input!
>>
>

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to