Extending the CherryPy Response Class
Dan LaManna <[email protected]> Fri, 10 Nov 2017 04:11:48 -0800 (PST)
| Newsgroups | gmane.comp.python.cherrypy |
|---|---|
| Message-ID | <[email protected]> |
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 cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected] To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected] Visit this group at https://groups.google.com/group/cherrypy-users. For more options, visit https://groups.google.com/d/optout.