From 8070b5c5ad1ce594c67ce93a60086653412f3aaf Mon Sep 17 00:00:00 2001 From: l0rda Date: Sun, 27 Apr 2014 23:36:02 +0400 Subject: [PATCH] Fix for python 2.x. There is a difference with dict.keys() in Python 2 & 3 versions. So if we use python 2.x, activation will never work. This commit will fix problem. Python 2.7.5 (default, Aug 25 2013, 00:04:04) [GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> x = {'aaa':1,'bbb':2} >>> x.keys() ['aaa', 'bbb'] >>> x.keys() == {'aaa','bbb'} False >>> x.keys() == ['aaa','bbb'] True >>> list(x.keys()) == ['bbb', 'aaa'] True Python 3.4.0 (default, Mar 25 2014, 11:07:05) [GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.38)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> x = {'aaa':1,'bbb':2} >>> x.keys() dict_keys(['bbb', 'aaa']) >>> x.keys() == ['bbb', 'aaa'] False >>> list(x.keys()) == ['bbb', 'aaa'] True --- regme/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regme/forms.py b/regme/forms.py index 626c42e..ef4a2a5 100644 --- a/regme/forms.py +++ b/regme/forms.py @@ -79,7 +79,7 @@ class UserActivationForm(forms.Form): def clean(self): - if self.cleaned_data.keys() == {'username', 'activation_key'}: + if list(self.cleaned_data.keys()) == ['username', 'activation_key']: try: user = User._default_manager.get(