当前位置: 首页>>代码示例>>Python>>正文


Python IMultiView.providedBy方法代码示例

本文整理汇总了Python中pyramid.interfaces.IMultiView.providedBy方法的典型用法代码示例。如果您正苦于以下问题:Python IMultiView.providedBy方法的具体用法?Python IMultiView.providedBy怎么用?Python IMultiView.providedBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pyramid.interfaces.IMultiView的用法示例。


在下文中一共展示了IMultiView.providedBy方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: run

# 需要导入模块: from pyramid.interfaces import IMultiView [as 别名]
# 或者: from pyramid.interfaces.IMultiView import providedBy [as 别名]
    def run(self):
        if len(self.args) < 2:
            self.out('Command requires a config file arg and a url arg')
            return 2
        config_uri = self.args[0]
        url = self.args[1]

        if not url.startswith('/'):
            url = '/%s' % url
        request = Request.blank(url)
        env = self.bootstrap[0](config_uri, options=parse_vars(self.args[2:]),
                                request=request)
        view = self._find_view(request)
        self.out('')
        self.out("URL = %s" % url)
        self.out('')
        if view is not None:
            self.out("    context: %s" % view.__request_attrs__['context'])
            self.out("    view name: %s" % view.__request_attrs__['view_name'])
        if IMultiView.providedBy(view):
            for dummy, view_wrapper, dummy in view.views:
                self.output_view_info(view_wrapper)
                if IMultiView.providedBy(view_wrapper):
                    for dummy, mv_view_wrapper, dummy in view_wrapper.views:
                        self.output_view_info(mv_view_wrapper, level=2)
        else:
            if view is not None:
                self.output_view_info(view)
            else:
                self.out("    Not found.")
        self.out('')
        env['closer']()
        return 0
开发者ID:7924102,项目名称:pyramid,代码行数:35,代码来源:pviews.py

示例2: command

# 需要导入模块: from pyramid.interfaces import IMultiView [as 别名]
# 或者: from pyramid.interfaces.IMultiView import providedBy [as 别名]
 def command(self):
     config_file, section_name, url = self.args
     if not url.startswith('/'):
         url = '/%s' % url
     app = self.get_app(config_file, section_name, loadapp=self.loadapp[0])
     registry = app.registry
     view = self._find_view(url, registry)
     self.out('')
     self.out("URL = %s" % url)
     self.out('')
     if view is not None:
         self.out("    context: %s" % view.__request_attrs__['context'])
         self.out("    view name: %s" % view.__request_attrs__['view_name'])
     if IMultiView.providedBy(view):
         for dummy, view_wrapper, dummy in view.views:
             self.output_view_info(view_wrapper)
             if IMultiView.providedBy(view_wrapper):
                 for dummy, mv_view_wrapper, dummy in view_wrapper.views:
                     self.output_view_info(mv_view_wrapper, level=2)
     else:
         if view is not None:
             self.output_view_info(view)
         else:
             self.out("    Not found.")
     self.out('')
开发者ID:gwho,项目名称:pyramid,代码行数:27,代码来源:paster.py

示例3: command

# 需要导入模块: from pyramid.interfaces import IMultiView [as 别名]
# 或者: from pyramid.interfaces.IMultiView import providedBy [as 别名]
 def command(self):
     config_uri, url = self.args
     if not url.startswith('/'):
         url = '/%s' % url
     env = self.bootstrap[0](config_uri)
     registry = env['registry']
     view = self._find_view(url, registry)
     self.out('')
     self.out("URL = %s" % url)
     self.out('')
     if view is not None:
         self.out("    context: %s" % view.__request_attrs__['context'])
         self.out("    view name: %s" % view.__request_attrs__['view_name'])
     if IMultiView.providedBy(view):
         for dummy, view_wrapper, dummy in view.views:
             self.output_view_info(view_wrapper)
             if IMultiView.providedBy(view_wrapper):
                 for dummy, mv_view_wrapper, dummy in view_wrapper.views:
                     self.output_view_info(mv_view_wrapper, level=2)
     else:
         if view is not None:
             self.output_view_info(view)
         else:
             self.out("    Not found.")
     self.out('')
开发者ID:MattBurgess,项目名称:pyramid,代码行数:27,代码来源:paster.py

示例4: run

