Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02bfb72

Browse files
committed
update day 56 program
1 parent 4875f48 commit 02bfb72

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

055-day/program_69.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
1-
## Advanced python decorator function
1+
## Advanced Python Decorator Functions
22

33
class User:
4-
def __init__(self, name) -> None:
4+
def __init__(self, name):
55
self.name = name
66
self.is_logged_in = False
7-
8-
def is_authenticated_decorator(function):
9-
def wrapper(*args, **kwargs):
7+
8+
def is_authenticated_decorator(function):
9+
def wrapper(*args, **kwargs):
1010
if args[0].is_logged_in == True:
11-
function()
12-
return wrapper()
13-
11+
function(args[0])
12+
return wrapper
13+
1414
@is_authenticated_decorator
1515
def create_blog_post(user):
16-
print(f"This is {user.name}'s ne blog post")
17-
18-
19-
new_user = User("albin")
20-
new_user.create_blog_post(new_user)
16+
print(f"This is {user.name}'s new blog post.")
17+
18+
new_user = User("angela")
19+
new_user.is_logged_in = True
20+
create_blog_post(new_user)

0 commit comments

Comments
 (0)