Karen Tracey ha scritto:
On Tue, Jun 28, 2011 at 8:44 AM, Jim Dalton <[email protected]
<mailto:[email protected]>> wrote:
I have not had time to try out the patch, but did look at it.
Doesn't the base implementation of disable_foreign_key_checks
need to return False instead of just passing? The return value is
used in loaddata processing to decide whether it's necessary to
re-enable/check.
It actually doesn't *need* to return False; pass is the same as
not returning anything or returning None. The boolean check just
treats it the same way as False. "Should it?" is another question.
On the one hand it's a bit more clear, this value is called and
always returns False, unless a backend has overridden it. On the
other hand, pass is in keeping with other methods in that class
that are meant to be overridden in backends, so I went with pass
to emphasize that aspect of the code.
Hmm, well, I did not know that falling off the end of a method with
pass guaranteed a return value of False or None (and can't find that
noted in the doc here:
http://docs.python.org/tutorial/controlflow.html#pass-statements) so
in my mind explicitly returning False would be clearer/better...
a bit off-topic, but...
if no "return" statement is reached, the function will return None. See
"None" paragraph in [1]
[1]
http://docs.python.org/reference/datamodel.html#the-standard-type-hierarchy
Marco
--
You received this message because you are subscribed to the Google Groups "Django
developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-developers?hl=en.