# 需要导入模块: from pyramid.interfaces import IMultiView [as 别名]
# 或者: from pyramid.interfaces.IMultiView import providedBy [as 别名]
 def run(self):
     if len(self.args) < 2:
         self.out("Command requires a config file arg and a url arg")
         return 2
     config_uri, url = self.args
     if not url.startswith("/"):
         url = "/%s" % url
     env = self.bootstrap[0](config_uri)
     registry = env["registry"]
     view = self._find_view(url, registry)
     self.out("")
     self.out("URL = %s" % url)
     self.out("")
     if view is not None:
         self.out("    context: %s" % view.__request_attrs__["context"])
         self.out("    view name: %s" % view.__request_attrs__["view_name"])
     if IMultiView.providedBy(view):
         for dummy, view_wrapper, dummy in view.views:
             self.output_view_info(view_wrapper)
             if IMultiView.providedBy(view_wrapper):
                 for dummy, mv_view_wrapper, dummy in view_wrapper.views:
                     self.output_view_info(mv_view_wrapper, level=2)
     else:
         if view is not None:
             self.output_view_info(view)
         else:
             self.out("    Not found.")
     self.out("")
     return 0
开发者ID:replaceafill,项目名称:pyramid,代码行数:31,代码来源:pviews.py

示例5: test__find_view_route_multiview_no_view_registered

# 需要导入模块: from pyramid.interfaces import IMultiView [as 别名]
# 或者: from pyramid.interfaces.IMultiView import providedBy [as 别名]
 def test__find_view_route_multiview_no_view_registered(self):
     from zope.interface import Interface
     from zope.interface import implementer
     from pyramid.interfaces import IRouteRequest
     from pyramid.interfaces import IMultiView
     from pyramid.interfaces import IRootFactory
     from pyramid.registry import Registry
     registry = Registry()
     def view1():pass
     def view2():pass
     class IMyRoot(Interface):
         pass
     class IMyRoute1(Interface):
         pass
     class IMyRoute2(Interface):
         pass
     registry.registerUtility(IMyRoute1, IRouteRequest, name='a')
     registry.registerUtility(IMyRoute2, IRouteRequest, name='b')
     @implementer(IMyRoot)
     class Factory(object):
         def __init__(self, request):
             pass
     registry.registerUtility(Factory, IRootFactory)
     routes = [dummy.DummyRoute('a', '/a', matchdict={}),
               dummy.DummyRoute('b', '/a', matchdict={})]
     self._register_mapper(registry, routes)
     command = self._makeOne(registry=registry)
     result = command._find_view('/a', registry)
     self.assertTrue(IMultiView.providedBy(result))
开发者ID:HorizonXP,项目名称:pyramid,代码行数:31,代码来源:test_pviews.py

示例6: output_view_info

# 需要导入模块: from pyramid.interfaces import IMultiView [as 别名]
# 或者: from pyramid.interfaces.IMultiView import providedBy [as 别名]
 def output_view_info(self, view_wrapper, level=1):
     indent = "    " * level
     name = getattr(view_wrapper, '__name__', '')
     module = getattr(view_wrapper, '__module__', '')
     attr = getattr(view_wrapper, '__view_attr__', None)
     request_attrs = getattr(view_wrapper, '__request_attrs__', {})
     if attr is not None:
         view_callable = "%s.%s.%s" % (module, name, attr)
     else:
         attr = view_wrapper.__class__.__name__
         if attr == 'function':
             attr = name
         view_callable = "%s.%s" % (module, attr)
     self.out('')
     if 'matched_route' in request_attrs:
         self.out("%sRoute:" % indent)
         self.out("%s------" % indent)
         self.output_route_attrs(request_attrs, indent)
         permission = getattr(view_wrapper, '__permission__', None)
         if not IMultiView.providedBy(view_wrapper):
             # single view for this route, so repeat call without route data
             del request_attrs['matched_route']
             self.output_view_info(view_wrapper, level + 1)
     else:
         self.out("%sView:" % indent)
         self.out("%s-----" % indent)
         self.out("%s%s" % (indent, view_callable))
         permission = getattr(view_wrapper, '__permission__', None)
         if permission is not None:
             self.out("%srequired permission = %s" % (indent, permission))
         predicates = getattr(view_wrapper, '__predicates__', None)
         if predicates is not None:
             predicate_text = ', '.join([p.text() for p in predicates])
             self.out("%sview predicates (%s)" % (indent, predicate_text))
