No, the name 'index' withing 'showcase' is idle.

On Monday, August 28, 2017 at 9:56:13 AM UTC-4, Anthony wrote:
>
> Do you have a /showcase/index function?
>
> On Monday, August 28, 2017 at 2:03:40 AM UTC-4, [email protected] 
> <javascript:> wrote:
>>
>> I chose pattern-based rewrite because I don't know better. I am temporary 
>> part time web coder relying on web2py book 100% with understanding at about 
>> 60%. Being a mature person I am fond of eloquence in life as well as in 
>> URL's however complexity has its price. I sense from what you are saying I 
>> should stick with parametric router or leave it alone and keep the "asset" 
>> function where it naturally is . A quick sketch of what I am having fun 
>> with (this is ongoing process):
>>
>>
>> <https://lh3.googleusercontent.com/-YcgnjQax7c0/WaOxan-yVHI/AAAAAAAAAAs/mfhLgRvEp0g6eb6P3YFD6pXphH9cDwk3QCLcBGAs/s1600/stock_flow.png>
>> Thanks in advance.
>>
>> On Sunday, August 27, 2017 at 7:55:27 PM UTC-4, Anthony wrote:
>>>
>>> Got it. Next time, please provide more detail regarding your current 
>>> code/setup. Is there any particular reason you need to be using the 
>>> pattern-based rewrite system? If so, you'll just need to create a regex 
>>> that matches the route in question, or create a regex that matches all the 
>>> other possible functions in the controller and create a fallback route 
>>> *after* that to direct to the "asset" function.
>>>
>>> Anthony
>>>
>>> On Sunday, August 27, 2017 at 1:33:09 PM UTC-4, [email protected] wrote:
>>>>
>>>> I could make "asset" function the default for the "showcase" controller 
>>>> however I am not sure how as I am already using renamed 
>>>> routes.patterns.example.py (the book recommends not to mix pattern and 
>>>> parameter routing methods) in the root of the website (multiple apps in my 
>>>> case) to rewrite one URL (works nicely):
>>>>
>>>> routes_out = (
>>>>     ('/stock/default/index',BASE + '/stock'),# <== my addition
>>>>     # do not reroute admin unless you want to disable it
>>>>     ('/admin/$anything', BASE + '/admin/$anything'),
>>>>     # do not reroute appadmin unless you want to disable it
>>>>     ('/$app/appadmin/$anything', BASE + '/$app/appadmin/$anything'),
>>>>     # do not reroute static files
>>>>     ('/$app/static/$anything', BASE + '/$app/static/$anything'),
>>>>     # do other stuff
>>>>     (r'.*http://otherdomain\.com.* /app/ctr(?P<any>.*)', r'\g<any>'),
>>>>     (r'/app(?P<any>.*)', r'\g<any>'),
>>>>     # restore the BASE prefix
>>>>     ('/$anything', BASE + '/$anything'),
>>>> )
>>>>
>>>> Thanks in advance for any assistance
>>>>
>>>>
>>>> On Sunday, August 27, 2017 at 12:17:16 PM UTC-4, Anthony wrote:
>>>>>
>>>>> On Saturday, August 26, 2017 at 4:05:59 PM UTC-4, [email protected] 
>>>>> wrote:
>>>>>>
>>>>>> How can I rewrite the URL (to drop asset):
>>>>>>
>>>>>> https://192.168.1.25:8000/stock/showcase/asset/2017-Some-fridge?id=79&_signature=c2e7899530c858f1b478cb7ea5f03bb30d4f68e1
>>>>>> to look like:
>>>>>>
>>>>>> https://192.168.1.25:8000/stock/showcase/2017-Some-fridge?id=79&_signature=c2e7899530c858f1b478cb7ea5f03bb30d4f68e1
>>>>>> the app 'stock' ins't default
>>>>>> the controllert 'showcase' isn't default
>>>>>> the function 'asset' isn't default
>>>>>>
>>>>>
>>>>> Do you use another function as the default within the "showcase" 
>>>>> controller? If not, you can define "asset" as the default function just 
>>>>> for 
>>>>> the "showcase" controller using the parameter-based router. 
>>>>> Alternatively, 
>>>>> you can use the default function to handle the above routes by checking 
>>>>> for 
>>>>> a URL arg and returning the appropriate response. For example, if the 
>>>>> default function is "index":
>>>>>
>>>>> def index():
>>>>>     if not request.args:
>>>>>         [code currently in the "index" function]
>>>>>     else:
>>>>>         [code currently in the "asset" function]
>>>>>
>>>>> Finally, you could use the pattern-based rewrite system, though that 
>>>>> can start to get complex.
>>>>>
>>>>> Anthony
>>>>>
>>>>

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