3. Visitor Accounts

def index():

  if not session.counter:

    session.counter = 1


    session.counter += 1

  return dict(msg="Python Zumbi", cont=session.counter)




    <h2>Visitors: {{=cont}}</h2>



3.1. Two pages

  • We will create two pages

  • The first asks for the name in a form

  • Then we will be redirected to the second

  • The second will give a greeting with the name

  • Include in the default.py controller

def first():

  return dict()

def second():

  return dict()
  • Create the default/first view

{{extend ‘layout.html’}}

What is your name?

<form action=”second”>

<input name=”name” />

<input type=”submit” />


  • Create the default/second view

{{extend ‘layout.html’}}

<h1>Hello {{=request.vars.name}}</h1>

3.2. Accessories

  • Web2py Appliances

  • Email Contact Form

  • Sudoku Solver

  • Train Counter Game

  • Quiz Builder

  • EcardsOnMap (it’s huge…)

You have attempted of activities on this page