Lists and Items‎ > ‎

Step 3: The Class and Method Bridge

< Previous Step Next Step >


The functional centers are expressed in the form of methods and classes. Among these, the Handlers form a distinct group.


I associated render above with the home page. But, when I step over the next bridge, to a class and method outline, Python's object idiosyncrasies kick in. 'Class methods' are not normal in Python, so render needs to be an isolated function definition. Hence, my class and method outline is:

def render
   # renders home page

# handlers:
class HomePage
  def get
      # returns render's output

class CreateList
  def get
     # calls render with List form
  def post
     # creates a List

class CreateItem
  def get
     # calls render with Item form
  def post
     # creates an Item