I've been experimenting, and I found a strange behavior. In the View class
if I define the __ del__ method, and is never executed. In instances of
other classes, which are members of View, feel the same behavior (eg
HttpRequest is not removed by a garbage collector).

The fault lies primarily in this line (django/views/generic/base.py):

def view(request, *args, **kwargs):
    # [...]
*    if hasattr(self, 'get') and not hasattr(self, 'head'):
        self.head = self.get*
    # [...]

When you create alias methods once the class has been instantiated seems to
make some references (cyclical?) which prevent the garbage collector remove
them.

I have reproduced the same behavior with simple classes to verify the
problem: https://gist.github.com/4475138
If a custom view defines a head method, the problem disappears.

So, is how it should work? I'm wrong about something?

Thank you very much.

--
Andrey Antukh - Андрей Антух - <n...@niwi.be>
http://www.niwi.be/about.html
http://www.kaleidos.net/A5694F/

"Linux is for people who hate Windows, BSD is for people who love UNIX"
"Social Engineer -> Because there is no patch for human stupidity"

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to