[Python-modules-team] Bug#745756: python-django-registration: Sends user_activated signal twice

Mark Caglienzi mark.caglienzi at gmail.com
Thu Apr 24 19:15:28 UTC 2014


Package: python-django-registration
Version: 1.0-1
Severity: normal
Tags: patch

Dear Maintainer,
I am using python-django-registration in a couple of projects, and today I
encountered this problem [0]: when activating a user, django-registration
triggers the signal twice.
On stackoverflow there is an answer that links to this patch (done in a
bitbucket fork of the main repository, made by a user called Kami.) [1].

I'm not a packager, but I tried to do my best to obtain a patched debian
package, so that it would be easier work with it (for me and my colleagues).

I simply did:
* dget
* dch
* dpkg-source --commit
* debuild -us -uc

The resulting package installed well with dpkg and the problem was indeed
solved by Kami's patch.

So I'm reporting the bug and attaching the result of debdiff of the two
packages' dsc. If I can do something to help building a possible better patch,
feel free to tell me.

Kind regards,
Mark

[0]: https://stackoverflow.com/questions/18789048/django-registration-user-activated-signal-sent-twice
[1]: https://bitbucket.org/kami/django-registration/commits/6a0aff33bcf2cc24190916c74bc1b6822622d45a



-- System Information:
Debian Release: jessie/sid
  APT prefers testing
  APT policy: (500, 'testing')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 3.13-1-amd64 (SMP w/8 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages python-django-registration depends on:
ii  libjs-sphinxdoc  1.2.2+dfsg-1
ii  python           2.7.5-5
ii  python-django    1.5.4-1

python-django-registration recommends no packages.

python-django-registration suggests no packages.

-- no debconf information

-- 
. ''`.  | GPG Public Key  : 0xCD542422 - Download it from http://is.gd/fOa7Vm
: :'  : | GPG Fingerprint : 0823 A40D F31B 67A8 5621 AD32 E293 A2EB CD54 2422
`. `'`  | Powered by Debian GNU/Linux, http://www.debian.org
  `-    | Try not. Do, or do not. There is no try. - Master Yoda, TESB.
-------------- next part --------------
diff -Nru python-django-registration-1.0/debian/changelog python-django-registration-1.0/debian/changelog
--- python-django-registration-1.0/debian/changelog	2013-07-01 14:36:29.000000000 +0200
+++ python-django-registration-1.0/debian/changelog	2014-04-24 16:16:35.000000000 +0200
@@ -1,3 +1,10 @@
+python-django-registration (1.0-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Don't send user_activated signal twice.
+
+ -- Mark Caglienzi <mark.caglienzi at gmail.com>  Thu, 24 Apr 2014 16:15:47 +0200
+
 python-django-registration (1.0-1) unstable; urgency=low
 
   * New stable upstream.
diff -Nru python-django-registration-1.0/debian/patches/send_signal_only_once_when_activating_user python-django-registration-1.0/debian/patches/send_signal_only_once_when_activating_user
--- python-django-registration-1.0/debian/patches/send_signal_only_once_when_activating_user	1970-01-01 01:00:00.000000000 +0100
+++ python-django-registration-1.0/debian/patches/send_signal_only_once_when_activating_user	2014-04-24 16:20:53.000000000 +0200
@@ -0,0 +1,102 @@
+Description: Fixes double signal sending when activating user.
+ .
+ python-django-registration (1.0-1.1) UNRELEASED; urgency=medium
+ .
+   * Non-maintainer upload.
+   * Don't send user_activated signal twice.
+Author: Mark Caglienzi <mark.caglienzi at gmail.com>
+Origin: other, https://bitbucket.org/kami/django-registration/commits/6a0aff33bcf2cc24190916c74bc1b6822622d45a#chg-registration/views.py
+
+--- python-django-registration-1.0.orig/registration/views.py
++++ python-django-registration-1.0/registration/views.py
+@@ -7,7 +7,6 @@ from django.shortcuts import redirect
+ from django.views.generic.base import TemplateView
+ from django.views.generic.edit import FormView
+ 
+-from registration import signals
+ from registration.forms import RegistrationForm
+ 
+ 
+@@ -16,7 +15,7 @@ class _RequestPassingFormView(FormView):
+     A version of FormView which passes extra arguments to certain
+     methods, notably passing the HTTP request nearly everywhere, to
+     enable finer-grained processing.
+-    
++
+     """
+     def get(self, request, *args, **kwargs):
+         # Pass request to get_form_class and get_form for per-request
+@@ -60,7 +59,7 @@ class _RequestPassingFormView(FormView):
+ class RegistrationView(_RequestPassingFormView):
+     """
+     Base class for user registration views.
+-    
++
+     """
+     disallowed_url = 'registration_disallowed'
+     form_class = RegistrationForm
+@@ -72,7 +71,7 @@ class RegistrationView(_RequestPassingFo
+         """
+         Check that user signup is allowed before even bothering to
+         dispatch or do other processing.
+-        
++
+         """
+         if not self.registration_allowed(request):
+             return redirect(self.disallowed_url)
+@@ -81,7 +80,7 @@ class RegistrationView(_RequestPassingFo
+     def form_valid(self, request, form):
+         new_user = self.register(request, **form.cleaned_data)
+         success_url = self.get_success_url(request, new_user)
+-        
++
+         # success_url may be a simple string, or a tuple providing the
+         # full argument set for redirect(). Attempting to unpack it
+         # tells us which one it is.
+@@ -95,7 +94,7 @@ class RegistrationView(_RequestPassingFo
+         """
+         Override this to enable/disable user registration, either
+         globally or on a per-request basis.
+-        
++
+         """
+         return True
+ 
+@@ -104,15 +103,15 @@ class RegistrationView(_RequestPassingFo
+         Implement user-registration logic here. Access to both the
+         request and the full cleaned_data of the registration form is
+         available here.
+-        
++
+         """
+         raise NotImplementedError
+-                
++
+ 
+ class ActivationView(TemplateView):
+     """
+     Base class for user activation views.
+-    
++
+     """
+     http_method_names = ['get']
+     template_name = 'registration/activate.html'
+@@ -120,9 +119,6 @@ class ActivationView(TemplateView):
+     def get(self, request, *args, **kwargs):
+         activated_user = self.activate(request, *args, **kwargs)
+         if activated_user:
+-            signals.user_activated.send(sender=self.__class__,
+-                                        user=activated_user,
+-                                        request=request)
+             success_url = self.get_success_url(request, activated_user)
+             try:
+                 to, args, kwargs = success_url
+@@ -134,7 +130,7 @@ class ActivationView(TemplateView):
+     def activate(self, request, *args, **kwargs):
+         """
+         Implement account-activation logic here.
+-        
++
+         """
+         raise NotImplementedError
+ 
diff -Nru python-django-registration-1.0/debian/patches/series python-django-registration-1.0/debian/patches/series
--- python-django-registration-1.0/debian/patches/series	1970-01-01 01:00:00.000000000 +0100
+++ python-django-registration-1.0/debian/patches/series	2014-04-24 16:18:50.000000000 +0200
@@ -0,0 +1 @@
+send_signal_only_once_when_activating_user
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/python-modules-team/attachments/20140424/cdf62d53/attachment-0001.sig>


More information about the Python-modules-team mailing list