Fix WeekDaysType support for py33

This commit is contained in:
Konsta Vesterinen
2014-04-21 11:11:18 +03:00
parent 18a40f68f3
commit 02c60f1d28
2 changed files with 6 additions and 0 deletions

View File

@@ -16,5 +16,7 @@ class BitType(sa.types.TypeDecorator):
# Use the native BIT type for drivers that has it.
if dialect.name == 'postgresql':
return dialect.type_descriptor(BIT(self.length))
elif dialect.name == 'sqlite':
return dialect.type_descriptor(sa.String(self.length))
else:
return dialect.type_descriptor(type(self.impl)(self.length))

View File

@@ -48,6 +48,10 @@ class WeekDaysType(types.TypeDecorator, ScalarCoercible):
impl = BitType(WeekDay.NUM_WEEK_DAYS)
@property
def comparator_factory(self):
return self.impl.comparator_factory
def process_bind_param(self, value, dialect):
if isinstance(value, WeekDays):
return value.as_bit_string()