﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18989	Supspicious code in CursorWrapper.	Piotr Czachur	nobody	"Shouldn't it be `__getattribute__()` ?
If we want set_dirty() to be called on every access to 'db' and 'cursor' attributes, definitely yes. Otherwise ""if attr in self.__dict__: ..."" should be removed.
{{{
# Django 1.4
class CursorWrapper(object):
    def __init__(self, cursor, db): 
        self.cursor = cursor
        self.db = db

    def set_dirty(self):
        if self.db.is_managed():        
            self.db.set_dirty()

    def __getattr__(self, attr):    
        self.set_dirty()
        if attr in self.__dict__:       
            return self.__dict__[attr]      
        else:
            return getattr(self.cursor, attr)
}}}"	Cleanup/optimization	closed	Database layer (models, ORM)	1.4	Normal	fixed			Accepted	1	0	0	0	0	0
