Changeset 314 for trunk/docs


Ignore:
Timestamp:
Jan 6, 2007, 11:40:39 AM (13 years ago)
Author:
darcy
Message:

Add subclass example.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/pg.txt

    r287 r314  
    707707
    708708      print '%(foo)s %(bar)s' % r
     709
     710This class can be subclassed as in this example::
     711
     712  import pg
     713
     714  class DB_ride(pg.DB):
     715    """This class encapsulates the database functions and the specific
     716       methods for the ride database."""
     717
     718    def __init__(self):
     719        """Opens a database connection to the rides database"""
     720
     721        pg.DB.__init__(self, dbname = 'ride')
     722        self.query("""SET DATESTYLE TO 'ISO'""")
     723
     724    [Add or override methods here]
    709725
    710726The following describes the methods and variables of this class.
Note: See TracChangeset for help on using the changeset viewer.