diff --git a/browser/node.py b/browser/node.py index 241ed6e..6a3743b 100644 --- a/browser/node.py +++ b/browser/node.py @@ -76,10 +76,8 @@ class NodeView(BaseView): def __init__(self, context, request): super(NodeView, self).__init__(context, request) - viewAnnotations = request.annotations.setdefault('loops.view', {}) - viewAnnotations['nodeView'] = self - if viewAnnotations.get('node') is None: - viewAnnotations['node'] = self.context + self.viewAnnotations.setdefault('nodeView', self) + self.viewAnnotations.setdefault('node', self.context) viewConfig = getViewConfiguration(context, request) self.setSkin(viewConfig.get('skinName')) diff --git a/common.py b/common.py index c92c2bb..e62e602 100644 --- a/common.py +++ b/common.py @@ -46,6 +46,8 @@ from loops import util def adapted(obj, langInfo=None): """ Return adapter based on the object type's type interface. """ + if isinstance(obj, AdapterBase): + return obj t = IType(obj, None) if t is not None: ti = t.typeInterface @@ -58,6 +60,11 @@ def adapted(obj, langInfo=None): return adapted return obj +def baseObject(obj): + if isinstance(obj, AdapterBase): + return obj.context + return obj + # helper functions for specifying automatic attribute handling