Commit f79e5b3
authored
refactor(__init__.py): improve code readability and maintainability in FlaskMVC class and Hook class (#52)
In the FlaskMVC class:
- Change the variable name `view_func` to `instance_of_controller` to better reflect its purpose.
- Instead of calling `view_func()` multiple times, create an instance of the controller class and register it with the hook.
- Use the instance of the controller to retrieve the view function for each resource.
In the Hook class:
- Change the parameter name `ctrl` to `instance_of_controller` to better reflect its purpose.
- Use the instance of the controller to retrieve the hook methods.
These changes improve the readability and maintainability of the code by using more descriptive variable names and reducing code duplication.1 parent fba5dd0 commit f79e5b3
1 file changed
+11
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
| 44 | + | |
| 45 | + | |
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
| 59 | + | |
60 | 60 | | |
61 | 61 | | |
62 | 62 | | |
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
69 | | - | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
70 | 74 | | |
71 | 75 | | |
72 | | - | |
73 | | - | |
| 76 | + | |
74 | 77 | | |
75 | | - | |
| 78 | + | |
76 | 79 | | |
0 commit comments