Parameters: * ``pattern``: Regular expression to be matched. Any capturing groups in the regex will be passed in to the handler's get/post/etc methods as arguments (by keyword if named, by position if unnamed. Named and unnamed capturing groups may no
(
self,
pattern: Union[str, Pattern],
handler: Any,
kwargs: Optional[Dict[str, Any]] = None,
name: Optional[str] = None,
)
| 655 | """ |
| 656 | |
| 657 | def __init__( |
| 658 | self, |
| 659 | pattern: Union[str, Pattern], |
| 660 | handler: Any, |
| 661 | kwargs: Optional[Dict[str, Any]] = None, |
| 662 | name: Optional[str] = None, |
| 663 | ) -> None: |
| 664 | """Parameters: |
| 665 | |
| 666 | * ``pattern``: Regular expression to be matched. Any capturing |
| 667 | groups in the regex will be passed in to the handler's |
| 668 | get/post/etc methods as arguments (by keyword if named, by |
| 669 | position if unnamed. Named and unnamed capturing groups |
| 670 | may not be mixed in the same rule). |
| 671 | |
| 672 | * ``handler``: `~.web.RequestHandler` subclass to be invoked. |
| 673 | |
| 674 | * ``kwargs`` (optional): A dictionary of additional arguments |
| 675 | to be passed to the handler's constructor. |
| 676 | |
| 677 | * ``name`` (optional): A name for this handler. Used by |
| 678 | `~.web.Application.reverse_url`. |
| 679 | |
| 680 | """ |
| 681 | matcher = PathMatches(pattern) |
| 682 | super().__init__(matcher, handler, kwargs, name) |
| 683 | |
| 684 | self.regex = matcher.regex |
| 685 | self.handler_class = self.target |
| 686 | self.kwargs = kwargs |
| 687 | |
| 688 | def __repr__(self) -> str: |
| 689 | return "%s(%r, %s, kwargs=%r, name=%r)" % ( |
nothing calls this directly
no test coverage detected