O'Reilly logo

Python 3 Web Development Beginner's Guide by Michel Anders

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

Time for action adding a new book

The screen to add a new book to the database is a simple form. What we need to implement is:

  • Some HTML to make it possible to display the form
  • A method in our CherryPy application that will produce this HTML
  • A method to process the input once this form is submitted

There is no need to implement two different methods here because based on the arguments passed to the method we can decide whether to return a form or to process the submitted contents of the same form. Although it may be considered bad form to design a method to do two things, it does keep related functionality together.

What just happened?

The addbookform class variable contains the template that refers to a number of string variables to interpolate. There ...

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