开发者ID:7924102,项目名称:pyramid,代码行数:36,代码来源:pviews.py

示例7: getEndpoints

# 需要导入模块: from pyramid.interfaces import IMultiView [as 别名]
# 或者: from pyramid.interfaces.IMultiView import providedBy [as 别名]
  def getEndpoints(self, options, context):

    if isstr(options.view) and self.settings.config:
      # TODO: is this the "right" way?...
      # TODO: DRY... see cli.py!
      from pyramid.scripts.pviews import PViewsCommand
      pvcomm = PViewsCommand([])
      options.view = pvcomm._find_view(options.view, self.settings.config.registry)

    # todo: remove requirement on a single view...
    if IMultiView.providedBy(options.view):
      options.view = options.view.views[0][1]

    # TODO: add support for any kind of view_callable...
    if not isinstance(options.view, Controller):
      try:
        # TODO: this is *ridiculous*... it is extracting the controller from
        #       the closure... ugh. *obviously* not the right way...
        options.view = options.view.__closure__[1].cell_contents.__wraps__.__closure__[0].cell_contents
        # TODO: handle case where options.view is a subclass (but not instance) of Controller...
        if not isinstance(options.view, Controller):
          raise TypeError('not a controller: %r', options.view)
      except Exception:
        log.exception('invalid target for pyramid-describe: %r', options.view)
        raise TypeError(_('the URL "{}" does not point to a pyramid_controllers.Controller', options.root))
    # todo: further decorate `context`...
    for entry in self._walkEntries(options, None):
      if entry.methods:
        entry.methods = filter(None, [
          options.eparsers.filter(e, context)
          for e in entry.methods])
        entry.methods = sorted(entry.methods, key=self.methOrderKey)
      entry = options.eparsers.filter(entry, context)
      if entry:
        yield entry
开发者ID:cadithealth,项目名称:pyramid_describe,代码行数:37,代码来源:describer.py

示例8: test__find_view_route_multiview

# 需要导入模块: from pyramid.interfaces import IMultiView [as 别名]
# 或者: from pyramid.interfaces.IMultiView import providedBy [as 别名]
    def test__find_view_route_multiview(self):
        from zope.interface import Interface
        from zope.interface import implementer
        from pyramid.interfaces import IRouteRequest
        from pyramid.interfaces import IViewClassifier
        from pyramid.interfaces import IView
        from pyramid.interfaces import IMultiView
        from pyramid.interfaces import IRootFactory
        from pyramid.registry import Registry

        registry = Registry()

        def view1():  # pragma: no cover
            pass

        def view2():  # pragma: no cover
            pass

        class IMyRoot(Interface):
            pass

        class IMyRoute1(Interface):
            pass

        class IMyRoute2(Interface):
            pass

        registry.registerAdapter(
            view1, (IViewClassifier, IMyRoute1, IMyRoot), IView, ''
        )
        registry.registerAdapter(
            view2, (IViewClassifier, IMyRoute2, IMyRoot), IView, ''
        )
        registry.registerUtility(IMyRoute1, IRouteRequest, name='a')
        registry.registerUtility(IMyRoute2, IRouteRequest, name='b')

        @implementer(IMyRoot)
        class Factory(object):
            def __init__(self, request):
                pass

        registry.registerUtility(Factory, IRootFactory)
        routes = [
            dummy.DummyRoute('a', '/a', matchdict={}),
            dummy.DummyRoute('b', '/a', matchdict={}),
        ]
        self._register_mapper(registry, routes)
        command = self._makeOne(registry=registry)
        request = self._makeRequest('/a', registry)
        result = command._find_view(request)
        self.assertTrue(IMultiView.providedBy(result))
        self.assertEqual(len(result.views), 2)
        self.assertTrue((None, view1, None) in result.views)
        self.assertTrue((None, view2, None) in result.views)
开发者ID:Pylons,项目名称:pyramid,代码行数:56,代码来源:test_pviews.py

示例9: _find_view

