#! /usr/bin/python import types from base import NetMapObject class Owner( NetMapObject ): def __init__( self ): NetMapObject.__init__( self ) self.attribute_map = { 'first_name' :'^\w*$', 'last_name' :'^\w*$', 'email' :'^[\w-]*\@[\w.-]+', 'pager' :'^([\w-]*\@[\w.-]+|[\d-]*)$', 'phone' :'^[\d-]*$', 'wireless_phone' :'^[\d-]*$' } def commit( self ): print '''INSERT INTO owners (first_name, last_name, email, pager, phone, wireless_phone) VALUES (?,?,?,?,?,?)''' def search( email ): print '''SELECT * FROM owners WHERE email = ? ''' def print_table( owners ): print '''
' def print_rows( owners ): if type(owners) == types.ListType: for owner in owners: print_row( owner ) else: print_row( owners ) def print_row( owner ): print '