>
>
> *e.g.trial 1*
> def sitemap():
> response.view = 'sitemap.xml'
> return locals()
>
> access http://127.0.0.1:8000/a/default/sitemap
> *result* :
> Sitemap
>
> *trial 2*
> def sitemap():
> response.view = 'generic.xml'
> return locals()
>
> access http://127.0.0.1:8000/a/default/sitemap
> *result* : display none (blank white)
>
Trials 1 and 2 won't work because the URL in the browser is determined by
the browser, not by the server. If you want to change the URL, you must do
a redirect.
> *trial 3*
> def sitemap():
> redirect(URL('default', 'sitemap.xml') )
>
> access http://127.0.0.1:8000/a/default/sitemap
> *result* :
> The 127.0.0.1 page isn’t working
>
> *127.0.0.1* redirected you too many times.
>
>
Yes, all your function does is redirect back to itself, so you get an
infinite redirect loop -- the function never actually returns anything.
Instead, you only want to redirect in case the ".xml" extension is missing.
def sitemap():
request.extension = 'xml' or redirect(URL(extension='xml'))
return dict()
>
> *trial : 4not define function at all*
> access http://127.0.0.1:8000/a/default/sitemap
> *result* :
> invalid function (default/sitemap)
>
>
You need an action in a controller to respond to a request -- merely having
a view without an associated controller will not work.
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.