Exemplo n.º 1
0
    def __init__(self, db, table, id, primary_key='id'):
        '''Create a Record Object given
              a vlib.db Object, a table name, and a record Id

           id column can also be an sql where clause, like
               'order_no="TC-100903401"'

           Meant to be subclassed, as follows:

           from datarecord import DataRecord

           class User(DataRecord):
              def __init__(self, id):
                 DataRecord.__init__(db.getInstance(), 'user', id)

           u = User(1)
           print u.name

           u2 = User("name='Fernandez'")
           print u2.phone

        '''
        self.db    = db      
        self.table = table
        self.id    = id
        self.primary_key = primary_key

        DataTable.__init__(self, db, table)
        self.debug_sql = DEBUG
        self._loadData()
Exemplo n.º 2
0
 def __init__ (self, db, tablename, id_field=None):
     '''Given a db connection, and a table name, that conforms to the
        Attributes Model load data.
     '''
     DataTable.__init__(self, db, tablename)
     self.id_field = id_field if id_field \
                     else plural2singular(tablename) + '_id'
     self._loadTable()
     self._setConstants()
Exemplo n.º 3
0
 def __init__(self, db, tablename, id_field=None):
     '''Given a db connection, and a table name, that conforms to the
        Attributes Model load data.
     '''
     DataTable.__init__(self, db, tablename)
     self.id_field = id_field if id_field \
                     else plural2singular(tablename) + '_id'
     self._loadTable()
     self._setConstants()
Exemplo n.º 4
0
    def __init__(self, db, table, id):
        '''Create a Record Object given
              a vlib.db Object, a table name, and a record Id

           Meant to be subclassed, as follows:

           class user(Record):
              def __init__(self, id):
                 Record.__init__(db.getInstance(), 'user', id)
        '''
        self.db = db
        self.table = table
        self.id = id

        DataTable.__init__(self, db, table)
        self.debug_sql = DEBUG
        self._loadData()
Exemplo n.º 5
0
    def __init__(self, db, table, id, primary_key='id'):
        '''Create a Record Object given
              a vlib.db Object, a table name, and a record Id

           Meant to be subclassed, as follows:

           from datarecord import DataRecord

           class user(DataRecord):
              def __init__(self, id):
                 DataRecord.__init__(db.getInstance(), 'user', id)

           u = User(1)
           print u.name

        '''
        self.db    = db      
        self.table = table
        self.id    = id
        self.primary_key = primary_key

        DataTable.__init__(self, db, table)
        self.debug_sql = DEBUG
        self._loadData()
Exemplo n.º 6
0
    def __init__(self, db, table, id, primary_key='id'):
        '''Create a Record Object given
              a vlib.db Object, a table name, and a record Id

           Meant to be subclassed, as follows:

           from datarecord import DataRecord

           class user(DataRecord):
              def __init__(self, id):
                 DataRecord.__init__(db.getInstance(), 'user', id)

           u = User(1)
           print u.name

        '''
        self.db = db
        self.table = table
        self.id = id
        self.primary_key = primary_key

        DataTable.__init__(self, db, table)
        self.debug_sql = DEBUG
        self._loadData()
Exemplo n.º 7
0
 def __init__(self):
     DataTable.__init__(self, db.getInstance(), 'schools')
     self.conf = conf.getInstance()
Exemplo n.º 8
0
 def __init__(self):
     self.db = db.getInstance()
     DataTable.__init__(self, self.db, 'page_pics')
Exemplo n.º 9
0
 def __init__(self):
     self.db = db.getInstance()
     DataTable.__init__(self, self.db, 'follows')
Exemplo n.º 10
0
 def __init__(self):
     self.db = db.getInstance()
     self.conf = conf.getInstance()
     self.activity_notifications = ActivityNotifications()
     DataTable.__init__(self, db.getInstance(), 'messages')