Python Forum
function-decorator , which is checking an access according to USERNAME
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
function-decorator , which is checking an access according to USERNAME
#7
No, it does not work correctly. Try this:
@is_auth
@has_access
def from_db():
    print("some data from database")
 
@has_access
def open_forum():
    print("log onto the forum")
 
from_db()
open_forum()
calling from_db() and open_forum() should each ask if you want to enter credentials. Your code works for one test, it needs to work for all tests.
Reply


Messages In This Thread
RE: function-decorator , which is checking an access according to USERNAME - by deanhystad - Feb-17-2024, 03:36 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python code tp determin a userName and print message jackAmin 4 1,869 Nov-20-2022, 12:03 AM
Last Post: rob101
  Help! Chatting App - Changing the "IP & Port" into Username Rowan99 0 1,426 Dec-20-2021, 07:02 AM
Last Post: Rowan99
  Decorator for a function with argument(s) banidjamali 1 1,860 Feb-09-2021, 11:55 AM
Last Post: Gribouillis
  i got a decorator question yosef 3 2,623 Aug-25-2020, 04:14 PM
Last Post: DeaD_EyE
  Decorator is using in class,but not working mbilalshafiq 2 2,150 Jul-04-2020, 08:53 PM
Last Post: mbilalshafiq
  Decorator and namespace. JayIvhen 2 2,812 Oct-26-2018, 03:56 PM
Last Post: nilamo
  Password and Username Verification AlwaysNew 4 17,234 Nov-12-2017, 11:51 AM
Last Post: wavic
  Username and password Steve2017 13 9,947 Sep-03-2017, 09:17 PM
Last Post: Steve2017
  python decorator alfredocabrera 0 3,158 Feb-22-2017, 07:04 AM
Last Post: alfredocabrera

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020