Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Three small changes in documentation #34

Open
wants to merge 5 commits into
from

uUsing subapplications

Other languages français | ...

import web
urls = (
  "", "reblog",
  "/(.*)", "blog"
)

class reblog:
    def GET(self): raise web.seeother('/')

class blog:
    def GET(self, path):
        return "blog " + path

app_blog = web.application(urls, locals())

Note that if you are using WSGI, you must not append .wsgifunc() to any of the app definitions, only to the main code.py.

In your main code.py:

@@ -3,7 +3,7 @@ layout: default
title: using subapplications
---
-# using subapplications
+# Using subapplications
Other languages [français](/../cookbook/subapp/fr) | ...
@@ -30,6 +30,8 @@ In `blog.py`:
app_blog = web.application(urls, locals())
+Note that if you are using WSGI, you must not append `.wsgifunc()` to any of the app definitions, only to the main `code.py`.
+
In your main `code.py`:
import web
@@ -46,4 +48,4 @@ In your main `code.py`:
app = web.application(urls, locals())
if __name__ == "__main__":
- app.run()
+ app.run()
View
@@ -153,7 +153,7 @@ and change the definition of `index.GET` to:
and delete the line setting name. Now visit `/Joe` and it should say hello to Joe.
-If you wish to learn more about web.py templates, vist the <a href="/docs/0.3/templetor">templetor page</a>.
+If you wish to learn more about web.py templates, visit the <a href="/docs/0.3/templetor">templetor page</a>.
<a name="forms"> </a>
## Forms
View
@@ -33,6 +33,8 @@ The form module defines 2 primary classes: the Form class, and the Input class.
A basic login form would look like this:
+ from web import form
+
login = form.Form(
form.Textbox('username'),
form.Password('password'),
@@ -158,4 +160,4 @@ And sample formtest.html (place this in the *templates* subdirectory):
<form name="main" method="post">
$if not form.valid: <p class="error">Try again, AmeriCAN:</p>
$:form.render()
- <input type="submit" /> </form>
+ <input type="submit" /> </form>