List Info

Thread: Catch-all exception handling in CherryPy?




Catch-all exception handling in CherryPy?
user name
2006-11-06 02:03:38
Hi. I am trying to make CherryPy redirect to the index page,
or send
back some default JSON encoded error, when the incorrect
number of
parameters are passed into one of my functions. I would like
some
recommendations on how to write catch-all error conditions
in CherryPy.

There doesn't seem to be a place to put a universal
try/except clause.
I don't see any explicit error event callbacks. What am I
missing?

Thank you in advance,
Gloria


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---

Weekly check for weak passwords? Where is it done?
user name
2006-11-05 23:34:28
I don't know about mailing, but couldn't you just cron the
output of john?
Boyd Lynn Gerber wrote:
> Hello,
>
> I do not know where/what program I installed that
causes one system to
> send emails weekly telling of insecure passwords.  I
have 20 systems
> with the same rpm -qa list.  One system weekly sends
emails with a warning
> of using insecure password.  Only one system does it. 
I would like to
> find out why only one of 20 systems does it.  They are
all using the same
> passwd group shadow file.  And if I can believe
>
> # rpm -qa >> /tmp/allrpms-list
> # for i in `cat system-names`; do scp -p
$i:/tmp/allrpms-list
> /tmp/allrpms-list.$i; diff /tmp/allrpms-list
/tmp/allrpms-list.$i; done
>
> Then there is not differences between the systems.  I
have been trying to
> find what program is generating it and I have been
unsucsessful.  Can any
> one tell me what rpm/program does this weekly check?
>
> Thanks,
>
>
> --
> Boyd Gerber <gerberbzenez.com>
> ZENEZ	1042 East Fort Union #135, Midvale Utah  84047
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: opensuse+unsubscribeopensuse.org
> For additional commands, e-mail: opensuse+helpopensuse.org
>
>
>   

------------------------------------------------------------
---------
To unsubscribe, e-mail: opensuse+unsubscribeopensuse.org
For additional commands, e-mail: opensuse+helpopensuse.org

Catch-all exception handling in CherryPy?
user name
2006-11-06 02:17:09
To be clear, I'm double=posting.
The default() method works for pages which map to nothing
valid. But it
does not work for a valid method receiving the wrong number
of
parameters. That is the case I wish to handle.

I also wish to manipulate the visible URL in the browser
when I handle
these cases. Please show me how to do this as well.

Thank you once again,
Gloria


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---

Catch-all exception handling in CherryPy?
user name
2006-11-06 14:29:06
Hi Gloria, could you send us a piece of your code - in order
to
understand what you have done?
Thanks.
Marcus


On 11/6/06, Gloria <strangestcomcast.net> wrote:
>
> To be clear, I'm double=posting.
> The default() method works for pages which map to
nothing valid. But it
> does not work for a valid method receiving the wrong
number of
> parameters. That is the case I wish to handle.
>
> I also wish to manipulate the visible URL in the
browser when I handle
> these cases. Please show me how to do this as well.
>
> Thank you once again,
> Gloria
>
>
> >
>


-- 
Marcus Mendes
"A coragem é a forma de todas as virtudes em ponto de
prova" C.S.Lewis
______________________________________________
linuxUser #311365
phones :  55 31 3495-6403 or 55 31 8801-3304
jabber : mvmendesjjabber.org // msn: mvmendeshotmail.com
blog: mvmendes.wordpress.com

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---

Catch-all exception handling in CherryPy?
user name
2006-11-06 23:33:11
Gloria wrote:
> There doesn't seem to be a place to put a universal
try/except clause.

Have you looked at the _cpOnError method in 2.2.1 (name may
have
changed to _cp_on_error or similar)

I do something similar to this:

def _cpOnError(self):
        import traceback, StringIO
        cherrypy.log(traceback.format_exc())
        htmlfile = 'error.html'
        error_page = open(htmlfile).read()
        cherrypy.response.body = error_page


I am sure you can just as well raise and http redirect or
internal
redirect if you wish.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---

Catch-all exception handling in CherryPy?
user name
2006-11-10 20:59:10
This is exactly what I hoped for, thank you.
I have defined it as a global module, and also within my
class, and
neither get executed. Can you point me to an example where
this is
defined and used, and invoked by CP upon error?
I cannot find such a thing in the docs or examples that
exist, but I am
possibly overlooking something.
Thank you,
Gloria


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---

Catch-all exception handling in CherryPy?
user name
2006-11-10 21:00:30
PS: I am using CP 3.0 beta.


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the
Google Groups "cherrypy-users" group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to
cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en

-~----------~----~----~----~------~----~------~--~---

Catch-all exception handling in CherryPy?
user name
2006-11-10 21:06:28
On 11/10/06, Gloria < strangestcomcast.net">strangestcomcast.net> wrote:

PS: I am using CP 3.0 beta.

There's the key bit of information!  Have a look at http://www.cherrypy.org/wiki/UpgradeTo30.&nbsp; _cp_on_error was replaced by request.error_response.  So you can do:

class Whatever:
  ;  _cp_config = {'request.error_response':your_handler}

HTH,

Christian
http://www.dowski.com



--~--~---------~--~----~------------~-------~--~----~
&nbsp;You received this message because you are subscribed to the Google Groups "cherrypy-users&quot; group.
To post to this group, send email to cherrypy-usersgooglegroups.com
To unsubscribe from this group, send email to cherrypy-users-unsubscribegooglegroups.com
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users?hl=en
-~----------~----~----~----~------~----~------~--~---

[1-8]

about | contact  Other archives ( Real Estate discussion Medical topics )