示例#1
0
def __getattr__(self, attr):
    """
    The CursorWrapper is a pretty small wrapper around the cursor.
    If you are NOT in debug mode, this is the wrapper that's used.
    Sadly if it's in debug mode, we get a different wrapper.
    """
    if self.db.is_managed():
        self.db.set_dirty()
    if attr in self.__dict__:
        return self.__dict__[attr]
    else:
        if attr in ['execute', 'executemany']:
            return wrap(getattr(self.cursor, attr), key(self.db, attr))
        return getattr(self.cursor, attr)
示例#2
0
 def executemany(self, *args, **kw):
     return wrap(super(Wrapper, self).executemany,
                 key(self.db, 'executemany'))(*args, **kw)
示例#3
0
 def __getattribute__(self, attr):
     if attr == 'cache':
         return BaseCache.__getattribute__(self, attr)
     return wrap(getattr(self.cache, attr), key(self.cache, attr))