On Fri, 2006-03-10 at 13:57 +1100, Alec Thomas wrote:
> I think it would be advantageous to let plugins implement their own
> ticket field types. Progress-bars, integer-only fields, etc. have all
> been requested numerous times.
> 
> I'm proposing to add something like this:
> 
>     class ITicketFieldTypeProvider(Interface):
>         """ Provide custom ticket field types. """
>         def get_ticket_field_types():
>             """ Return list of (name, type) tuples, where type is a
>                 subclass of trac.ticket.field.Field. """
> 
> Then the current field types would be implemented with this:
> 
>     def get_ticket_field_types(self):
>         from trac.ticket.field import TextArea, Select, \
>                                       CheckBox, Radio, Text
>         yield ('textarea', TextArea)
>         yield ('select', Select)
>         yield ('checkbox', CheckBox)
>         yield ('radio', Radio)
>         yield ('text', Text)

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.

-- 
Matthew Good <[EMAIL PROTECTED]>

_______________________________________________
Trac-dev mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac-dev

Reply via email to