# 需要导入模块: from pyramid.interfaces import IMultiView [as 别名]
# 或者: from pyramid.interfaces.IMultiView import providedBy [as 别名]
    def _find_view(self, request):
        """
        Accept ``url`` and ``registry``; create a :term:`request` and
        find a :app:`Pyramid` view based on introspection of :term:`view
        configuration` within the application registry; return the view.
        """
        from zope.interface import providedBy
        from zope.interface import implementer
        from pyramid.interfaces import IRequest
        from pyramid.interfaces import IRootFactory
        from pyramid.interfaces import IRouteRequest
        from pyramid.interfaces import IRoutesMapper
        from pyramid.interfaces import ITraverser
        from pyramid.traversal import DefaultRootFactory
        from pyramid.traversal import ResourceTreeTraverser

        registry = request.registry
        q = registry.queryUtility
        root_factory = q(IRootFactory, default=DefaultRootFactory)
        routes_mapper = q(IRoutesMapper)

        adapters = registry.adapters

        @implementer(IMultiView)
        class RoutesMultiView(object):

            def __init__(self, infos, context_iface, root_factory, request):
                self.views = []
                for info in infos:
                    match, route = info['match'], info['route']
                    if route is not None:
                        request_iface = registry.queryUtility(
                            IRouteRequest,
                            name=route.name,
                            default=IRequest)
                        views = _find_views(
                            request.registry,
                            request_iface,
                            context_iface,
                            ''
                            )
                        if not views:
                            continue
                        view = views[0]
                        view.__request_attrs__ = {}
                        view.__request_attrs__['matchdict'] = match
                        view.__request_attrs__['matched_route'] = route
                        root_factory = route.factory or root_factory
                        root = root_factory(request)
                        traverser = adapters.queryAdapter(root, ITraverser)
                        if traverser is None:
                            traverser = ResourceTreeTraverser(root)
                        tdict = traverser(request)
                        view.__request_attrs__.update(tdict)
                        if not hasattr(view, '__view_attr__'):
                            view.__view_attr__ = ''
                        self.views.append((None, view, None))

        context = None
        routes_multiview = None
        attrs = request.__dict__
        request_iface = IRequest

        # find the root object
        if routes_mapper is not None:
            infos = self._find_multi_routes(routes_mapper, request)
            if len(infos) == 1:
                info = infos[0]
                match, route = info['match'], info['route']
                if route is not None:
                    attrs['matchdict'] = match
                    attrs['matched_route'] = route
                    request.environ['bfg.routes.matchdict'] = match
                    request_iface = registry.queryUtility(
                        IRouteRequest,
                        name=route.name,
                        default=IRequest)
                    root_factory = route.factory or root_factory
            if len(infos) > 1:
                routes_multiview = infos

        root = root_factory(request)
        attrs['root'] = root

        # find a context
        traverser = adapters.queryAdapter(root, ITraverser)
        if traverser is None:
            traverser = ResourceTreeTraverser(root)
        tdict = traverser(request)
        context, view_name = (tdict['context'], tdict['view_name'])

        attrs.update(tdict)

        # find a view callable
        context_iface = providedBy(context)
        if routes_multiview is None:
            views = _find_views(
                request.registry,
                request_iface,
                context_iface,
#.........这里部分代码省略.........
开发者ID:7924102,项目名称:pyramid,代码行数:103,代码来源:pviews.py

示例10: _find_view

# 需要导入模块: from pyramid.interfaces import IMultiView [as 别名]
# 或者: from pyramid.interfaces.IMultiView import providedBy [as 别名]
    def _find_view(self, url, registry):
        """
        Accept ``url`` and ``registry``; create a :term:`request` and
        find a :app:`Pyramid` view based on introspection of :term:`view
        configuration` within the application registry; return the view.
        """
        from zope.interface import providedBy
        from zope.interface import implements
        from pyramid.interfaces import IRequest
        from pyramid.interfaces import IRootFactory
        from pyramid.interfaces import IRouteRequest
        from pyramid.interfaces import IRequestFactory
        from pyramid.interfaces import IRoutesMapper
        from pyramid.interfaces import IView
        from pyramid.interfaces import IViewClassifier
        from pyramid.interfaces import ITraverser
        from pyramid.request import Request
        from pyramid.traversal import DefaultRootFactory
        from pyramid.traversal import ResourceTreeTraverser
            
        q = registry.queryUtility
        root_factory = q(IRootFactory, default=DefaultRootFactory)
        routes_mapper = q(IRoutesMapper)
        request_factory = q(IRequestFactory, default=Request)

        adapters = registry.adapters
        request = None

        class RoutesMultiView(object):
            implements(IMultiView)

            def __init__(self, infos, context_iface, root_factory, request):
                self.views = []
                for info in infos:
                    match, route = info['match'], info['route']
                    if route is not None:
                        request_iface = registry.queryUtility(
                            IRouteRequest,
                            name=route.name,
                            default=IRequest)
                        view = adapters.lookup(
                            (IViewClassifier, request_iface, context_iface),
                            IView, name='', default=None)
                        if view is None:
                            continue
                        view.__request_attrs__ = {}
                        view.__request_attrs__['matchdict'] = match
                        view.__request_attrs__['matched_route'] = route
                        root_factory = route.factory or root_factory
                        root = root_factory(request)
                        traverser = adapters.queryAdapter(root, ITraverser)
                        if traverser is None:
                            traverser = ResourceTreeTraverser(root)
                        tdict = traverser(request)
                        view.__request_attrs__.update(tdict)
                        if not hasattr(view, '__view_attr__'):
                            view.__view_attr__ = ''
                        self.views.append((None, view, None))


        # create the request
        environ = {
            'wsgi.url_scheme':'http',
            'SERVER_NAME':'localhost',
            'SERVER_PORT':'8080',
            'REQUEST_METHOD':'GET',
            'PATH_INFO':url,
            }
        request = request_factory(environ)
        context = None
        routes_multiview = None
        attrs = request.__dict__
        attrs['registry'] = registry
        request_iface = IRequest

        # find the root object
        if routes_mapper is not None:
            infos = self._find_multi_routes(routes_mapper, request)
            if len(infos) == 1:
                info = infos[0]
                match, route = info['match'], info['route']
                if route is not None:
                    attrs['matchdict'] = match
                    attrs['matched_route'] = route
                    request.environ['bfg.routes.matchdict'] = match
                    request_iface = registry.queryUtility(
                        IRouteRequest,
                        name=route.name,
                        default=IRequest)
                    root_factory = route.factory or root_factory
            if len(infos) > 1:
                routes_multiview = infos

        root = root_factory(request)
        attrs['root'] = root

        # find a context
        traverser = adapters.queryAdapter(root, ITraverser)
        if traverser is None:
            traverser = ResourceTreeTraverser(root)
#.........这里部分代码省略.........
开发者ID:gwho,项目名称:pyramid,代码行数:103,代码来源:paster.py

示例11: register

# 需要导入模块: from pyramid.interfaces import IMultiView [as 别名]
# 或者: from pyramid.interfaces.IMultiView import providedBy [as 别名]

#.........这里部分代码省略.........
        # for the required and provided arguments, returning only a
        # view registered previously with the *exact* triad we pass
        # in.

        # We need to do this three times, because we use three
        # different interfaces as the ``provided`` interface while
        # doing registrations, and ``registered`` performs exact
        # matches on all the arguments it receives.

        old_view = None

        for view_type in (IView, ISecuredView, IMultiView):
            old_view = registered((IViewClassifier, request_iface,
                                   r_context), view_type, name)
            if old_view is not None:
                break

        isexc = isexception(context)

        def regclosure():
            if hasattr(derived_view, '__call_permissive__'):
                view_iface = ISecuredView
            else:
                view_iface = IView
            self.registry.registerAdapter(
                derived_view,
                (IViewClassifier, request_iface, context), view_iface, name
                )
            if isexc:
                self.registry.registerAdapter(
                    derived_view,
                    (IExceptionViewClassifier, request_iface, context),
                    view_iface, name)

        is_multiview = IMultiView.providedBy(old_view)
        old_phash = getattr(old_view, '__phash__', DEFAULT_PHASH)

        if old_view is None:
            # - No component was yet registered for any of our I*View
            #   interfaces exactly; this is the first view for this
            #   triad.
            regclosure()

        elif (not is_multiview) and (old_phash == phash):
            # - A single view component was previously registered with
            #   the same predicate hash as this view; this registration
            #   is therefore an override.
            regclosure()

        else:
            # - A view or multiview was already registered for this
            #   triad, and the new view is not an override.

            # XXX we could try to be more efficient here and register
            # a non-secured view for a multiview if none of the
            # multiview's consituent views have a permission
            # associated with them, but this code is getting pretty
            # rough already
            if is_multiview:
                multiview = old_view
            else:
                multiview = MultiView(name)
                old_accept = getattr(old_view, '__accept__', None)
                old_order = getattr(old_view, '__order__', MAX_ORDER)
                multiview.add(old_view, old_order, old_accept, old_phash)
            multiview.add(derived_view, order, accept, phash)
            for view_type in (IView, ISecuredView):
                # unregister any existing views
                self.registry.adapters.unregister(
                    (IViewClassifier, request_iface, r_context),
                    view_type, name=name)
                if isexc:
                    self.registry.adapters.unregister(
                        (IExceptionViewClassifier, request_iface,
                         r_context), view_type, name=name)
            self.registry.registerAdapter(
                multiview,
                (IViewClassifier, request_iface, context),
                IMultiView, name=name)
            if isexc:
                self.registry.registerAdapter(
                    multiview,
                    (IExceptionViewClassifier, request_iface, context),
                    IMultiView, name=name)
        renderer_type = getattr(renderer, 'type', None) # gard against None
        intrspc = self.introspector
        if (
            renderer_type is not None and
            tmpl_intr is not None and
            intrspc is not None and
            intrspc.get('renderer factories', renderer_type) is not None
            ):
            # allow failure of registered template factories to be deferred
            # until view execution, like other bad renderer factories; if
            # we tried to relate this to an existing renderer factory
            # without checking if it the factory actually existed, we'd end
            # up with a KeyError at startup time, which is inconsistent
            # with how other bad renderer registrations behave (they throw
            # a ValueError at view execution time)
            tmpl_intr.relate('renderer factories', renderer.type)
开发者ID:uruz,项目名称:pyramid_asyncio,代码行数:104,代码来源:config.py

示例12: run

# 需要导入模块: from pyramid.interfaces import IMultiView [as 别名]
# 或者: from pyramid.interfaces.IMultiView import providedBy [as 别名]
    def run(self, quiet=False):
        if not self.args:
            self.out('requires a config file argument')
            return 2

        from pyramid.interfaces import IRouteRequest
        from pyramid.interfaces import IViewClassifier
        from pyramid.interfaces import IView
        from pyramid.interfaces import IMultiView

        from zope.interface import Interface
        config_uri = self.args[0]

        env = self.bootstrap[0](config_uri, options=parse_vars(self.args[1:]))
        registry = env['registry']
        mapper = self._get_mapper(registry)
        if mapper is not None:
            mapped_routes = [('Name', 'Pattern', 'View')]

            max_name = len('Name')
            max_pattern = len('Pattern')
            max_view = len('View')

            routes = mapper.get_routes()

            if not routes:
                return 0

            mapped_routes.append((
                '-' * max_name,
                '-' * max_pattern,
                '-' * max_view,
            ))

            for route in routes:
                pattern = route.pattern
                if not pattern.startswith('/'):
                    pattern = '/' + pattern
                request_iface = registry.queryUtility(IRouteRequest,
                                                      name=route.name)
                view_callable = None

                if (request_iface is None) or (route.factory is not None):
                    view_callable = '<unknown>'
                else:
                    view_callable = registry.adapters.lookup(
                        (IViewClassifier, request_iface, Interface),
                        IView, name='', default=None)

                    if view_callable is not None:
                        if IMultiView.providedBy(view_callable):
                            view_callables = [
                                x[1] for x in view_callable.views
                            ]
                        else:
                            view_callables = [view_callable]

                        for view_func in view_callables:
                            view_callable = '%s.%s' % (
                                view_func.__module__,
                                view_func.__name__,
                            )
                    else:
                        view_callable = str(None)

                if len(route.name) > max_name:
                    max_name = len(route.name)

                if len(pattern) > max_pattern:
                    max_pattern = len(pattern)

                if len(view_callable) > max_view:
                    max_view = len(view_callable)

                mapped_routes.append((route.name, pattern, view_callable))

            fmt = '%-{0}s %-{1}s %-{2}s'.format(
                max_name + PAD,
                max_pattern + PAD,
                max_view + PAD,
            )

            for route_data in mapped_routes:
                self.out(fmt % route_data)

        return 0
开发者ID:AdrianTeng,项目名称:pyramid,代码行数:88,代码来源:proutes.py


注:本文中的pyramid.interfaces.IMultiView.providedBy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。