[PATCH] [sobjects/notification] fix broken email notifications

Nicola Spanti nicola.spanti at logilab.fr
Fri Jan 10 10:58:22 CET 2020


Published. Thanks. It would have been good to add a unit test.

Le 09/01/2020 à 17:54, Philippe Pepiot a écrit :
> # HG changeset patch
> # User Philippe Pepiot <philippe.pepiot at logilab.fr>
> # Date 1578588676 -3600
> #      Thu Jan 09 17:51:16 2020 +0100
> # Node ID 000cd62eda32385b7f16e117e0c75759591ecfd8
> # Parent  e150ed316dfccc642b09d31685608c2978a48d59
> # Available At https://hg.logilab.org/review/cubicweb
> #              hg pull https://hg.logilab.org/review/cubicweb -r 000cd62eda32
> [sobjects/notification] fix broken email notifications
> 
> In https://hg.logilab.org/review/cubicweb/rev/8caa109dfe945592a34904bb56971cc57d1c6084 EntityView.w become a method using EntityView._w
> In notifications we reset "self.w" for every notifications since we handle multiple streams.
> 
> We should set "self._w" to None instead, otherwise subsequent calls to "self.w()" will fail with TypeError: 'NoneType' object is not callable.
> 
> diff --git a/cubicweb/sobjects/notification.py b/cubicweb/sobjects/notification.py
> --- a/cubicweb/sobjects/notification.py
> +++ b/cubicweb/sobjects/notification.py
> @@ -121,7 +121,7 @@ class NotificationView(EntityView):
>                   try:
>                       # since the same view (eg self) may be called multiple time and we
>                       # need a fresh stream at each iteration, reset it explicitly
> -                    self.w = None
> +                    self._w = None
>                       try:
>                           # XXX forcing the row & col here may make the content and
>                           #     subject inconsistent because subject will depend on
> 



More information about the cubicweb-devel mailing list