Ejemplo n.º 1
0
 def get_by_kind(kind=1, current_page_num=1):
     return TabEntity.select().where(
         TabEntity.kind == kind
     ).paginate(
         current_page_num,
         CMS_CFG['list_num']
     )
Ejemplo n.º 2
0
    def get_id_by_impath(path):
        logger.info('Get Entiry, Path: {0}'.format(path))

        entity_list = TabEntity.select().where(TabEntity.path == path)
        if entity_list.count() == 1:
            return entity_list.get().uid
        elif entity_list.count() > 1:
            for rec in entity_list:
                MEntity.delete(rec.uid)
            return False
        else:
            return False
Ejemplo n.º 3
0
    def get_id_by_impath(path):
        '''
        The the entity id by the path.
        '''
        logger.info('Get Entiry, Path: {0}'.format(path))

        entity_list = TabEntity.select().where(TabEntity.path == path)
        out_val = None
        if entity_list.count() == 1:
            out_val = entity_list.get()
        elif entity_list.count() > 1:
            for rec in entity_list:
                MEntity.delete(rec.uid)
            out_val = None
        else:
            pass
        return out_val
Ejemplo n.º 4
0
 def total_number():
     '''
     Total number.
     '''
     # adding ``None`` to hide ``No value for argument 'database' in method call``
     return TabEntity.select().count(None)
Ejemplo n.º 5
0
 def get_all_pager(current_page_num=1):
     return TabEntity.select().paginate(current_page_num,
                                        CMS_CFG['list_num'])
Ejemplo n.º 6
0
 def query_all(limit=20):
     '''
     Return the entities list.
     '''
     return TabEntity.select().limit(limit)
Ejemplo n.º 7
0
 def total_number():
     return TabEntity.select().count()
Ejemplo n.º 8
0
 def query_all(limit=20):
     return TabEntity.select().limit(limit)