[EMAIL PROTECTED] wrote:

You can solve this problem by creating a weakref proxy to this class which is a drop-in replacement to the storage class.

import metakit
class storage:
   def __init__(self, filename=None, mode=None):
       if filename and mode:
           self.__db = metakit.storage(filename, mode)
       elif filename and not mode:
           raise ValueError("Need to supply both a filename and a mode")
       else:
           self.__db = metakit.storage()
   def __getattr__(self, attribute): return getattr(self.__db, attribute)
   def getas(self, table): return self.__db.getas(table)
   def view(self, viewname): return self.__db.view(viewname)
   def close(self): del self.__db

Which behaves for all intents and purposes like a metakit storage object. And additionally has a close method, just don't reference storage.__db from anywhere else and you should be okay.

My full metakit wrapper is located here http://jura.wi.mit.edu/people/kelley/metawrap.py
I did a bug release a couple of weeks ago.


_____________________________________________
Metakit mailing list  -  [EMAIL PROTECTED]
http://www.equi4.com/mailman/listinfo/metakit

Reply via email to