Back to Examples Run this application locally to try examples

examples/count.py

import os

from yatl.helpers import BODY, H1, HTML, A

from py4web import URL, action

from .common import T


@action("count")
@action("count/<number:int>")
@action.uses(T)
def count(number=1):
    message = T("Cat").format(n=number)
    link = A(T("more"), _href=URL("count/%s" % (number + 1)))
    return HTML(BODY(H1(message, " ", link))).xml()