A webapp/form for people to join pEp coop. Fork of Cultural Commons Collecting Society (C3S) SCE
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
869 B

# the "correct" place for this would be alembic/
# but alembic can't be a package because namespace collision,
# so please leave this here for the time being :/
import sqlalchemy.types as types
class SqliteDecimal(types.TypeDecorator):
Type decorator for persisting Decimal (currency values)
TODO: Use standard SQLAlchemy Decimal
when a database is used which supports it.
impl = types.String
def load_dialect_impl(self, dialect):
return dialect.type_descriptor(types.VARCHAR(100))
def process_bind_param(self, value, dialect):
if value is not None:
return str(value)
return None
def process_result_value(self, value, dialect):
if value is not None and value != '':
return Decimal(value)
return None