MCPcopy Create free account
hub / github.com/sqlmapproject/sqlmap / Route

Class Route

thirdparty/bottle/bottle.py:491–595  ·  view source on GitHub ↗

This class wraps a route callback along with route specific metadata and configuration and applies Plugins on demand. It is also responsible for turning an URL path rule into a regular expression usable by the Router.

Source from the content-addressed store, hash-verified

489
490
491class Route(object):
492 """ This class wraps a route callback along with route specific metadata and
493 configuration and applies Plugins on demand. It is also responsible for
494 turning an URL path rule into a regular expression usable by the Router.
495 """
496
497 def __init__(self, app, rule, method, callback,
498 name=None,
499 plugins=None,
500 skiplist=None, **config):
501 #: The application this route is installed to.
502 self.app = app
503 #: The path-rule string (e.g. ``/wiki/<page>``).
504 self.rule = rule
505 #: The HTTP method as a string (e.g. ``GET``).
506 self.method = method
507 #: The original callback with no plugins applied. Useful for introspection.
508 self.callback = callback
509 #: The name of the route (if specified) or ``None``.
510 self.name = name or None
511 #: A list of route-specific plugins (see :meth:`Bottle.route`).
512 self.plugins = plugins or []
513 #: A list of plugins to not apply to this route (see :meth:`Bottle.route`).
514 self.skiplist = skiplist or []
515 #: Additional keyword arguments passed to the :meth:`Bottle.route`
516 #: decorator are stored in this dictionary. Used for route-specific
517 #: plugin configuration and meta-data.
518 self.config = app.config._make_overlay()
519 self.config.load_dict(config)
520
521 @cached_property
522 def call(self):
523 """ The route callback with all plugins applied. This property is
524 created on demand and then cached to speed up subsequent requests."""
525 return self._make_callback()
526
527 def reset(self):
528 """ Forget any cached values. The next time :attr:`call` is accessed,
529 all plugins are re-applied. """
530 self.__dict__.pop('call', None)
531
532 def prepare(self):
533 """ Do all on-demand work immediately (useful for debugging)."""
534 self.call
535
536 def all_plugins(self):
537 """ Yield all Plugins affecting this route. """
538 unique = set()
539 for p in reversed(self.app.plugins + self.plugins):
540 if True in self.skiplist: break
541 name = getattr(p, 'name', False)
542 if name and (name in self.skiplist or name in unique): continue
543 if p in self.skiplist or type(p) in self.skiplist: continue
544 if name: unique.add(name)
545 yield p
546
547 def _make_callback(self):
548 callback = self.callback

Callers 1

decoratorMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…