Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Only use ``plone.uuid`` if object is ``IUUIDAware`` (otherwise, fall …

…back to ``UID()`` method.

svn path=/archetypes.schemaextender/trunk/; revision=13673
  • Loading branch information...
commit fd12161b797c637181cbefb254ab155535d1a6bd 1 parent b478f25
@malthe malthe authored
Showing with 12 additions and 1 deletion.
  1. +4 −0 CHANGES.txt
  2. +8 −1 archetypes/schemaextender/extender.py
View
4 CHANGES.txt
@@ -4,11 +4,15 @@ Changelog
2.1.1 - Unreleased
------------------
+* Only use plone.uuid to look up content UUIDs if objets are aware.
+ [malthe]
+
* Acquire request object via local site hook if object is not
acquisition-wrapped (in ``cachingInstanceSchemaFactory``). This
fixes caching issues with objects rendered using DTML. Note that
this is likely a bug in the ``DocumentTemplate`` code. Ideally, the
issue should be resolved there.
+ [malthe]
2.1 - 2011-01-03
----------------
View
9 archetypes/schemaextender/extender.py
@@ -141,7 +141,14 @@ def cachingInstanceSchemaFactory(context):
# If the object is just being created, we use its id() as a
# fallback. Generally the id() is not stable, as it changes
# with Acquisition wrappers and ZODB ghosting
- key = IUUID(context, str(id(context)))
+ fallback = str(id(context))
+
+ # Use ``plone.uuid`` only if applicable (object is aware)
+ if IUUIDAware.providedBy(context):
+ key = IUUID(context, fallback)
+ else:
+ key = context.UID() or fallback
+
schema = cache.get(key, None)
if schema is None:
schema = cache[key] = instanceSchemaFactory(context)
Please sign in to comment.
Something went wrong with that request. Please try again.