Changes between Version 4 and Version 5 of WikiContext
- Timestamp:
- May 15, 2007, 9:28:20 PM (17 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
WikiContext
v4 v5 1 [[PageOutline(3-6 ,inline)]]1 [[PageOutline(3-6)]] 2 2 = Wiki Rendering Context = 3 4 '''`trac.context.Context`''' ''(current [milestone:0.11])'' 3 5 4 '''`trac.wiki.api.Context`''' ''(current [milestone:0.11]dev, r4451)''5 6 6 '''`trac.resource.Context`''' ''(see [#FutureDirections])'' 7 7 … … 11 11 - Identify the resource to which the wiki text belongs (`.env`, `.realm`, `.id`) 12 12 - Access to parent context, if there's one (`.parent`) [[br]] 13 By extension, this enables one to unwind the stack of context embedding13 By following that link, this enables one to unwind the stack of context embedding 14 14 - Knows about how the rendered Wiki text is being accessed (`.req`, `.abs_urls`) 15 15 so that the proper links can be generated: 16 16 - `.href`: the appropriate Href instance for generating any kind of links 17 - `.self_href`: a link targeting the current Wiki context itself [[br]] 18 ''renamed to `.resource_href` in the security branch'' 19 - ''Allow easy access to the corresponding resource itself (`.resource`) - security branch only'' 17 - `.resource_href`: a link targeting the current Wiki context itself 18 - Provide access to the corresponding resource itself (`.resource`) 20 19 21 Besides, it keeps a handle to a database connection (`.db`) the way the `Formatter` objects used to do. 20 ''Besides, it keeps a handle to a database connection (`.db`) the way the `Formatter` objects used to do.'' -- will probably change in milestone:0.12'' 22 21 23 Such a context can be used for generating wiki texts in different flavors, using the `.wiki_to_...` methods. ''Note: this is susceptible to change''22 The `wiki_to_xyz(ctx, wiki)` template functions currently expect a Context for the first argument, and the wiki text as the second argument. ''Note: this is susceptible to change'' 24 23 25 24 It's very easy to manipulate contexts, or create sub-contexts. Here are some examples: … … 54 53 == API Changes == 55 54 56 Besides the new trac. wiki.api.Context class, a few existing interfaces have been modified:55 Besides the new trac.context.Context class, a few existing interfaces have been modified: 57 56 - `IWikiMacroProvider.render_macro` still takes a `req` as its first argument (#4139), 58 57 but it's now deprecated and `IWikiMacroProvider.expand_macro` should be preferred, … … 61 60 (`formatter.context`). 62 61 - `IHTMLPreviewRenderer.render` takes a `context` instead of a `req` as its first argument 63 - `TimelineEvent.set_context` takes a `context` first argument and a `wikitext` second argument. That wiki text can now be retrieved in the `.wikitext` property instead of the `.message` one. 62 - `TimelineEvent.set_context` takes a `context` first argument and a `wikitext` second argument. That wiki text can now be retrieved in the `.wikitext` property instead of the `.message` one. ''Note: this is still subject to change'' 64 63 65 64 … … 68 67 === Fine-grained Permission Checking === 69 68 70 The source:sandbox/security branch already contains a much empowered version of the Context class.71 72 69 As a context can describe precisely ''which'' resource is accessed and at the same time ''how'' it is accessed (and more specifically ''who'' accesses it), it is also a perfect fit for the fine-grained PermissionPolicy (see also the [PermissionPolicy@16 design document]). 73 70 74 In order to be used as a lightweight descriptor of a resource, Context can also be sub classed. The user of a context doesn't need to have to think about this, as the correct subclass is always used, based on the `.realm` information.71 In order to be used as a lightweight descriptor of a resource, Context can also be sub-classed. The user of a context doesn't need to have to think about this, as the correct subclass is always used, based on the `.realm` information. 75 72 76 73 === Multiple Project Support ===