From d99c518c8386f2fd522eb0fdc22e5783707e21dd Mon Sep 17 00:00:00 2001 From: Laurence Rowe Date: Fri, 28 Sep 2012 12:30:52 +0100 Subject: [PATCH] Use object id as context may not be hashable. --- plone/formwidget/contenttree/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/plone/formwidget/contenttree/utils.py b/plone/formwidget/contenttree/utils.py index 3856f09..717c06e 100644 --- a/plone/formwidget/contenttree/utils.py +++ b/plone/formwidget/contenttree/utils.py @@ -33,10 +33,10 @@ def closest_content(context=None): def _valid_context(context): """Walk up until finding a content item.""" - # Avoid loops + # Avoid loops. The object id is used as context may not be hashable seen = set() - while context is not None and aq_base(context) not in seen: - seen.add(aq_base(context)) + while context is not None and id(aq_base(context)) not in seen: + seen.add(id(aq_base(context))) if (IContentish.providedBy(context) or IFolderish.providedBy(context)): return context