O'Reilly logo

Spring Python 1.1 by Greg Lee Turnquist

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Building some basic customer functions

To get our bank site going, we need to start lettings customers open bank accounts. This is a feature only visible to customers.

  1. First, we need to update the main page, so when Alice the customer logs in, she has the option to open a bank account. We can do this by altering the index function in SpringBankView to offer options driven by the user's credentials.
    @cherrypy.expose def index(self, message=""): results = """ <h1>Welcome to SpringBank!</h1> <p> %s <p> """ % message if "ROLE_CUSTOMER" in \ SCH.getContext().authentication.granted_auths: results += """ <h2>Customer Options</h2> <ul> <li><a href="openAccount">Open Account</a></li> </ul> """ results += """ <a href="logout">Logout</a href> """ return results ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required