{"issue":{"pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"state":"closed","user":{"avatar_url":"https://secure.gravatar.com/avatar/2fbd59ebf1e0808716a569f0305d2873?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"2fbd59ebf1e0808716a569f0305d2873","url":"https://api.github.com/users/glibersat","login":"glibersat","id":262663},"milestone":null,"assignee":null,"labels":[],"updated_at":"2011-10-28T19:12:33Z","comments":2,"closed_at":"2011-10-28T19:12:33Z","url":"https://api.github.com/repos/lukaszb/django-guardian/issues/54","body":"Hi,\r\n\r\nWhile my users' permissions are correct, I get the following traceback when checking a permission for a given user. I can't reproduce it in the shell, but it always happen when run through a django view :\r\n\r\nTraceback (most recent call last):\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/django/core/handlers/base.py\", line 111, in get_response\r\n    response = callback(request, *callback_args, **callback_kwargs)\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/django/contrib/auth/decorators.py\", line 23, in _wrapped_view\r\n    return view_func(request, *args, **kwargs)\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/imaginationforpeople/apps/member/views.py\", line 143, in profile_edit\r\n    if not current_user.has_perm('change_profile', profile):\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/django/contrib/auth/models.py\", line 324, in has_perm\r\n    return _user_has_perm(self, perm, obj)\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/django/contrib/auth/models.py\", line 181, in _user_has_perm\r\n    backend.has_perm(user, perm, obj)):\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/guardian/backends.py\", line 59, in has_perm\r\n    return check.has_perm(perm, obj)\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/guardian/core.py\", line 49, in has_perm\r\n    return perm in self.get_perms(obj)\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/guardian/core.py\", line 77, in get_perms\r\n    .values_list(\"codename\"))))\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/django/db/models/query.py\", line 514, in values_list\r\n    _fields=fields)\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/django/db/models/query.py\", line 754, in _clone\r\n    query = self.query.clone()\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/django/db/models/sql/query.py\", line 247, in clone\r\n    obj.where = deepcopy(self.where, memo=memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 173, in deepcopy\r\n    y = copier(memo)\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/django/utils/tree.py\", line 61, in __deepcopy__\r\n    obj.children = deepcopy(self.children, memodict)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 228, in _deepcopy_list\r\n    y.append(deepcopy(a, memo))\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 173, in deepcopy\r\n    y = copier(memo)\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/django/utils/tree.py\", line 61, in __deepcopy__\r\n    obj.children = deepcopy(self.children, memodict)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 228, in _deepcopy_list\r\n    y.append(deepcopy(a, memo))\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 173, in deepcopy\r\n    y = copier(memo)\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/django/utils/tree.py\", line 61, in __deepcopy__\r\n    obj.children = deepcopy(self.children, memodict)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 228, in _deepcopy_list\r\n    y.append(deepcopy(a, memo))\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 173, in deepcopy\r\n    y = copier(memo)\r\n\r\n  File \"/home/www/virtualenvs/imaginationforpeople.org/lib/python2.6/site-packages/django/utils/tree.py\", line 61, in __deepcopy__\r\n    obj.children = deepcopy(self.children, memodict)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 228, in _deepcopy_list\r\n    y.append(deepcopy(a, memo))\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 235, in _deepcopy_tuple\r\n    y.append(deepcopy(a, memo))\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 189, in deepcopy\r\n    y = _reconstruct(x, rv, 1, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 338, in _reconstruct\r\n    state = deepcopy(state, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 189, in deepcopy\r\n    y = _reconstruct(x, rv, 1, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 338, in _reconstruct\r\n    state = deepcopy(state, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 235, in _deepcopy_tuple\r\n    y.append(deepcopy(a, memo))\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 189, in deepcopy\r\n    y = _reconstruct(x, rv, 1, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 338, in _reconstruct\r\n    state = deepcopy(state, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 189, in deepcopy\r\n    y = _reconstruct(x, rv, 1, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 338, in _reconstruct\r\n    state = deepcopy(state, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 235, in _deepcopy_tuple\r\n    y.append(deepcopy(a, memo))\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 189, in deepcopy\r\n    y = _reconstruct(x, rv, 1, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 338, in _reconstruct\r\n    state = deepcopy(state, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 235, in _deepcopy_tuple\r\n    y.append(deepcopy(a, memo))\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 189, in deepcopy\r\n    y = _reconstruct(x, rv, 1, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 338, in _reconstruct\r\n    state = deepcopy(state, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 189, in deepcopy\r\n    y = _reconstruct(x, rv, 1, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 338, in _reconstruct\r\n    state = deepcopy(state, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 235, in _deepcopy_tuple\r\n    y.append(deepcopy(a, memo))\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 189, in deepcopy\r\n    y = _reconstruct(x, rv, 1, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 338, in _reconstruct\r\n    state = deepcopy(state, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 189, in deepcopy\r\n    y = _reconstruct(x, rv, 1, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 338, in _reconstruct\r\n    state = deepcopy(state, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 235, in _deepcopy_tuple\r\n    y.append(deepcopy(a, memo))\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 189, in deepcopy\r\n    y = _reconstruct(x, rv, 1, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 338, in _reconstruct\r\n    state = deepcopy(state, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 235, in _deepcopy_tuple\r\n    y.append(deepcopy(a, memo))\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 189, in deepcopy\r\n    y = _reconstruct(x, rv, 1, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 338, in _reconstruct\r\n    state = deepcopy(state, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 162, in deepcopy\r\n    y = copier(x, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 255, in _deepcopy_dict\r\n    y[deepcopy(key, memo)] = deepcopy(value, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 189, in deepcopy\r\n    y = _reconstruct(x, rv, 1, memo)\r\n\r\n  File \"/usr/lib/python2.6/copy.py\", line 323, in _reconstruct\r\n    y = callable(*args)\r\n\r\n  File \"/usr/lib/python2.6/copy_reg.py\", line 93, in __newobj__\r\n    return cls.__new__(cls, *args)\r\n\r\nTypeError: instancemethod expected at least 2 arguments, got 0\r\n\r\n\r\n\r\nMy backends are the following:\r\n\r\nAUTHENTICATION_BACKENDS = (\r\n    'userena.backends.UserenaAuthenticationBackend',\r\n    'guardian.backends.ObjectPermissionBackend',\r\n    'django.contrib.auth.backends.ModelBackend',\r\n)\r\n\r\nAnd my versions:\r\nDjango 1.3.1, Guardian 1.0.3\r\n\r\nThank you !\r\n\r\nGuillaume","html_url":"https://github.com/lukaszb/django-guardian/issues/54","number":54,"title":"Unexpected crash when checking for permission","id":2034176,"created_at":"2011-10-24T14:26:56Z"},"action":"closed"}