コード例 #1
0
ファイル: cache.py プロジェクト: vikingco/django-statsd
 def __getattribute__(self, attr):
     if attr == 'cache':
         return BaseCache.__getattribute__(self, attr)
     # Don't wrap default_timeout in a functools.partial object (see wrap)
     # This ensures compatibility with django-parler 1.6 under Django 1.9
     if attr == 'default_timeout':
         return self.cache.default_timeout
     return wrap(getattr(self.cache, attr), key(self.cache, attr))
コード例 #2
0
 def __getattribute__(self, attr):
     if attr == 'cache':
         return BaseCache.__getattribute__(self, attr)
     # Don't wrap default_timeout in a functools.partial object (see wrap)
     # This ensures compatibility with django-parler 1.6 under Django 1.9
     if attr == 'default_timeout':
         return self.cache.default_timeout
     return wrap(getattr(self.cache, attr), key(self.cache, attr))
コード例 #3
0
ファイル: db.py プロジェクト: grantt/django-statsd
def __getattr__(self, attr):
    if django.VERSION < (1, 6) and self.db.is_managed():
        # In Django 1.6 you can't put a connection in managed mode
        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)
コード例 #4
0
ファイル: db.py プロジェクト: jpadilla/django-statsd
def pre_django_1_6_cursorwrapper_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", "callproc"]:
            return wrap(getattr(self.cursor, attr), key(self.db, attr))
        return getattr(self.cursor, attr)
コード例 #5
0
def pre_django_1_6_cursorwrapper_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', 'callproc']:
            return wrap(getattr(self.cursor, attr), key(self.db, attr))
        return getattr(self.cursor, attr)
コード例 #6
0
ファイル: db.py プロジェクト: fgallina/django-statsd
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 django.VERSION < (1, 6) and self.db.is_managed():
        # In Django 1.6 you can't put a connection in managed mode
        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)
コード例 #7
0
ファイル: db.py プロジェクト: Qalthos/django-statsd
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 django.VERSION < (1, 6) and self.db.is_managed():
        # In Django 1.6 you can't put a connection in managed mode
        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)
コード例 #8
0
ファイル: db.py プロジェクト: fgallina/django-statsd
 def executemany(self, *args, **kw):
     return wrap(
         super(Wrapper, self).executemany,
         key(self.db, 'executemany'))(*args, **kw)
コード例 #9
0
ファイル: db.py プロジェクト: AdStack/django-statsd
 def executemany(self, *args, **kw):
     return wrap(super(Wrapper, self).executemany,
                 key(self.db, 'executemany'))(*args, **kw)
コード例 #10
0
ファイル: cache.py プロジェクト: sideffect0/socorro
 def __getattribute__(self, attr):
     if attr == 'cache':
         return BaseCache.__getattribute__(self, attr)
     return wrap(getattr(self.cache, attr), key(self.cache, attr))
コード例 #11
0
ファイル: templates.py プロジェクト: sideffect0/socorro
def new_render(self, context):
    return wrap(self._old_render(context),
                'template.{0}.parse'.format(key(self.name)))
コード例 #12
0
ファイル: templates.py プロジェクト: sideffect0/socorro
def new_template_init(self, template_string, origin=None, name='unknown'):
    return wrap(self._old_init(template_string, origin, name),
                'template.{0}.parse'.format(key(name)))
コード例 #13
0
ファイル: cache.py プロジェクト: AdStack/django-statsd
 def __getattribute__(self, attr):
     if attr == 'cache':
         return BaseCache.__getattribute__(self, attr)
     return wrap(getattr(self.cache, attr), key(self.cache, attr))
コード例 #14
0
ファイル: templates.py プロジェクト: FishingCactus/socorro
def new_render(self, context):
    return wrap(self._old_render(context),
                'template.{0}.parse'.format(key(self.name)))
コード例 #15
0
ファイル: templates.py プロジェクト: FishingCactus/socorro
def new_template_init(self, template_string, origin=None, name='unknown'):
    return wrap(self._old_init(template_string, origin, name),
                'template.{0}.parse'.format(key(name)))