X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-database.git/blobdiff_plain/9b8179e2ab0c8374a9b1ca3b2a14a9b2c3e99fee..refs/heads/glasgall-dev:/python/database/models.py diff --git a/python/database/models.py b/python/database/models.py index dc87e3b..d4f2694 100644 --- a/python/database/models.py +++ b/python/database/models.py @@ -16,6 +16,7 @@ def session_mapper(scoped_session): def __init__(self, **kwargs): for key, value in kwargs.items(): setattr(self, key, value) + scoped_session.add(self) cls.__init__ = __init__ cls.query = scoped_session.query_property() return sqla_mapper(cls, *arg, **kw) @@ -190,4 +191,4 @@ def clear_cache(): """Clear sqlalchemy's cache """ - session.clear() + session.expunge_all()