[GeoNode-devel] Geonode notifications (old and new)

Cezary Statkiewicz cezary.statkiewicz at geo-solutions.it
Fri May 5 09:49:33 PDT 2017


On Friday, May 5, 2017 3:24:56 PM CEST Simone Dalmasso wrote:
> Hi Cezary,

 Hi!

> thanks for the good summary of issues, this will be useful.
> As you said the notification app will be completely rewritten soon and I
> think that your suggestions are precious.
> 
> Have you tried the 2.6.x branch too?

 No, I haven't. I'm working on 2.7 actually, so, after a second thought, 
pubsub is not my main concern here.

> To answer your questions, the reason of forking the apps was for two
> reasons:
> - we needed to change few small things to make them compatible with geonode
> like [1]

 Right. But similar change was introduced some time later to pinax version [1] 

> - we needed to push them to pypi and launchpad as packages.
> and some of them didn't seem maintained anymore when we did it.
> They are all used by the geonode ubuntu installer and python installer.


 Original app is also on on pypi [2]. It also supports current Django 
versions. I believe deb packages can be created from it as well (I couldn't 
locate any deb-packaging specific code in notification app, so I assume you're 
using pybuild or something similar).

 I've checked also geonode-user-accounts. While it's missing geonode-
notification dependency in setup.py, it's using it for sending registration 
moderation emails [3]. I believe this could be decoupled from geonode-user-
accounts, using signal handler in geonode [4]. Do you think it is possible to 
synchronize with django-user-accounts or port geonode-specific changes (like 
registration moderation) to upstream?

 I'm making an attempt to replace notification app with original pinax 
version, as it's better maintained. Part of it would be to use 
NOTIFICATIONS_MODULE setting, which would name notification app (notification 
or pinax.notifications). Also, integration code is repeated in management/
__init__.py files in several places. I'm rewriting this to have single point 
of installation of notification types (with respect to INSTALLED_APPS).

 BR,

 CS

[1] https://github.com/pinax/pinax-notifications/pull/34/files
[2] https://github.com/GeoNode/geonode-user-accounts/blob/master/account/
views.py#L136
[3] https://pypi.python.org/pypi/pinax-notifications/
[4] https://github.com/GeoNode/geonode-user-accounts/blob/master/account/
signals.py#L6



