We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 93b4e16 commit ccc17b4Copy full SHA for ccc17b4
patterns/structural/mvc.py
@@ -120,16 +120,16 @@ def __init__(self):
120
self.routes: dict = {}
121
122
def register(self, path: str, controller_class: object, model_class: object, view_class: object) -> None:
123
- model_instance: object = model_class()
124
- view_instance: object = view_class()
+ model_instance = model_class()
+ view_instance = view_class()
125
self.routes[path] = controller_class(model_instance, view_instance)
126
127
def resolve(self, path: str) -> Controller:
128
if self.routes.get(path):
129
- controller_class: object = self.routes[path]
130
- return controller_class
+ controller: Controller = self.routes[path]
+ return controller
131
else:
132
- returnNone
+ raiseKeyError(f"No controller registered for path '{path}'")
133
134
135
def main():
AltStyle によって変換されたページ (->オリジナル) / アドレス: モード: デフォルト 音声ブラウザ ルビ付き 配色反転 文字拡大 モバイル
0 commit comments