summaryrefslogtreecommitdiff
path: root/lib/sqlalchemy/sql/expression.py
diff options
context:
space:
mode:
authorMichael Trier <mtrier@gmail.com>2009-03-31 22:31:08 +0000
committerMichael Trier <mtrier@gmail.com>2009-03-31 22:31:08 +0000
commit6010afb28f95c7050ca48ddd2e6f65ca6cbae5a1 (patch)
tree46259c03c209a89702c32c939c8ea035edee9425 /lib/sqlalchemy/sql/expression.py
parent832ea82fefa366f4717e889511f66ecfce3313de (diff)
downloadsqlalchemy-6010afb28f95c7050ca48ddd2e6f65ca6cbae5a1.tar.gz
Lots of fixes to the code examples to specify imports explicitly.
Explicit imports make it easier for users to understand the examples. Additionally a lot of the examples were fixed to work with the changes in the 0.5.x code base. One small correction to the Case expression. Thanks a bunch to Adam Lowry! Fixes #717.
Diffstat (limited to 'lib/sqlalchemy/sql/expression.py')
-rw-r--r--lib/sqlalchemy/sql/expression.py12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/sqlalchemy/sql/expression.py b/lib/sqlalchemy/sql/expression.py
index 56f358db8..859419022 100644
--- a/lib/sqlalchemy/sql/expression.py
+++ b/lib/sqlalchemy/sql/expression.py
@@ -2204,13 +2204,17 @@ class _Case(ColumnElement):
whenlist = [(_literal_as_binds(c).self_group(), _literal_as_binds(r)) for (c, r) in whens]
else:
whenlist = [(_no_literals(c).self_group(), _literal_as_binds(r)) for (c, r) in whens]
-
+
if whenlist:
type_ = list(whenlist[-1])[-1].type
else:
type_ = None
-
- self.value = value
+
+ if value is None:
+ self.value = None
+ else:
+ self.value = _literal_as_binds(value)
+
self.type = type_
self.whens = whenlist
if else_ is not None:
@@ -2236,7 +2240,7 @@ class _Case(ColumnElement):
@property
def _from_objects(self):
- return itertools.chain(*[x._from_objects for x in self.get_children()])
+ return list(itertools.chain(*[x._from_objects for x in self.get_children()]))
class Function(ColumnElement, FromClause):
"""Describe a SQL function."""