This has been a problem for me for years.
class DeliveryAddress(Base, Address):
...
delivery_method = Column(String)
...
@event.listens_for(DeliveryAddress, 'before_insert')
def before_insert_deliveryaddress(mapper, connection, target):
settings = object_session(target).query(Settings).one()
target.delivery_method = settings.default_delivery_method
Is there absolutely no way to encapsulate this logic cleanly in the actual
class?
--
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.