Actually expose the function
[invirt/packages/invirt-database.git] / sipb_xen_database / models.py
index d07950a..b075886 100644 (file)
@@ -5,6 +5,7 @@ from sqlalchemy.ext.assignmapper import assign_mapper
 
 __all__ = ['meta',
            'ctx',
+           'clear_cache',
            'machine_table',
            'machine_access_table',
            'nic_table',
@@ -90,9 +91,17 @@ assign_mapper(ctx, Machine, machine_table,
               properties={'nics': relation(NIC, backref="machine"),
                           'disks': relation(Disk, backref="machine"),
                           'type': relation(Type),
-                          'users': relation(MachineAccess, backref="machine")});
+                          'acl': relation(MachineAccess, backref="machine")});
 assign_mapper(ctx, MachineAccess, machine_access_table)
 assign_mapper(ctx, NIC, nic_table)
 assign_mapper(ctx, Disk, disk_table)
 assign_mapper(ctx, Type, types_table)
 assign_mapper(ctx, CDROM, cdroms_table)
+
+def clear_cache():
+    """Clear sqlalchemy's cache.
+
+    This _seems_ to be the way; it works, but the docs don't mention
+    it.  Why is this so obscure?"""
+
+    ctx.registry.clear()