Extending the CherryPy Response Class

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Extending the CherryPy Response Class

Dan LaManna

Hi all,

I'm wanting to extend cherrypy._cprequest.Response very slightly, in particular it would make things a bit cleaner if the status code was stored as an integer on the object in addition to the HTTP string, and I would also like to modify the repr to provide more useful output (said status code) in stack traces with locals() output.

It seems like I could use CherryPy tools to set an attribute on every response object, and of course being Python I could dynamically define a repr method. Though these solutions seem more brittle than being able to define MyResponseClass and set the application configuration to use my custom class.

What would be the most idiomatic way to go about such a customization?

Thanks!


--
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.