From dff4e0591eee3def7c4c38666c8fc581c327aa87 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 21 Dec 2010 16:34:00 -0500 Subject: - apply pep8 to compiler.py - deprecate Compiled.compile() - have __init__ do compilation if statement is present. --- lib/sqlalchemy/engine/base.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/sqlalchemy/engine/base.py') diff --git a/lib/sqlalchemy/engine/base.py b/lib/sqlalchemy/engine/base.py index 4e11117f7..1e5285b35 100644 --- a/lib/sqlalchemy/engine/base.py +++ b/lib/sqlalchemy/engine/base.py @@ -675,14 +675,17 @@ class Compiled(object): """ self.dialect = dialect - self.statement = statement self.bind = bind - self.can_execute = statement.supports_execution + if statement is not None: + self.statement = statement + self.can_execute = statement.supports_execution + self.string = self.process(self.statement) + @util.deprecated("0.7", ":class:`.Compiled` objects now compile " + "within the constructor.") def compile(self): """Produce the internal string representation of this element.""" - - self.string = self.process(self.statement) + pass @property def sql_compiler(self): -- cgit v1.2.1