diff --git a/apps/_default/static/index.html b/apps/_default/static/index.html
index d672171d..b3df0406 100644
--- a/apps/_default/static/index.html
+++ b/apps/_default/static/index.html
@@ -58,7 +58,8 @@
WHAT IS PY4WEB?
$ py4web run apps # start py4web
-Each subfolder of apps/ with an __init__.py is its own app. One py4web can run multiple apps. You just copy the _scaffold app to make a new one.
+Each subfolder of apps/ with an __init__.py is its own app. One py4web can run multiple apps.
+You just copy the _scaffold app to make a new one.
@@ -89,7 +90,8 @@
WHAT IS PY4WEB?
- py4web uses a request object from
ombott, compatible with
bottlepy
+ py4web uses a request object from
ombott, compatible with
+
bottlepy
# http://127.0.0.1:8000/myapp/index/?x=1
@@ -100,7 +102,7 @@ WHAT IS PY4WEB?
- I can parse JSON from POST requests for example
+ It can parse JSON from POST requests for example
# http://127.0.0.1:8000/myapp/index POST {x: 1}
@@ -129,7 +131,10 @@ WHAT IS PY4WEB?
- We have a built-in session object which by default stores the session data, encrypted, in a cookie. Optionally it can be stored in db, redist, or other custom storage. Session is a fixture and it must be declared with
@action.uses. Think of fixtures as per action (as opposed to per app) middleware.
+ We have a built-in session object which by default stores the session data, signed, in a cookie. Optionally it can be stored in db, redis,
+ or other custom storage. Session is a
fixture
+ and it must be declared with
@action.uses.
+ Think of fixtures as per action (as opposed to per app) middleware.
@action("index")
@@ -163,7 +168,10 @@ x = [[=x]]
- Py4web comes with a built-in
auth object that generates all the pages required for user registration, login, email verification, retrieve and change password, edit profile, single sign on with OAuth2 and more.
auth is also a fixture which exposed the current user to the action. Notice that fixtures have dependencies and by including
auth its dependencies (db, session, flash).
+ Py4web comes with a built-in
auth object that generates all the pages
+ required for user registration, login, email verification, retrieve and change password, edit profile, single sign on with OAuth2 and more.
+
auth is also a fixture which exposed the current user to the action. Notice that fixtures have dependencies, and by including
+
auth its dependencies (db, session, flash) are also included automatically.
@action("index")
@@ -171,7 +179,7 @@ x = [[=x]]
def index():
user = auth.get_user()
if user:
- message = "Hello {first_name}".format(**user)
+ message = f"Hello {user['first_name']}"
else:
message = "Hello, you are not logged in"
return {"message": message}
@@ -185,12 +193,14 @@ x = [[=x]]
@action.uses("generic.html", auth.user)
def index():
user = auth.get_user()
- message = "Hello {first_name}".format(**user)
+ message = f"Hello {user['first_name']}"
return {"message": message}
- More complex policies are possible using the built-in
tagging system combined with
auth
+ More complex policies are possible using the built-in
tagging
+ system combined with
auth.
+
Condition is another fixture, if False it raises a 404 error page by default.
is_manager = Condition(lambda: "manager" in groups.get(auth.user_id))
@@ -199,7 +209,7 @@ x = [[=x]]
@action.uses("generic.html", auth.user, is_manager)
def index():
user = auth.get_user()
- message = "Hello {first_name} (manager!)".format(**user)
+ message = f"Hello {user['first_name']} (manager!)"
return {"message": message}
@@ -212,7 +222,7 @@
x = [[=x]]
db.define_table(
"thing",
Field("name", requires=IS_NOT_EMPTY()),
- Field("image", "upload", download_url = lambda fn: URL(f"download/{fn}"))
+ Field("image", "upload", download_url = lambda fn: URL(f"download/{fn}")),
auth.signature)