コード例 #1
0
    def _pt_getContext(self):
        view = self._getContext()
        try:
            root = self.getPhysicalRoot()
            here = view.context
        except AttributeError:
            # self has no attribute getPhysicalRoot.
            # This typically happens when the template has
            # no proper acquisition context. That means it has no view,
            # since that's the normal context for a template in Five. /regebro
            root = self.context.getPhysicalRoot()
            here = self.context
            view = None

        request = getattr(root, 'REQUEST', None)
        c = {
            'template': self,
            'here': here,
            'context': here,
            'container': self._getContainer(),
            'nothing': None,
            'options': {},
            'root': root,
            'request': request,
            'modules': ModuleImporter,
        }
        if view:
            c['view'] = view
            c['views'] = ViewMapper(here, request)

        return c
コード例 #2
0
ファイル: pagetemplatefile.py プロジェクト: bendavis78/zope
    def pt_getContext(self):
        try:
            root = self.getPhysicalRoot()
        except AttributeError:
            root = self.context.getPhysicalRoot()
        # Even if the context isn't a view (when would that be exaclty?),
        # there shouldn't be any dange in applying a view, because it
        # won't be used.  However assuming that a lack of getPhysicalRoot
        # implies a missing view causes problems.
        view = self._getContext()

        here = self.context.aq_inner

        request = getattr(root, 'REQUEST', None)
        c = {
            'template': self,
            'here': here,
            'context': here,
            'container': here,
            'nothing': None,
            'options': {},
            'root': root,
            'request': request,
            'modules': ModuleImporter,
        }
        if view is not None:
            c['view'] = view
            c['views'] = ViewMapper(here, request)

        return c
コード例 #3
0
    def _pt_getContext(self):
        try:
            root = self.getPhysicalRoot()
            view = self._getContext()
        except AttributeError:
            # self has no attribute getPhysicalRoot. This typically happens 
            # when the template has no proper acquisition context. 
            # That also means it has no view.  /regebro
            root = self.context.getPhysicalRoot()
            view = None

        here = self.context.aq_inner

        request = getattr(root, 'REQUEST', None)
        c = {'template': self,
             'here': here,
             'context': here,
             'container': here,
             'nothing': None,
             'options': {},
             'root': root,
             'request': request,
             'modules': ModuleImporter,
             }
        if view:
            c['view'] = view
            c['views'] = ViewMapper(here, request)

        return c