def __init__(self, db, entity=Group): RecordStore.__init__( self, db, entity, name='groups', key='id' )
def __init__(self, db, entity=Member): RecordStore.__init__( self, db, entity, name='members', key='id' )
def __init__(self, db): RecordStore.__init__( self, db, UserRecord, name='dz_users', key='userid' )
def __init__(self, db, entity=User): RecordStore.__init__( self, db, entity, name='users', key='id' )
def __init__(self, db, entity=UserRecord): RecordStore.__init__( self, db, entity, name='dz_users', key='userid' )
def table(self, name, limit='6'): db = self.model.site.db items = RecordStore(db, MyModel, name=name) if len(items) == 1: footer_name = 'record' else: footer_name = 'records' footer = len(items) and '%s %s' % (len(items), footer_name) or '' # If there is an id column we will use it to select the last N items, # otherwise we'll just select the whole thing and then take what we # want from the list. columns = db.get_column_names(name) limit = int(limit) data = 'id' in columns and items[-limit:] or list(items)[-limit:] content = browse(data, footer=footer, title='Sample Data') if name in db.get_tables(): content += browse(db('describe ' + name), title='Structure') if name in db.get_tables(): content += browse(db('show index from ' + name), title='Index') database = db.database.name if database: content += browse(db( 'show table status in {} where name=%s'.format(database), name), title='Metadata') return page(content, title='Record: ' + name)
def table(self, name, limit='50'): db = self.model.site.db items = RecordStore(db, MyModel, name=name) if len(items) == 1: footer_name = 'record' else: footer_name = 'records' footer = len(items) and '%s %s' % (len(items), footer_name) or '' # If there is an id column we will use it to select the first N items, # otherwise we'll just select the whole thing and then take what we # want from the list. columns = db.get_column_names(name) limit = int(limit) data = 'id' in columns and items[:limit] or list(items)[:limit] return page(browse(data, footer=footer), title='Record: ' + name)
def __init__(self, db): RecordStore.__init__(self, db, User)
def get_record_store(self): return RecordStore(self.db, Person)
def get_record_store(self): return RecordStore(self.db, Person, name=self.name, key=self.key)
def test_kind(self): self.assertEqual(self.people.kind, 'person') self.assertEqual(RecordStore(self.db, TestPerson).kind, 'test_person')
def __init__(self, db): RecordStore.__init__(self, db, GroupStore, name='dz_groups', key='groupid')