[DM] RFC 2396 compatible traversal parameters
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Zope 2 |
Invalid
|
Wishlist
|
Unassigned |
Bug Description
2. Introduction
Haufe uses this features in iDesk to make passing the so called area (information about the active tab) more robust. It allows to use virtual host technology to pass on area such that in normal cases the area is maintained autmotatically. Action is necessary only when the active tab is to be changed.
3. Abstract
RFC2396 defines the overall uri structure. Hierachical uri schemes have a path component consisting of a sequence of path segments. Each path segment consists of a name and optionally a sequence of parameters separated by ;. This proposal describes how Zope's publishing component can be enhanced to support path segment parameters, herein called traversal parameters.
4. Rationale
There are some important use cases that require information to be kept across successive requests. The most prominent ones are maintaining the session id as well as skin and language selection. We recently met more special ones: keeping tab activation and information about the authentication domain (for remote login). The currently available solutions store this information in:
* the session
* a cookie
* the URL
Session and cookie storage have the disadvantages that they do not play well with the browser's history function and that they can seriously confuse caching (mittigated a bit by appropriate 'vary' cache controls, but not solved). Furthermore, cookies might not be available for security reasons.
URL storage does not suffer these disadvantages but currently requires the introduction of artificial path segments for the additional information and difficult traversal magic to prevent the artificial segements from interfering with the traversal process. Traversal parameters can solve this much more naturally than artificial path segments.
Zope currently does not support traversal parameters.
5. Usage Types
Traversal parameters can have two kinds of uses:
* controlling the traversal process itself
* providing information for the whole request
Skin selection belongs for example to the first kind, tab activation to the second one; language selection may belong to either of them.
While it seems most natural to attach information for the whole request to the last path segment, it is much more practical to use some path segment further to the front as this information might be used automatically (without explicit URL construction) by relative uri references.
6. Risks
Support for traversal parameters controlling the traversal process itself will inevitably require deeper changes in Zope's traversal implementation. As this implementation is already quite complex and supports many use cases, the new extension might break some of them. I will outline the special risks in the solution part.
There might be clients not implementing RFC 2396. Such clients might support parameters only at the path end and view everything after the first ; as part of the parameters. Such clients might resolve relative uri references incorrectly in the presence of traversal parameters.
7. Proposed Solution
The solution modifies Zope's ZPublisher.
Currently, the path argument is split into a sequence of names, maintained reversed in the TraversalReques
When the traversal process has located a subobject, it checks whether it provides or is adaptable to the interface ZPublisher.
The traversal will maintain the parameters for the current step in TraversalReques
To support parameters destined to the complete request (rather than individual traversal steps), all found parameters are collected in TraversalReques
For an application, it is difficult to work with parameter lists. Therefore, BaseRequest gets the new method dictifyParameters. It takes a parameter list as argument and returns a parameter dictionary. It performs the same conversions and assemblies as ZPublisher.
After traversal, the request gets a lazy key TraversalReques
Changed in zope2: | |
importance: | Undecided → Wishlist |
status: | New → Confirmed |
Just to note that, years ago, the ; stuff in urls was looked at for Zope 3 traversal. It was going to be used to find the view, however, the idea was dropped due to patchy implementation in browsers.