On Nov 29, 10:29 pm, Remy Blank <[email protected]> wrote:
> Chris Nelson wrote:
> > Why does it matter what context I call ExetnsionOption() in?
>
> Because ExtensionOption implements the decriptor protocol, which makes
> it behave in a special way when an instance is a class attribute. See:
>
>  http://docs.python.org/reference/datamodel.html#implementing-descriptors
>  http://users.rcn.com/python/download/Descriptor.htm
>

A trick here may be to use the strategy from EstimationToolsPlugin
that define helpers that just return the Option, so that each of the
macros that use a particular option can just fetch it from a common
location:

def get_estimation_field():
    return Option('estimation-tools', 'estimation_field',
'estimatedhours',
        doc="""Defines what custom field should be used...""")

And used in a component like:

class MyComponent(Component)
    estimation_field = get_estimation_field()

Technically it may be added to registry several times for each enabled
macro (unless we perhaps do a check for it in trac.config?), but
seeing it is the same key it will be just one version of it anyway and
the overhead is trivial.


:::simon

https://www.coderesort.com
http://trac-hacks.org/wiki/osimons

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/trac-users?hl=en.

Reply via email to