#10778: Standalone UUID implementation ----------------------------+----------------------------------------------- Reporter: optilude | Owner: optilude Type: PLIP | Status: new Priority: minor | Milestone: 4.1 Component: Infrastructure | Resolution: Keywords: | ----------------------------+----------------------------------------------- Description changed by optilude:
Old description: > = Motivation = > > Many applications require some notion of a universally unique ID. For > example: > > * Archetypes/Kupu-style link-by-uid > * References to content from non-content items, e.g. tiles/portlets > * Disambiguation of content, e.g. in export/import scenarios > * Effective tokenisation of content for vocabularies and selection > widgets > > Archetypes has a solution its UID() attribute, but the implementation is > AT-specific and rather heavyweight, requiring the interaction of three > separate catalogues (portal_catalog, reference_catalog, uid_catalog). > > zope.intid/five.intid provide more generic integer ids, but these are not > universally unique and so not stable across sites. > > CMFUId is a similar, CMF-specific solution. > > This PLIP proposes a lightweight, simple UUID mechanism that is > independent of any content implementation. The aims are to have: > > * A standards-based UUID implementation, with > * a simple, intuitive API, and > * standard utility views > > = Assumptions = > > Plone wants to support content not exclusively built with Archetypes. > > = Proposal & Implementation = > > * A small package, ''plone.uuid'', with minimal dependencies > * An adapter interface, ''IUUID'', to obtain a UUID for a content item. > * A marker interface, 'IUUIDAware', which lets types opt into an on- > create event handler, which allocates a UUID and stores it > * All CMF content will be marked with this interface > * UUIDs are generated using the standard library ''uuid'' module > * The default implementation stores UUIDs in an attribute on the content > object (an annotation would be less efficient, since it'd be in a > separate persistent object) > * Some utility views are registered: > * ''@@uuid'', a view on any ''IUUIDAware'' item returning a UUID > * ''@@resolve-uuid'', uses sub-path traversal to look up a UUID, > returning a path > * ''@@redirect-to-uuid'', uses sub-path traversal to look up a UUID, > returning a 304 response > * In addition, Plone should register a catalogue index and metadata > column in ``portal_catalog`` to make it possibly to search by UUID and > obtain a UUID from a catalogue brian > > = Deliverables = > > * The ''plone.uuid'' package > * Minor changes to ''Products.CMFPlone'' > * A migration step to add UUIDs to existing content > * Documentation > > = Risks = > > Potential confusion between this and the Archetypes' UID implementation. > > = Participants = > > Martin Aspeli, and hopefully others :-) > > = Progress = > > * PLIP submitted New description: = Motivation = Many applications require some notion of a universally unique ID. For example: * Archetypes/Kupu-style link-by-uid * References to content from non-content items, e.g. tiles/portlets * Disambiguation of content, e.g. in export/import scenarios * Effective tokenisation of content for vocabularies and selection widgets Archetypes has a solution its UID() attribute, but the implementation is AT-specific and rather heavyweight, requiring the interaction of three separate catalogues (portal_catalog, reference_catalog, uid_catalog). zope.intid/five.intid provide more generic integer ids, but these are not universally unique and so not stable across sites. CMFUId is a similar, CMF-specific solution. This PLIP proposes a lightweight, simple UUID mechanism that is independent of any content implementation. The aims are to have: * A standards-based UUID implementation, with * a simple, intuitive API, and * standard utility views = Assumptions = Plone wants to support content not exclusively built with Archetypes. = Proposal & Implementation = * A small package, ''plone.uuid'', with minimal dependencies * A package ''plone.app.uuid'' for Zope 2/Plone specific stuff * An adapter interface, ''IUUID'', to obtain a UUID for a content item. * UUIDs are generated using the standard library ''uuid'' module * A marker interface, 'IAttributeUUID', which lets types opt into an on- create event handler, which allocates a UUID and stores it * The default implementation stores UUIDs in an attribute on the content object (an annotation would be less efficient, since it'd be in a separate persistent object) * Some utility views are registered: * ''@@uuid'', a view on any ''IUUIDAware'' item returning a UUID * ''@@redirect-to-uuid'', uses sub-path traversal to look up a UUID, returning a 304 response * Archetypes is updated to support the IUUID protocol and generate UUIDs in the same way for new content (only). No migration will be required. The UID() method will become a shim for IUUID(self). Code should be updated to use IUUID instead if it needs to be compatible with non-AT content. It's hoped that this can make it possible for AT content to make simple references to non-AT content = Deliverables = * The ''plone.uuid'' and ''plone.app.uuid'' packages * Updates to ''Products.Archetypes'' * Minor changes to ''Products.CMFPlone'' * Documentation = Risks = = Participants = Martin Aspeli, and hopefully others :-) = Progress = * PLIP submitted * PLIP implemented * PLIP reviewed -- -- Ticket URL: <http://dev.plone.org/plone/ticket/10778#comment:32> Plone <http://plone.org> Plone Content Management System _______________________________________________ PLIP-Advisories mailing list plip-advisor...@lists.plone.org http://lists.plone.org/mailman/listinfo/plip-advisories