mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Enable nullable MarkdownColumns
This commit is contained in:
parent
105d9422ca
commit
6f36907341
1 changed files with 6 additions and 0 deletions
|
@ -106,6 +106,9 @@ class MarkdownColumn(sqlalchemy.types.TypeDecorator):
|
|||
impl = sqlalchemy.types.Unicode
|
||||
|
||||
def process_bind_param(self, value, dialect):
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
if not isinstance(value, basestring):
|
||||
# Can't assign, e.g., MarkdownString objects yet
|
||||
raise NotImplementedError
|
||||
|
@ -113,4 +116,7 @@ class MarkdownColumn(sqlalchemy.types.TypeDecorator):
|
|||
return unicode(value)
|
||||
|
||||
def process_result_value(self, value, dialect):
|
||||
if value is None:
|
||||
return None
|
||||
|
||||
return MarkdownString(value)
|
||||
|
|
Loading…
Reference in a new issue