Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete Account fails #285

Open
reillychase opened this issue Mar 30, 2018 · 2 comments
Open

Delete Account fails #285

reillychase opened this issue Mar 30, 2018 · 2 comments

Comments

@reillychase
Copy link

Issue Summary

While logged in, trying to delete account results in a django error page.

Debug

Account delete error:

xpire_date" > '2018-03-30T16:09:31.292697+00:00'::timestamptz AND "django_session"."session_key" = '2iovj0911oh06d2inilmtyj6ug17a42e'); args=(datetime.datetime(2018, 3, 30, 16, 9, 31, 292697, tzinfo=<UTC>), '2iovj0911oh06d2inilmtyj6ug17a42e')
(0.001) SELECT "auth_user"."id", "auth_user"."password", "auth_user"."last_login", "auth_user"."is_superuser", "auth_user"."username", "auth_user"."first_name", "auth_user"."last_name", "auth_user"."email", "auth_user"."is_staff", "auth_user"."is_active", "auth_user"."date_joined" FROM "auth_user" WHERE "auth_user"."id" = 1; args=(1,)
(0.001) SELECT "account_accountdeletion"."id", "account_accountdeletion"."user_id", "account_accountdeletion"."email", "account_accountdeletion"."date_requested", "account_accountdeletion"."date_expunged" FROM "account_accountdeletion" WHERE "account_accountdeletion"."user_id" = 1; args=(1,)
(0.001) UPDATE "account_accountdeletion" SET "user_id" = 1, "email" = 'rchase@locklinnetworks.com', "date_requested" = '2018-03-30T15:33:24.601082+00:00'::timestamptz, "date_expunged" = NULL WHERE "account_accountdeletion"."id" = 1; args=(1, 'rchase@locklinnetworks.com', datetime.datetime(2018, 3, 30, 15, 33, 24, 601082, tzinfo=<UTC>), 1)
Internal Server Error: /account/delete/
Traceback (most recent call last):
  File "/home/rchase/hostifinetenv/lib/python3.6/site-packages/django/core/handlers/exception.py", line 35, in inner
    response = get_response(request)
  File "/home/rchase/hostifinetenv/lib/python3.6/site-packages/django/core/handlers/base.py", line 128, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/rchase/hostifinetenv/lib/python3.6/site-packages/django/core/handlers/base.py", line 126, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/rchase/hostifinetenv/lib/python3.6/site-packages/django/views/generic/base.py", line 69, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/rchase/hostifinetenv/lib/python3.6/site-packages/django/utils/decorators.py", line 62, in _wrapper
    return bound_func(*args, **kwargs)
  File "/home/rchase/hostifinetenv/lib/python3.6/site-packages/django/views/decorators/cache.py", line 44, in _wrapped_view_func
    response = view_func(request, *args, **kwargs)
  File "/home/rchase/hostifinetenv/lib/python3.6/site-packages/django/utils/decorators.py", line 58, in bound_func
    return func.__get__(self, type(self))(*args2, **kwargs2)
  File "/home/rchase/hostifinetenv/lib/python3.6/site-packages/account/views.py", line 421, in dispatch
    return super(LogoutView, self).dispatch(*args, **kwargs)
  File "/home/rchase/hostifinetenv/lib/python3.6/site-packages/django/views/generic/base.py", line 89, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/rchase/hostifinetenv/lib/python3.6/site-packages/account/views.py", line 805, in post
    AccountDeletion.mark(self.request.user)
  File "/home/rchase/hostifinetenv/lib/python3.6/site-packages/account/models.py", line 391, in mark
    settings.ACCOUNT_DELETION_MARK_CALLBACK(account_deletion)
  File "/home/rchase/hostifinetenv/lib/python3.6/site-packages/django/conf/__init__.py", line 57, in __getattr__
    val = getattr(self._wrapped, name)
AttributeError: 'Settings' object has no attribute 'ACCOUNT_DELETION_MARK_CALLBACK'
@reillychase
Copy link
Author

Looks like I've identified (but not fixed) the account delete problem, it is referenced here:
http://blog.pinaxproject.com/2016/10/20/2-0-0-release-django-user-accounts-has-landed/

"This change brings the previously defined functions in the callbacks.py module into line with the hooksets convention we’ve been using for awhile now. It does mean that if you have functions defined in your site for the following settings: ACCOUNT_DELETION_MARK_CALLBACK or ACCOUNT_DELETION_EXPUNGE_CALLBACK you will need to migrate those functions to a hookset implementation if you don’t already have one to add to."

Still not sure what the solution is though or why this isn't working. I'm on latest Django and latest Pinax-stripe

@grahamu
Copy link
Contributor

grahamu commented Mar 30, 2018

ACCOUNT_DELETION_MARK_CALLBACK was removed from settings in this commit: 526bcda, but the latest models.py references settings.ACCOUNT_DELETION_MARK_CALLBACK https://github.com/pinax/django-user-accounts/blob/master/account/models.py#L389

Seems like a straightforward bug.

A good PR for this requires:

  • change models.py AccountDeletion to invoke hookset.account_delete_mark and hookset.account_delete_expunge with from account.hooks import hookset.
  • Invoke AccountDeletion.mark and AccountDeletion.expunge methods with test code proving expected results. Post to DeleteView to test mark. Invoke AccountDeletion.expunge class method directly.
  • update documentation for same (remove ACCOUNT_DELETION_*_CALLBACK settings entries, add to ACCOUNT_HOOKSET methods)

geobaldi added a commit to ripiu/django-user-accounts that referenced this issue Oct 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants