[Product-Developers] collective.monkeypatcher -- awkward names

Jean Jordaan jean.jordaan at gmail.com
Tue Feb 9 13:55:26 UTC 2010


Hi there

I find this a very awkward way to say "I want to add a new function to a
module"::

 <monkey:patch
    description="Add XML-RPC capability to SomeModule"
    module="Products.SomeProduct.SomeModule"
    original="readRemoteProject"
    ignoreOriginal="True"
    replacement=".SomeModule.readRemoteProject"
    />

Because there is no original, and if there were, I'm not ignoring the
original, I'm ignoring its *absence*.

Better would be::

 <monkey:patch
    description="Add XML-RPC capability to SomeModule"
    module="Products.SomeProduct.SomeModule"
    checkOriginal="False"
    patch=".SomeModule.readRemoteProject"
    />

If I simply want to replace an existing function of the same name,
checking for the original::

 <monkey:patch
    description="Add XML-RPC capability to SomeModule"
    module="Products.SomeProduct.SomeModule"
    patch=".SomeModule.readRemoteProject"
    />

If I'm replacing an existing function, and for some reason the
'description' attribute is insufficient to describe what I'm doing and I
want to name my method something different::

 <monkey:patch
    description="Add XML-RPC capability to SomeModule"
    module="Products.SomeProduct.SomeModule"
    original="readRemoteProject"
    patch=".SomeModule.readRemoteProject_myownspecialweirdname"
    />

Just a suggestion for the future .. if people aren't averse, I may
implement it if I find time.

-- 
jean                                              . .. .... //\\\oo///\\




More information about the Product-Developers mailing list