From adbd3ae29eefd2f3a34d8dd5166eceff91347557 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Sat, 11 Feb 2006 23:29:02 +0000 Subject: more hammering of defaults. ORM will properly execute defaults and post-fetch rows that contain passive defaults --- lib/sqlalchemy/sql.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lib/sqlalchemy/sql.py') diff --git a/lib/sqlalchemy/sql.py b/lib/sqlalchemy/sql.py index c8a05470c..d4ae77a4e 100644 --- a/lib/sqlalchemy/sql.py +++ b/lib/sqlalchemy/sql.py @@ -638,7 +638,7 @@ class TextClause(ClauseElement): being specified as a bind parameter via the bindparam() method, since it provides more information about what it is, including an optional type, as well as providing comparison operations.""" - def __init__(self, text = "", engine=None, bindparams=None, typemap=None): + def __init__(self, text = "", engine=None, bindparams=None, typemap=None, escape=True): self.parens = False self._engine = engine self.id = id(self) @@ -650,8 +650,11 @@ class TextClause(ClauseElement): def repl(m): self.bindparams[m.group(1)] = bindparam(m.group(1)) return self.engine.bindtemplate % m.group(1) - - self.text = re.compile(r':([\w_]+)', re.S).sub(repl, text) + + if escape: + self.text = re.compile(r':([\w_]+)', re.S).sub(repl, text) + else: + self.text = text if bindparams is not None: for b in bindparams: self.bindparams[b.key] = b -- cgit v1.2.1