Adding and editing values

Until now, we did not look closely at the Display class, although it is used in various incarnations within the application that we set up with CherryPy. The Display class combines a number of functions. It:

Until now, we did not look closely at the Display class, although it is used in various incarnations within the application that we set up with CherryPy. The Display class combines a number of functions. It:

  • Displays detailed values of an instance
  • Allows those values to be edited
  • Displays a form that allows us to add a completely new instance
  • Processes the input from the edit and add forms

The reason to bundle these functions is twofold: displaying the labels and values for reading, editing, or adding an instance shares a lot of common logic, and by processing the results within the same class method, we can refer to the action attribute of a<form> element in a way that allows us to mount an instance of the Display class from anywhere in the application tree.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.141.28.107