Im sorry posted by accident without finishing.
the last code works but with some limitations.
Im trying to replicate the function ticket from admin/default.py into the
display_errors function

It displays the error on the url that caused the ticket but it is not using
the same layout as the admin app, so some things doesnt appear correctly.
i was hoping there were an easier way, maybe with exec_environment or using
XMLRPC but i have to learn how to use them yet.



On 1 May 2014 08:51, <[email protected]> wrote:

> Im gonna try to explain it better.
>
> I have an application with a controller that has a function that produces
> an error. ex: myapp/default/index
> on routes.py im redirecting the errors to otherapp/default/display_errors
> to watch the ticket i have to go to "
> http://localhost:8000/admin/default/ticket/myapp/127.0.0.1.2014-05-01.07-54-28.fad8beec-c539-4243-b7bb-116ce76cc39c
> "
> i would like  otherapp/default/display_errors to return the same response
> as that url
>
> Ive tried many things like, none of them are working very well.
> def display_errors():
>     import urllib
>     resp = urllib.openurl("
> http://localhost:8000/admin/default/ticket/myapp/127.0.0.1.2014-05-01.07-54-28.fad8beec-c539-4243-b7bb-116ce76cc39c
> "")
>     return resp.read()
>
> it returns the admin login page, does not work.
>
> app = request.application
>     myversion = request.env.web2py_version
>     ticket = request.vars.ticket.split("/")[1]
>     from gluon.restricted import RestrictedError
>     e = RestrictedError()
>     e.load(request, app, ticket)
>
>     return response.render("default/ticket.html", dict(app=app,
>                 ticket=ticket,
>                 output=e.output,
>                 traceback=(e.traceback,), # and TRACEBACK(e.traceback)),
>                 snapshot=e.snapshot,
>                 code=e.code,
>                 layer=e.layer,
>                 myversion=myversion))
>
>
>
>
>  --
> 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 a topic in the
> Google Groups "web2py-users" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/web2py/DpHra_ypD4g/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

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