def query(self, filters=None, order_column='', order_direction='',
              page=None, page_size=None):

        # base query : all objects
        objs = self.obj.objects

        # apply filters first if given
        if filters:
            objs = filters.apply_all(objs)

        # get the count of all items, either filtered or unfiltered
        count = objs.count()

        # order the data
        if order_column != '':
            if hasattr(getattr(self.obj, order_column), '_col_name'):
                order_column = getattr(getattr(self.obj, order_column),'_col_name')
            if order_direction == 'asc':
                objs = objs.order_by('-{0}'.format(order_column))
            else:
                objs = objs.order_by('+{0}'.format(order_column))

        if page_size is None: # error checking and warnings
            if page is not None:
                log.error('Attempting to get page %s but page_size is undefined' % page)
            if 100 > count:
                log.warn('Retrieving %s %s items from DB' % (count, str(self.obj)))
        else: # get data segment for paginated page
            offset = (page or 0) * page_size
            objs = objs[offset : offset + page_size]

        return count, objs
dataset/ETHPy150Open dpgaspar/Flask-AppBuilder/flask_appbuilder/models/mongoengine/interface.py/MongoEngineInterface.query/swapped operands of `>`