Re: [Sqlalchemy-tickets] [sqlalchemy] #2734: __eq__ operator appears to not be working correctly fo
Brought to you by:
zzzeek
|
From: sqlalchemy <mi...@zz...> - 2013-06-05 17:54:08
|
#2734: __eq__ operator appears to not be working correctly for decorated types
-----------------------------------+------------------------------------
Reporter: mcclurem | Owner: zzzeek
Type: defect | Status: closed
Priority: medium | Milestone:
Component: declarative | Severity: no triage selected yet
Resolution: worksforme | Keywords: TypeDecorator
Progress State: completed/closed |
-----------------------------------+------------------------------------
Comment (by zzzeek):
the patch in #2744 allows this workaround to be performed more simply:
{{{
#!python
class NullableString(TypeDecorator):
'''Turns None into the string "Null" and back in order to prevent
Null!=Null issues'''
impl = String
coerce_to_is_types = ()
def process_bind_param(self, value, dialect):
return "NONE" if value is None else value
def process_result_value(self, value, dialect):
return None if value == "NONE" else value
}}}
--
Ticket URL: <http://www.sqlalchemy.org/trac/ticket/2734#comment:4>
sqlalchemy <http://www.sqlalchemy.org/>
The Database Toolkit for Python
|