def where(self, query, ignore_common_filters=False, model=None): if query is None: return self elif isinstance(query, Table): query = self.db._adapter.id_query(query) elif isinstance(query, str): query = Expression(self.db, query) elif isinstance(query, Field): query = query != None q = self.query & query if self.query else query return Set( self.db, q, ignore_common_filters=ignore_common_filters, model=model)
def where(self, query, ignore_common_filters=None, model=None): if query is None: return self elif isinstance(query, Table): query = self.db._adapter.id_query(query) elif isinstance(query, str): query = Expression(self.db, query) elif isinstance(query, Field): query = query != None elif isinstance(query, types.LambdaType): model = model or self._model_ if not model: raise ValueError( "Too many models involved in the Set to use a lambda") query = query(model) q = self.query & query if self.query else query return self._clone(ignore_common_filters, model, query=q)
def cast(self, value, **kwargs): return Expression(self.db, self._dialect.cast, self, self._dialect.types[value] % kwargs, value)
def _jpathv_expr(self, expr, data): return Expression(expr.db, self._jpathv, expr, data, 'string')
def _jpath_expr(self, expr, data): return Expression(expr.db, self._jpath, expr, data, expr.type)
def _jget_expr(self, expr, data): return Expression(expr.db, self._jget, expr, data, expr.type)