From 179b45480a6ecd3bfbfabc395fb9fd7f6e33d1ef Mon Sep 17 00:00:00 2001 From: EdwardTL Date: Mon, 22 Jun 2020 18:53:10 -0500 Subject: [PATCH 1/3] Decora sin meter info de mas --- html_decorators.py | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) diff --git a/html_decorators.py b/html_decorators.py index 8d9c421..baeb481 100644 --- a/html_decorators.py +++ b/html_decorators.py @@ -1,22 +1,36 @@ def div(func): - # You have to code here! - pass + def wrapper(*args, **kwargs): + text_function = func(*args, **kwargs) + # func = func(*args, **kwargs) + print(f'
{text_function}
') + + return wrapper def article(func): - # You have to code here! - pass + def wrapper(*args, **kwargs): + text_function = func(*args, **kwargs) + # func = func(*args, **kwargs) + print(f'
{text_function}
') + return text_function + + return wrapper def p(func): - # You have to code here! - pass + def wrapper(*args, **kwargs): + text_function = func(*args, **kwargs) + # func = func(*args, **kwargs) + print(f'

{text_function}

') + return text_function + + return wrapper # Here you must apply the decorators, uncomment this later -# @div -# @article -# @p +@div +@article +@p def saludo(nombre): return f'¡Hola {nombre}, ¿Cómo estás?' From a2dd5c60e09f3955173d0f85e1afc17c316fe47b Mon Sep 17 00:00:00 2001 From: EdwardTL Date: Mon, 22 Jun 2020 23:56:17 -0500 Subject: [PATCH 2/3] =?UTF-8?q?Propuesta=20de=20soluci=C3=B3n=20al=20reto?= =?UTF-8?q?=2004.=20Atte.=20Edward-TL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html_decorators.py | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/html_decorators.py b/html_decorators.py index baeb481..5b4ca16 100644 --- a/html_decorators.py +++ b/html_decorators.py @@ -1,36 +1,36 @@ def div(func): def wrapper(*args, **kwargs): - text_function = func(*args, **kwargs) + text_function = func(args[0]) # func = func(*args, **kwargs) print(f'
{text_function}
') - - return wrapper + return text_function + return wrapper def article(func): def wrapper(*args, **kwargs): - text_function = func(*args, **kwargs) + text_function = func(args[0]) # func = func(*args, **kwargs) print(f'
{text_function}
') return text_function - + return wrapper def p(func): def wrapper(*args, **kwargs): - text_function = func(*args, **kwargs) - # func = func(*args, **kwargs) - print(f'

{text_function}

') - return text_function - - return wrapper - + text_function = func(args[0]) + # # func = func(*args, **kwargs) + # print(f'

{text_function}

') + # return text_function + return f'

{text_function}

' + return wrapper + # Here you must apply the decorators, uncomment this later -@div -@article @p +@article +@div def saludo(nombre): return f'¡Hola {nombre}, ¿Cómo estás?' From d57efe82157a168a84b75278471e8aef1a67adf6 Mon Sep 17 00:00:00 2001 From: EdwardTL Date: Mon, 22 Jun 2020 23:57:21 -0500 Subject: [PATCH 3/3] =?UTF-8?q?Propuesta=20de=20soluci=C3=B3n=20al=20reto?= =?UTF-8?q?=2004.=20Atte.=20Edward-TL?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- html_decorators.py | 5 ----- 1 file changed, 5 deletions(-) diff --git a/html_decorators.py b/html_decorators.py index 5b4ca16..a5bdde6 100644 --- a/html_decorators.py +++ b/html_decorators.py @@ -1,7 +1,6 @@ def div(func): def wrapper(*args, **kwargs): text_function = func(args[0]) - # func = func(*args, **kwargs) print(f'
{text_function}
') return text_function @@ -10,7 +9,6 @@ def wrapper(*args, **kwargs): def article(func): def wrapper(*args, **kwargs): text_function = func(args[0]) - # func = func(*args, **kwargs) print(f'
{text_function}
') return text_function @@ -20,9 +18,6 @@ def wrapper(*args, **kwargs): def p(func): def wrapper(*args, **kwargs): text_function = func(args[0]) - # # func = func(*args, **kwargs) - # print(f'

{text_function}

') - # return text_function return f'

{text_function}

' return wrapper