Changeset 991 for trunk/packages


Ignore:
Timestamp:
Oct 1, 2008, 7:48:39 PM (16 years ago)
Author:
price
Message:

more sqlalchemy-0.4 changes

Location:
trunk/packages
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/packages/sipb-xen-database/debian/changelog

    r989 r991  
    33  * add remote and console to pg_hba.conf template
    44  * fix init script so it works
     5  * port more code to sqlalchemy 0.4
    56
    67 -- Greg Price <price@mit.edu>  Wed, 01 Oct 2008 19:30:26 -0400
  • trunk/packages/sipb-xen-database/python/database/__init__.py

    r946 r991  
    55def connect(uri = config.db.uri):
    66    """ Connect to a given database URI"""
    7     meta.bind = sqlalchemy.create_engine(uri)
     7    engine = sqlalchemy.create_engine(uri)
     8    meta.bind = engine
     9    session.configure(bind=engine)
  • trunk/packages/sipb-xen-database/python/database/models.py

    r946 r991  
    11from sqlalchemy import *
     2from sqlalchemy import orm
    23from sqlalchemy.orm import create_session, relation
    34
     
    67
    78__all__ = ['meta',
    8            'ctx',
     9           'session',
    910           'clear_cache',
    1011           'machine_table',
     
    2627
    2728meta = ThreadLocalMetaData()
    28 ctx = SessionContext(create_session)
     29session = orm.scoped_session(orm.sessionmaker())
    2930
    3031machine_table = Table('machines', meta,
     
    106107        return "<Autoinstall %s: %s (%s)>" % (self.autoinstall_id, self.description, self.type.type_id)
    107108
    108 assign_mapper(ctx, Machine, machine_table,
     109session.mapper(Machine, machine_table,
    109110              properties={'nics': relation(NIC, backref="machine", lazy=False),
    110111                          'disks': relation(Disk, backref="machine", lazy=False),
    111112                          'type': relation(Type, lazy=False),
    112113                          'acl': relation(MachineAccess, backref="machine", lazy=False, passive_deletes=True, cascade="all, delete-orphan")});
    113 assign_mapper(ctx, MachineAccess, machine_access_table)
    114 assign_mapper(ctx, NIC, nic_table)
    115 assign_mapper(ctx, Disk, disk_table)
    116 assign_mapper(ctx, Type, types_table)
    117 assign_mapper(ctx, CDROM, cdroms_table)
    118 assign_mapper(ctx, Autoinstall, autoinstalls_table)
     114session.mapper(MachineAccess, machine_access_table)
     115session.mapper(NIC, nic_table)
     116session.mapper(Disk, disk_table)
     117session.mapper(Type, types_table)
     118session.mapper(CDROM, cdroms_table)
     119session.mapper(Autoinstall, autoinstalls_table)
    119120
    120121def clear_cache():
     
    124125    it.  Why is this so obscure?"""
    125126
    126     ctx.registry.clear()
     127    # XXX maybe we still need to do this, but it's not doc'd how.
     128    #ctx.registry.clear()
  • trunk/packages/sipb-xen-remote-server/debian/changelog

    r986 r991  
    11sipb-xen-remote-server (0.9) unstable; urgency=low
    22
     3  [Evan Broder]
    34  * Make the acl/ subdir of RemConfFS listable
     5 
     6  [Greg Price]
    47  * Update RemConfFS for new SQLAlchemy code
    58
Note: See TracChangeset for help on using the changeset viewer.