Re: [Django] #18989: Supspicious code in CursorWrapper.

2012-11-17 Thread Django
#18989: Supspicious code in CursorWrapper.
-+-
 Reporter:  zimnyx   |Owner:  nobody
 Type:   |   Status:  closed
  Cleanup/optimization   |  Version:  1.4
Component:  Database layer   |   Resolution:  fixed
  (models, ORM)  | Triage Stage:  Accepted
 Severity:  Normal   |  Needs documentation:  0
 Keywords:   |  Patch needs improvement:  0
Has patch:  1|UI/UX:  0
  Needs tests:  0|
Easy pickings:  0|
-+-

Comment (by Claude Paroz ):

 In [changeset:"a023952e10092775215aeb2277d2fe3af5794e3b"]:
 {{{
 #!CommitTicketReference repository=""
 revision="a023952e10092775215aeb2277d2fe3af5794e3b"
 [1.5.x] Fixed #18989 -- Removed unused condition in CursorWrapper

 Thanks zimnyx for the report.
 Backport of 8c6927876 from master.
 }}}

-- 
Ticket URL: 
Django 
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.




Re: [Django] #18989: Supspicious code in CursorWrapper.

2012-11-17 Thread Django
#18989: Supspicious code in CursorWrapper.
-+-
 Reporter:  zimnyx   |Owner:  nobody
 Type:   |   Status:  closed
  Cleanup/optimization   |  Version:  1.4
Component:  Database layer   |   Resolution:  fixed
  (models, ORM)  | Triage Stage:  Accepted
 Severity:  Normal   |  Needs documentation:  0
 Keywords:   |  Patch needs improvement:  0
Has patch:  1|UI/UX:  0
  Needs tests:  0|
Easy pickings:  0|
-+-
Changes (by Claude Paroz ):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"8c69278764ae31b0cd495d21b8bf2471c103"]:
 {{{
 #!CommitTicketReference repository=""
 revision="8c69278764ae31b0cd495d21b8bf2471c103"
 Fixed #18989 -- Removed unused condition in CursorWrapper

 Thanks zimnyx for the report.
 }}}

-- 
Ticket URL: 
Django 
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.




Re: [Django] #18989: Supspicious code in CursorWrapper.

2012-10-26 Thread Django
#18989: Supspicious code in CursorWrapper.
-+-
 Reporter:  zimnyx   |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |  Version:  1.4
Component:  Database layer   |   Resolution:
  (models, ORM)  | Triage Stage:  Accepted
 Severity:  Normal   |  Needs documentation:  0
 Keywords:   |  Patch needs improvement:  0
Has patch:  1|UI/UX:  0
  Needs tests:  0|
Easy pickings:  0|
-+-
Changes (by claudep):

 * has_patch:  0 => 1


-- 
Ticket URL: 
Django 
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.




Re: [Django] #18989: Supspicious code in CursorWrapper.

2012-10-26 Thread Django
#18989: Supspicious code in CursorWrapper.
-+-
 Reporter:  zimnyx   |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |  Version:  1.4
Component:  Database layer   |   Resolution:
  (models, ORM)  | Triage Stage:  Accepted
 Severity:  Normal   |  Needs documentation:  0
 Keywords:   |  Patch needs improvement:  0
Has patch:  0|UI/UX:  0
  Needs tests:  0|
Easy pickings:  0|
-+-
Changes (by claudep):

 * needs_better_patch:   => 0
 * needs_docs:   => 0
 * needs_tests:   => 0
 * stage:  Unreviewed => Accepted


Comment:

 Current coverage report for this file seems to give you credit:
 
http://ci.djangoproject.com/job/Django%20Coverage/HTML_Coverage_Report/_var_lib_jenkins_jobs_Django%20Coverage_workspace_django_db_backends_util.html

 I'd rather suppress the `if attr in self.__dict__` part, as we mainly want
 to catch the calls to execute/executemany on this class' instances.

-- 
Ticket URL: 
Django 
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.




Re: [Django] #18989: Supspicious code in CursorWrapper.

2012-10-26 Thread Django
#18989: Supspicious code in CursorWrapper.
-+-
 Reporter:  zimnyx   |Owner:  nobody
 Type:   |   Status:  new
  Cleanup/optimization   |  Version:  1.4
Component:  Database layer   |   Resolution:
  (models, ORM)  | Triage Stage:
 Severity:  Normal   |  Unreviewed
 Keywords:   |  Needs documentation:  0
Has patch:  0|  Patch needs improvement:  0
  Needs tests:  0|UI/UX:  0
Easy pickings:  0|
-+-
Changes (by claudep):

 * type:  Uncategorized => Cleanup/optimization


Old description:

> 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)
> }}}

New description:

 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)
 }}}

--

-- 
Ticket URL: 
Django 
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.




Re: [Django] #18989: Supspicious code in CursorWrapper.

2012-09-19 Thread Django
#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: 
Django 
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.