コード例 #1
0
    def queryMethodID(self, alias, default=None, context=None):
        # Query method ID by alias.

        # Use "(dynamic view)" as the alias target to look up as per
        # defaultView()

        # Use "(selected layout)" as the alias target to look up as per
        # getViewMethod()

        methodTarget = FactoryTypeInformation.queryMethodID(self,
                                                            alias,
                                                            default=default,
                                                            context=context)
        if not isinstance(methodTarget, str):
            # nothing to do, method_id is probably None
            return methodTarget

        if context is None or default == '':
            # the edit zpts like typesAliases don't apply a context and set the
            # default to ''. We do not want to resolve (dynamic view) for these
            # methods.
            return methodTarget

        # Our two special targets:

        if methodTarget.lower() == "(dynamic view)":
            methodTarget = self.defaultView(context)

        if methodTarget.lower() == "(selected layout)":
            fallback = self.default_view_fallback
            methodTarget = self.getViewMethod(context, check_exists=fallback)

        return methodTarget
コード例 #2
0
ファイル: fti.py プロジェクト: nacho22martin/tesis
    def queryMethodID(self, alias, default=None, context=None):
        """ Query method ID by alias.

        Use "(dynamic view)" as the alias target to look up as per defaultView()
        Use "(selected layout)" as the alias target to look up as per
            getViewMethod()
        """
        methodTarget = FactoryTypeInformation.queryMethodID(self, alias,
                                                         default=default,
                                                         context=context)
        if not isinstance(methodTarget, basestring):
            # nothing to do, method_id is probably None
            return methodTarget

        if context is None or default == '':
            # the edit zpts like typesAliases don't apply a context and set the
            # default to ''. We do not want to resolve (dynamic view) for these
            # methods.
            return methodTarget

        # Our two special targets:

        if methodTarget.lower() == "(dynamic view)":
            methodTarget = self.defaultView(context)

        if methodTarget.lower() == "(selected layout)":
            fallback = self.default_view_fallback
            methodTarget = self.getViewMethod(context, check_exists=fallback)

        return methodTarget