#18989: Supspicious code in CursorWrapper. -------------------------------------+------------------------------------- Reporter: zimnyx | Owner: nobody Type: Uncategorized | Status: new Component: Database layer | Version: 1.4 (models, ORM) | Resolution: Severity: Normal | Triage Stage: Keywords: | Unreviewed Has patch: 0 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 0 | UI/UX: 0 -------------------------------------+------------------------------------- Changes (by zimnyx):
* needs_better_patch: => 0 * needs_tests: => 0 * needs_docs: => 0 Comment: Replying to [ticket:18989 zimnyx]: > 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) > }}} Trac has eaten underscores. Obviously, I'm talking about !__getattribute!__(). -- Ticket URL: <https://code.djangoproject.com/ticket/18989#comment:1> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To post to this group, send email to django-updates@googlegroups.com. To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.