Edgewall Software

Changes between Version 22 and Version 23 of TracDev/ApiChanges/0.11


Ignore:
Timestamp:
Nov 7, 2007, 9:55:22 AM (17 years ago)
Author:
Christian Boos
Comment:

Documenting Resource and Context + add some more TODOs

Legend:

Unmodified
Added
Removed
Modified
  • TracDev/ApiChanges/0.11

    v22 v23  
    4040#!python
    4141try:
    42     from trac.timeline import ITimelineEventProvider
     42    from trac.timeline.api import ITimelineEventProvider
    4343except ImportError:
    4444    from trac.Timeline import ITimelineEventProvider
     
    5757}}}
    5858
    59 Then, the return type for the `get_timeline_events` event has changed. It can now be a `TimelineEvent` object instead of a tuple, though the tuple return value will still be supported for compatibility reasons in 0.11.
    60 
    61 (Please note that this API hasn't been 100% agreed on yet, so you probably want to stick to just returning tuples for now.)
     59Then, the return type for the `get_timeline_events` event has changed.
     60Instead of a 6-tuple `(kind, href, title, date, author, markup)` (which still supported for compatibility reasons in 0.11),
     61the returned value can now be a 4 or 5-tuple `(kind, date, author, data[, provider])`, which is far more flexible than
     62before, especially because the `data` can be anything that will be used by a new `render_timeline_event(context, field, event)`
     63method called when actually displaying the events.
    6264
    6365''Note: support for #1198 and #2293 will likely require adding other methods to that interface''
     
    8183 - `expand_macro(formatter, name, content)` has been added and supersedes `render_macro`.
    8284
    83 The `req` was not enough for most of the macros, which needed to resort to various hacks to get more information about the formatting at work. The more adequate `formatter` object is now provided instead. The `req` object can still be obtained from the formatter, with `formatter.req`. Better yet, the formatter now always know about the WikiContext in which it operates (use `formatter.context` to retrieve it).
    84 The context object provides the information about the Trac resource which "owns" the text being processed.
     85The `req` was not enough for most of the macros, which needed to resort to various hacks to get more information about the formatting at work.
     86The more pertinent `formatter` object is now provided instead. The `req` object can still be obtained from the formatter, with `formatter.req`,
     87but this is going to be deprecated. Instead, you should access to the following set of information:
     88 - `formatter.resource` is the resource identifier which owns the text being formatted  (this is a `trac.resource.Resource`, see below),
     89 - `formatter.context` is the rendering context in which this wiki formatting takes place (this is a `trac.mimeview.api.Context`, see below)
     90 - `formatter.perm` the permission cache which can be used in order to perform fine-grained permission checks (this is a `trac.perm.PermissionCache`).
    8591
    8692`render_macro(req, name, content)` will likely be removed in [milestone:0.12].
     
    8894=== `IHTMLPreviewRenderer` ^[source:trunk/trac/wiki/api.py@head#L213 (0.11)] [source:tags/trac-0.10/trac/wiki/api.py@head#L209 (0.10)]^ === #IHTMLPreviewRenderer
    8995
    90 Similar to the above change, `render(req, mimetype ...)` is now `render(context, mimetype ...)`. It doesn't matter that much however, as it looks like that this interface is going to be integrated in `IContentConverter` anyway (see #3332).
     96Similar to the above change, `render(req, mimetype ...)` is now `render(context, mimetype ...)`, `context` being a rendering `Context` (see below).
     97It doesn't matter that much however, as it looks like that this interface is going to be integrated in `IContentConverter` anyway (see #3332 - 0.12 topic unfortunately).
    9198
    92 == New Interfaces ==
     99== New Interfaces, Modules and Classes ==
    93100
    94 Several new interfaces have been added in 0.11.
     101Several new interfaces and modules have been added in 0.11.
     102
     103TODO: document the various new trac.util modules.
     104
     105=== `trac.resource.Resource` ===
     106
     107The '''resource identifier''' class `Resource` is used to specify in a convenient way which Trac ''resources'' is being manipulated.
     108A Trac resource is mostly anything in Trac that can be addressed with its own URL and to which some content is attached.
     109A resource is mainly identified by a `realm` string and an `id` string or a number.
     110Also, a `version` can be specified in a Resource object, in order to refer to the content of a resource at a particular moment of its history.
     111A version specification of `None` simply refers to the latest version of the resource.
     112Finally, a resource can be parented in another resource. This relationship usually means that a removal of the parent resource implies a removal of the children resources.
     113
     114=== `trac.resource.IResourceManager` ===
     115
     116The `IResourceManager` let components claim ownership of some realms.
     117For the managed realms, the manager component will know how to build URLs to access the resources belonging to that realm and will know how to describe those resources.
     118Various utility functions exist in the `trac.resource` module in order to manipulate the `Resource` identifier objects in a generic way.
     119
     120=== `trac.mimeview.api.Context` ===
     121
     122The '''rendering context''' class is used to specify ''how'' the content should be rendered.
     123It holds together all the needed contextual information that will be needed by individual renderer components.
     124It is notably hodling together a `Resource` identifier for specifying the owning resource of the content being rendered,
     125a `PermissionCache` for restricting the display of information to the authorized parts only and an `Href` object that
     126can be used for creating links.
     127Also, `Context` can be parented and this relationship usually correspond to some kind of embedding of the data
     128(typical example, ticket information displayed within a Wiki page by the way of a macro).
     129
     130=== `trac.perm.IPermissionPolicy` ===
     131
     132TBD.
     133
     134=== `trac.ticket.api.ITicketActionController` ===
     135
     136TBD. See TracWorkflow.
     137
     138=== `trac.ticket.roadmap.ITicketGroupStatsProvider` ===
     139 
     140TBD.
     141 
     142=== `trac.web.ITemplateStreamFilter` ===
     143
     144TBD.
     145
     146=== `trac.prefs.api.IPreferencePanelProvider` ===
     147
     148TBD.
    95149
    96150=== `IPropertyRenderer` ^[source:trunk/trac/versioncontrol/web_ui/browser.py@head#L46 (0.11)] ===
     
    103157Likewise, the presentation of changes for version control properties can be customized.
    104158
    105 == Renaming ==
     159=== !WebAdmin is now part of the core ===
    106160
    107 [This section could probably be done better, but I figure getting the info in here is better than having it left out]
    108 
    109  * {{{webadmin.web_ui.IAdminPageProvider}}} -> {{{trac.admin.api.IAdminPanelProvider}}}.  Also its {{{get_admin_pages}}} method became {{{get_admin_panels}}}.
    110  * some module names, such as {{{trac.Timeline}}} and {{{trac.Search}}}, were de-capitalized, e.g. {{{trac.timeline}}}
     161 * The previously external interface `webadmin.web_ui.IAdminPageProvider` is now a core interface: `trac.admin.api.IAdminPanelProvider`.
     162   Also its `get_admin_pages` method became `get_admin_panels`.
     163[[comment(some module names, such as {{{trac.Timeline}}} and {{{trac.Search}}}, were de-capitalized, e.g. {{{trac.timeline}}} => see above, there's a full section for each)]]