> [1]
> https://github.com/GeoNode/geonode-notification/commit/41b1b9acbb4ba9f621c1a
> dcdceef692144959b51
> 
> 
> 
> 2017-05-05 14:35 GMT+02:00 Cezary Statkiewicz <
> 
> cezary.statkiewicz at geo-solutions.it>:
> >  Hi,
> >  
> >  I wanted to use geonode-notification app [1], but found it won't work
> > 
> > with GeoNode master branch. I'd like to list problems I've bumped into and
> > 
> > establish if my understanding is correct:
> >  * app code itself seems to be a copy of old version of
> > 
> > pinax-notifications (renamed from django-notification) [2]. Besides
> > renaming to geonode-notification, I can't tell if there are any functional
> > differences between those two. Core functionality code seems to be not
> > updated since then.
> > 
> >  * settings template (notification/notice_settings.html) is present both
> > 
> > in GeoNode [3] and in app [4], and are almost the same (except for button
> > element in the bottom). This is clear code duplication.
> > 
> >  * settings template inherits from notification/base.html, which inherits
> > 
> > from account/base.html template, which is not present anywhere (not in
> > GeoNode, not in geonode-notification/pinax-notifications). Some clue
> > would be dependency on django-user-account in pinax app (which was also
> > copied to geonode-user-accounts app in the past). So, settings view won't
> > work, unless inheritance base is changed to existing template.
> > 
> >  * integration code in GeoNode 2.6 ([5] for example) won't work and won't
> > 
> > populate Notification types, because signals binding has different
> > signature. Proper signal binding involves AppConfig instance, which was
> > introduced in Django 1.7. Working integration code is described in updated
> > pinax app (see below for similar problem in master branch).
> > 
> >  * Current dev version of GeoNode introduced new notification dispatching
> > 
> > mechanism [6], which uses notification app as a consumer (not directly,
> > but
> > mechanism is used in callbacks [13]). In GNIP PR, there are traces of
> > refactoring notification app integration: [7], [8]. Code from [7] uses
> > deprecated post_syncdb signal [9][10]. Instead it should use proper
> > AppConfig or, as provided by Pinax app docs [11]. I'm not sure why part of
> > NoticeTypes are created in signal handler, while other are created with
> > script.
> > 
> >  * Some work for making this mechanism optional (or co-working with
> > 
> > notification app) was started [12], but that PR seems to be in early
> > stages.> 
> > My concerns and questions here are as follows:
> >  1. Why geonode-notification app was created? It doesn't provide any
> > 
> > additional functionality over original pinax apps.
> > 
> >  2. It seems geonode-notificaiton app is not maintained at all
> > 
> > (geonode-user-account app as well). Most of code base is 3-4 years old,
> > written for pre-1.7 Django versions. There were few commits to update code
> > with migrations, but that was whole contribution to this app. There are no
> > issues (active nor solved), no pull requests. Is anyone using this app at
> > all?
> > 
> >  3. Wouldn't it be better to advice use of pinax apps directly here? As I
> > 
> > wrote before, geonode-notification app for doesn't provide any new
> > functionality.
> > 
> >  References:
> > [1] https://github.com/GeoNode/geonode-notification
> > [2] https://github.com/pinax/pinax-notifications
> > [3] https://github.com/GeoNode/geonode/blob/2.6.x/geonode/
> > templates/notification/notice_settings.html
> > [4] https://github.com/GeoNode/geonode-notification/blob/
> > master/notification/templates/notification/notice_settings.html
> > [5] https://github.com/GeoNode/geonode/blob/5bd1bfa794d92bb47b2e113f22a1fe
> > 1ed1257ff4/geonode/layers/management/__init__.py#L55
> > [6] https://github.com/GeoNode/geonode/issues/2889
> > [7] https://github.com/GeoNode/geonode/pull/2911/files#diff-> > 3efadb31867c7c011d76f234bf4f3cf9R27
> > [8] https://github.com/GeoNode/geonode/pull/2911/files#diff-> > 2e37d4a8264969d920999e14976b60a1R129
> > [9] https://github.com/GeoNode/geonode/pull/2911/files#diff-> > 3efadb31867c7c011d76f234bf4f3cf9R35
> > [10] https://docs.djangoproject.com/en/1.8/ref/signals/#post-syncdb
> > [11] https://github.com/pinax/pinax-notifications/blob/
> > master/docs/usage.md#creating-notice-types
> > [12] https://github.com/GeoNode/geonode/pull/2995
> > [13] https://github.com/GeoNode/geonode/pull/2911/files#diff-> > 65e028487582782a9d3e44fb6a9884bcL165

-- 
Regards,
Cezary Statkiewicz
==
GeoServer Professional Services from the experts!
Visit http://goo.gl/it488V for more information.
==
Cezary Statkiewicz
Senior Software Engineer

GeoSolutions S.A.S.
Via di Montramito 3/A
55054  Massarosa (LU)
Italy
phone: +39 0584 962313
fax:     +39 0584 1660272

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

-------------------------------------------------------
AVVERTENZE AI SENSI DEL D.Lgs. 196/2003
Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i 
file/s allegato/i sono da considerarsi strettamente riservate. Il loro 
utilizzo è consentito esclusivamente al destinatario del messaggio, per le 
finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio 
senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia 
via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo 
dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, 
distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, 
costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.
 
The information in this message and/or attachments, is intended solely for the 
attention and use of the named addressee(s) and may be confidential or 
proprietary in nature or covered by the provisions of privacy act (Legislative 
Decree June, 30 2003, no.196 - Italy's New Data Protection Code).Any use not 
in accord with its purpose, any disclosure, reproduction, copying, 
distribution, or either dissemination, either whole or partial, is strictly 
forbidden except previous formal approval of the named addressee(s). If you 
are not the intended recipient, please contact immediately the sender by 
telephone, fax or e-mail and delete the information in this message that has 
been received in error. The sender does not give any warranty or accept 
liability as the content, accuracy or completeness of sent messages and 
accepts no responsibility  for changes made after they were sent or for other 
risks which arise as a result of e-mail transmission, viruses, etc.


More information about the geonode-devel mailing list