fix storage of nodeView in request; provide baseObject utility function for unwrapping an adapter if necessary
git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@3633 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
parent
4b32972ef0
commit
0a4f1de2eb
2 changed files with 9 additions and 4 deletions
|
@ -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'))
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue