Edgewall Software

Changes between Version 1 and Version 2 of FieldRefactoring


Ignore:
Timestamp:
Jun 7, 2007, 12:03:13 PM (17 years ago)
Author:
Christian Boos
Comment:

Some scratch notes for the Property class

Legend:

Unmodified
Added
Removed
Modified
  • FieldRefactoring

    v1 v2  
    88
    99Get an "adapted" rendering of standard and custom fields, in the following situations:
    10  1. Display of the field's value in the ''Ticket Box'' and other similar places (e.g. query results)
     10 1. Display of the field's value in the ''Ticket Box'' and other similar places (e.g. query and report results)
    1111 2. Display of the field's value changes, in the ''Change History'' and other similar places (e.g. timeline, notification)
    1212 3. Display of a field editor in the "Properties" fieldset and other similar places (e.g. bulk editor)
     
    1414
    1515Some points to consider:
    16  - the distinction between regular and custom types should become fairly transparent at the web UI level (leave the door open for unification later in GenericTrac)
     16 - the distinction between regular and custom types should become fairly transparent at the web UI level (leave the door open for unification later in GenericTrac) -- this is (was, even) already the case
    1717 - a rendering flexibility similar to the one of "Browser" properties should be reached (see source:trunk/trac/versioncontrol/web_ui/browser.py and source:trunk/trac/versioncontrol/web_ui/changeset.py)
    1818
    1919
     20== Proposal ==
     21
     22A new API for dealing with fields according to the 4 points detailed above should be introduced.
     23The ''old'' 0.9 - 0.11 API should be preserved, as there's a bunch of scripts all over the Trac world that probably depend on it, so ideally no existing method should be modified (I'm thinking in particular to `TicketSystem.get_ticket_fields`).
     24
     25Instead, a new set of methods and objects should be introduced. In order to avoid any confusion between the old and new ways, I propose to use the term ''property'' instead of ''field''.
     26This matches the user-visible ''Properties'' label displayed in the ticket UI.
     27
     28There will be a Property class and a set of basic subclasses that correspond to the main types of fields. A resource (tickets only for now) will define the set of properties that it provides (first  in `TicketSystem.get_ticket_properties()`, but preferably later in `TicketDescriptor.get_properties()`, with `TicketDescriptor` a subclass of `ResourceDescriptor`, the generic handle for resources).
     29
     30A Property subclass will have methods and attributes for ''answering'' the needs enumerated above.
     31 1. `render(context, name, mode, value)` - similar to the `render_property` of the `trac.versioncontrol.browser.IPropertyRenderer` (probably some kind of unification is in order)
     32    - multiple other methods checking for the 'visibility' status of the field, 'row' display mode, etc.
     33      Each time with a given 'mode', which would be one of: `'ticket'`, `'ticket_preview'`, `'query'`
     34 2. `render_change(old_context, new_context, name, mode, old_value, new_value)` - similar to the `render_property_diff` of the `trac.versioncontrol.changeset.IPropertyDiffRenderer`
     35 3. `render_editor(context, name, mode, value)`. There could also be a validation method supporting validation requests that would be handled by a generic property module.
     36 4. `render_selector(context, name, mode, values)`, for e.g. the query module.
     37     
     38
    2039----
    2140See: log:sandbox/field-refactoring-tmp