Logo Search packages:      
Sourcecode: zope-cmfdynamicviewfti version File versions  Download package

def CMFDynamicViewFTI::fti::DynamicViewTypeInformation::getViewMethod (   self,
  context,
  enforce_available = False 
)

Get view method (aka layout) name from context

Return -- view method from context or default view name

Definition at line 116 of file fti.py.

00116                                                                :
        """Get view method (aka layout) name from context

        Return -- view method from context or default view name
        """
        default = self.default_view
        layout = getattr(aq_base(context), 'layout', None)

        if layout is not None:
            if safe_callable(layout):
                layout = layout()
            if not isinstance(layout, basestring):
                raise TypeError, "layout of %s must be a string, got %s" % (
                                  repr(context), type(layout))
            if enforce_available:
                available = self.getAvailableViewMethods(context)
                if layout in available:
                    return layout
                else:
                    return default
            else:
                return layout
        else:
            return default

    security.declareProtected(View, 'getDefaultViewMethod')
    def getDefaultViewMethod(self, context):


Generated by  Doxygen 1.6.0   Back to index