I'm a huge fan of CherryPy as it always seems to have the right design,
providing a flexible platform while keeping the mundane details out of
the way. Tools are a great example of this design. Unfortunately,
writing Tools always ends up being somewhat error prone and I end up
using copy and paste. Seeing as the actual API isn't terribly difficult
to get right, I wrote a base class similar to the SimplePlugin base
class for plugins that will hopefully make writing tools a little
easier.
On Tue, Sep 18, 2012 at 6:15 PM, Eric Larson <e...@ionrock.org> wrote:
> Hi All,
> I'm a huge fan of CherryPy as it always seems to have the right design,
> providing a flexible platform while keeping the mundane details out of
> the way. Tools are a great example of this design. Unfortunately,
> writing Tools always ends up being somewhat error prone and I end up
> using copy and paste. Seeing as the actual API isn't terribly difficult
> to get right, I wrote a base class similar to the SimplePlugin base
> class for plugins that will hopefully make writing tools a little
> easier.
All good stuff really. I'm so used to writing tools that I often forget
that their current API may not be as straightforward as one could expect
(though hardly complex as you say). I like the idea
of automatically registering hookpoints. Though to be fair my tool methods
are named after their role not the hook point where they'll be attached.
On Tue, Sep 18, 2012 at 9:29 PM, Sylvain Hellegouarch <s...@defuze.org> wrote:
> Hi Eric,
> On Tue, Sep 18, 2012 at 6:15 PM, Eric Larson <e...@ionrock.org> wrote:
>> Hi All,
>> I'm a huge fan of CherryPy as it always seems to have the right design,
>> providing a flexible platform while keeping the mundane details out of
>> the way. Tools are a great example of this design. Unfortunately,
>> writing Tools always ends up being somewhat error prone and I end up
>> using copy and paste. Seeing as the actual API isn't terribly difficult
>> to get right, I wrote a base class similar to the SimplePlugin base
>> class for plugins that will hopefully make writing tools a little
>> easier.
>> I wrote up a blog about with the code included.
> All good stuff really. I'm so used to writing tools that I often forget
> that their current API may not be as straightforward as one could expect
> (though hardly complex as you say). I like the idea
> of automatically registering hookpoints. Though to be fair my tool methods
> are named after their role not the hook point where they'll be attached.
> For instance, let's take this simple redis tool:
Sylvain Hellegouarch <s...@defuze.org> writes:
> On Tue, Sep 18, 2012 at 9:29 PM, Sylvain Hellegouarch <s...@defuze.org> wrote:
> All good stuff really. I'm so used to writing tools that I often forget
> that their current API may not be as straightforward as one could expect
> (though hardly complex as you say).
Just to be clear, I don't consider it complex in that it is difficult to
understand or keep straight in your head. Rather the complexity happens
in that there isn't a single prescribed method for specific tasks. A
wealth of options rarely makes a decision easier.
I agree that Tools really are pretty simple, especially compared to WSGI
middleware.
> Interestingly, a decorator of hookpoint would go a long way.
> --
> You received this message because you are subscribed to the Google Groups
> "cherrypy-users" group.
> To post to this group, send email to cherrypy-users@googlegroups.com.
> To unsubscribe from this group, send email to
> cherrypy-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ > cherrypy-users?hl=en.
I played around with this for a minute and something didn't feel
right. I figured it would be just as easy to do something like this
using the same base class:
> --
> You received this message because you are subscribed to the Google Groups
> "cherrypy-users" group.
> To post to this group, send email to cherrypy-users@googlegroups.com.
> To unsubscribe from this group, send email to
> cherrypy-users+unsubscribe@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/ > cherrypy-users?hl=en.
> I played around with this for a minute and something didn't feel
> right. I figured it would be just as easy to do something like this
> using the same base class:
> This is possible with a decorator, but this seems just as good IMO.
> Thoughts?
Just as well indeed. Decorators have only the added value of being more
dynamic. You could for instance decide not to attach the hookpoint at
runtime. But that would make things quite complex at some point.
-- - Sylvain
http://www.defuze.org http://twitter.com/lawouach
> I played around with this for a minute and something didn't feel > right. I figured it would be just as easy to do something like this > using the same base class: