예제 #1
0
class indexed():

    def __init__(self, settings):
        self.db=DB(settings.database)
        self.settings=settings
        self.index_name=settings.index



    def __enter__(self):
        self.db=DB(self.settings.database)
        return self

    def __exit__(self, type, value, traceback):
        if isinstance(value, BaseException):
            self.db.rollback()
            self.db.close()
            return

        try:
            self.db.commit()
        except Exception, e:
            Log.warning(u"can not commit()", e)
        finally:
예제 #2
0
 def __enter__(self):
     self.db=DB(self.settings.database)
     return self
예제 #3
0
 def __init__(self, settings):
     self.db=DB(settings.database)
     self.settings=settings
     self.index_name=settings.index