Ticket #18989: 18989-1.diff

File 18989-1.diff, 639 bytes (added by Claude Paroz, 12 years ago)

Optimize CursorWrapper getattr

  • django/db/backends/util.py

    diff --git a/django/db/backends/util.py b/django/db/backends/util.py
    index e029c42..1ba2306 100644
    a b class CursorWrapper(object):  
    2424            self.db.set_dirty()
    2525
    2626    def __getattr__(self, attr):
    27         self.set_dirty()
    28         if attr in self.__dict__:
    29             return self.__dict__[attr]
    30         else:
    31             return getattr(self.cursor, attr)
     27        if attr in ('execute', 'executemany', 'callproc'):
     28            self.set_dirty()
     29        return getattr(self.cursor, attr)
    3230
    3331    def __iter__(self):
    3432        return iter(self.cursor)
Back to Top