On Fri, Mar 10, 2006 at 02:43:18PM -0500, Matthew Good wrote:
> Why not just have an ITicketFieldType, with Field as an abstract
> implementation?  Subclasses of Field would have a property that is the
> text key they're referenced by.  It seems kind of redundant to enumerate
> this in a separate class when it could be part of the Field classes.

This is because the system needs the textual name before instantiation
of the subclasses. That is, it looks up the class to instantiate using
the textual name. This is most evident in the ticket-custom section:

    [ticket-custom]
    foo = textarea
    foo.label = Something

However, I could have a Field class method type():

    def type(cls):
        return cls.__name__.lower()
    type = classmethod(type)

Which I had thought of before, but rejected because it might be a bit
too "magic". What do you think?

-- 
Evolution: Taking care of those too stupid to take care of themselves.
_______________________________________________
Trac-dev mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-dev

Reply via email to