Open issac211 opened 3 years ago
Merging #302 (7ae0448) into develop (28e460d) will increase coverage by
0.00%
. The diff coverage is100.00%
.
@@ Coverage Diff @@
## develop #302 +/- ##
========================================
Coverage 98.76% 98.77%
========================================
Files 63 64 +1
Lines 2843 2863 +20
========================================
+ Hits 2808 2828 +20
Misses 35 35
Impacted Files | Coverage Δ | |
---|---|---|
app/main.py | 93.61% <100.00%> (+0.75%) |
:arrow_up: |
app/routers/global_variable.py | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 28e460d...cb0e0f9. Read the comment docs.
I find it a bit hard to understand what is the purpose of the feature. Can you please explain it in a nutshell?
Upload the connected user to a global variable So that all routers can access it without placing it in their variables. I therefore place the global variable outside the function of the router.
The router I added is for illustration purposes, so it's inside a demo folder.
https://github.com/PythonFreeCourse/calendar/pull/302#pullrequestreview-594867167 I hope it's clearer now,
in the tests\global_var_testing_routes.py you can see how the function 'set_global_user_var' can be used in the router.
I changed the code, and used the security module functions to make it more usable in the project. wen using the 'set_global_user_var' function the template will get the username if the user is logged in
So that this function can be used in routers that still want to identify if the user is connected but do not want to be redirected to the login page if not (This is how it was defined in the security module functions)
user global variable
Contains an example of how to use a global variable Once it is possible to see if a user is logged in, this method can be used in the code