Fixes in documentation
This commit is contained in:
parent
cfb70403c1
commit
dc58175760
13 changed files with 119 additions and 113 deletions
|
|
@ -6,22 +6,23 @@ login_name='login'
|
|||
login_url='.login'
|
||||
|
||||
def db(f):
|
||||
"""Wrapper function for add db connection to your flask function
|
||||
|
||||
Wrapper function for add db connection to your flask function. Also close the connection if error or function exection is finished.
|
||||
|
||||
Args:
|
||||
*args : The args of function
|
||||
**kwds : Standard python extra arguments of function
|
||||
|
||||
Returns:
|
||||
wrapper (function): Return the wrapper.
|
||||
"""
|
||||
|
||||
@wraps(f)
|
||||
|
||||
def wrapper(*args, **kwds):
|
||||
|
||||
"""Wrapper function for add db connection to your flask function
|
||||
|
||||
Wrapper function for add db connection to your flask function. Also close the connection if error or function exection is finished.
|
||||
|
||||
Args:
|
||||
*args (mixed): The args of function
|
||||
**kwds (mixed): Standard python extra arguments of function
|
||||
|
||||
Returns:
|
||||
wrapper (function): Return the wrapper.
|
||||
"""
|
||||
|
||||
g.connection=WebModel.connection()
|
||||
|
||||
try:
|
||||
|
|
@ -41,22 +42,24 @@ def db(f):
|
|||
return wrapper
|
||||
|
||||
def login_site(f):
|
||||
"""Wrapper function for check login in your flask function
|
||||
|
||||
Wrapper function for check a login session in your flask function. If
|
||||
|
||||
Args:
|
||||
*args : The args of function
|
||||
**kwds : Standard python extra arguments of function
|
||||
|
||||
Returns:
|
||||
wrapper (function): Return the wrapper.
|
||||
"""
|
||||
|
||||
@wraps(f)
|
||||
|
||||
def wrapper(*args, **kwds):
|
||||
|
||||
"""Wrapper function for check login in your flask function
|
||||
|
||||
Wrapper function for check a login session in your flask function. If
|
||||
|
||||
Args:
|
||||
*args : The args of function
|
||||
**kwds : Standard python extra arguments of function
|
||||
|
||||
Returns:
|
||||
wrapper (function): Return the wrapper.
|
||||
"""
|
||||
|
||||
|
||||
if not login_name in session:
|
||||
|
||||
return redirect(url_for(login_url))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue