optional_args

This commit is contained in:
mdipierro
2013-02-04 09:37:44 -06:00
parent 90f8f223b9
commit 7c1f6c2195
2 changed files with 8 additions and 3 deletions
+1 -1
View File
@@ -1 +1 @@
Version 2.4.1-alpha.2+timestamp.2013.02.04.09.27.30 Version 2.4.1-alpha.2+timestamp.2013.02.04.09.37.03
+7 -2
View File
@@ -1328,10 +1328,11 @@ class BaseAdapter(ConnectionPool):
first = expression.first first = expression.first
second = expression.second second = expression.second
op = expression.op op = expression.op
optional_args = expression.optional_args or {}
if not second is None: if not second is None:
return op(first, second) return op(first, second, **optional_args)
elif not first is None: elif not first is None:
return op(first) return op(first,**optional_args)
elif isinstance(op, str): elif isinstance(op, str):
if op.endswith(';'): if op.endswith(';'):
op=op[:-1] op=op[:-1]
@@ -8560,6 +8561,7 @@ class Expression(object):
first=None, first=None,
second=None, second=None,
type=None, type=None,
**optional_args
): ):
self.db = db self.db = db
@@ -8572,6 +8574,7 @@ class Expression(object):
self.type = first.type self.type = first.type
else: else:
self.type = type self.type = type
self.optional_args = optional_args
def sum(self): def sum(self):
db = self.db db = self.db
@@ -9279,12 +9282,14 @@ class Query(object):
first=None, first=None,
second=None, second=None,
ignore_common_filters = False, ignore_common_filters = False,
**optional_args
): ):
self.db = self._db = db self.db = self._db = db
self.op = op self.op = op
self.first = first self.first = first
self.second = second self.second = second
self.ignore_common_filters = ignore_common_filters self.ignore_common_filters = ignore_common_filters
self.optional_args = optional_args
def __repr__(self): def __repr__(self):
return '<Query %s>' % BaseAdapter.expand(self.db._adapter,self) return '<Query %s>' % BaseAdapter.expand(self.db._adapter,self)