# HG changeset patch # User Thierry Florac # Date 1547025480 -3600 # Node ID 5ca9b0d569a56231ba8e66764910a3adde7f9b2e # Parent 1ed87336d99143f177e7cf75ffd6c05bf4d9ef1c Added "+" ITraversable adapter to support direct content access as defined in PyAMS_utils namespace traverser diff -r 1ed87336d991 -r 5ca9b0d569a5 src/pyams_default_theme/shared/common/oid.py --- a/src/pyams_default_theme/shared/common/oid.py Wed Jan 09 10:16:22 2019 +0100 +++ b/src/pyams_default_theme/shared/common/oid.py Wed Jan 09 10:18:00 2019 +0100 @@ -25,17 +25,22 @@ from pyams_workflow.interfaces import IWorkflow, IWorkflowPublicationInfo, IWorkflowVersions +@adapter_config(name='+', context=(Interface, IPyAMSUserLayer), provides=ITraversable) @adapter_config(name='oid', context=(Interface, IPyAMSUserLayer), provides=ITraversable) class OidTraverser(ContextRequestAdapter): - """++oid++ traverser""" + """++oid++ traverser + + This traverser can be used to get a direct access to any content having an OID. + The general URL syntax is "*/++oid++{oid}::{title}.html", where {oid} is the internal OID of the + requested content, dans "title" it's "content URL" attribute. + + A shorter syntax, is now available: */+/{oid}::{title}.html + """ def traverse(self, name, furtherpath=None): if not name: raise NotFound() - if '::' in name: - oid, label = name.split('::', 1) - else: - oid = name + oid = name.split('::')[0] sequence = get_utility(ISequentialIntIds) reference = sequence.get_full_oid(oid) target = get_reference_target(reference)