> The ticket itself is the best guide to any knowledge about the problem; in
> this case, I'm guessing that the answer is no - there isn't a patch or
> workaround. Any help you can provide in tracking the problem (and/or fixing
> it) would be greatfully accepted.

Here's a more complete traceback:

Traceback (most recent call last):
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py" in
get_response
  74. response = callback(request, *callback_args, **callback_kwargs)
File
"/usr/lib/python2.4/site-packages/django/contrib/admin/views/decorators.py"
in _checklogin
  55. return view_func(request, *args, **kwargs)
File
"/usr/lib/python2.4/site-packages/django/views/decorators/cache.py" in
_wrapped_view_func
  39. response = view_func(request, *args, **kwargs)
File
"/usr/lib/python2.4/site-packages/django/contrib/admin/views/main.py"
in delete_stage
  503. _get_deleted_objects(deleted_objects, perms_needed,
request.user, obj, opts, 1)
File
"/usr/lib/python2.4/site-packages/django/contrib/admin/views/main.py"
in _get_deleted_objects
  464. rel_objs = getattr(obj, rel_opts_name, None)

  TypeError at /admin/test/person/2/delete/
  getattr(): attribute name must be string

There seem to be two relevant pieces of code:

In _get_deleted_objects:
        rel_opts_name = related.get_accessor_name()
        has_related_objs = False
        rel_objs = getattr(obj, rel_opts_name, None)
        if rel_objs:
            has_related_objs = True

related.get_accessor_name() can return None, this doesn't account for
that. So let's see get_accessor_name, which says:

            # If this is a symmetrical m2m relation on self, there is
no reverse accessor.
            if getattr(self.field.rel, 'symmetrical', False) and
self.model == self.parent_model:
                return None

I tried both commenting out that special case check in
get_accessor_name and adding a couple lines to _get_deleted_objects:
        rel_opts_name = related.get_accessor_name()
        has_related_objs = False
        if rel_opts_name:
            rel_objs = getattr(obj, rel_opts_name, None)
        else:
            rel_objs = None
        if rel_objs:
            has_related_objs = True

This case in particular seems to work fine when either or both of these
changes are applied, but I'm not sure if they break something else or
are secretly making the database all messy.  Anyway, the key point is
that anything using get_accessor_name() should take None into account,
or None should never be returned.


--~--~---------~--~----~------------~-------~--~----~
 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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to