Skip to main content

Prodotto per la gestione delle comunicazioni alla stampa.

python version ci downloads License

Funzionalità principali

  • Content-type dedicati (Comunicato Stampa e Invito Stampa)

  • Gestione canali di iscrizioni per i giornalisti

  • Invio dei comunicati

Content-type

Sono presenti due content-type uguali tra loro per la gestione di due tipi diversi di comunicazioni:

  • Comunicato Stampa

  • Invito Stampa

Sono delle pagine con due campi aggiuntivi (Argomenti e Legislatura) e folderish (in cui si può inserire solo Immagini, File e Cartelle).

Progressivo Comunicato Stampa

I comunicati stampa hanno un progressivo rispetto all’anno corrente (es: 1/2021).

Ogni volta che viene pubblicato un Comunicato Stampa, viene incrementato il progressivo e il valore viene associato a quel comunicato (scritto in un campo).

Il primo Comunicato Stampa inviato in un anno, parte col numero 1.

Database iscritti

C’è un database interno (basato su souper.plone) nel quale vengono memorizzati i dati degli iscritti.

E’ possibile interrogare il database tramite rotte api (vedi in seguito) o mediante utility Plone:

from zope.component import getUtility
from rer.ufficiostampa.interfaces import ISubscriptionsStore

tool = getUtility(ISubscriptionsStore)

Di seguito vengono riportati i principali metodi.

Aggiunta iscritto

  • Metodo add

  • Parametri: data (dizionario con i parametri)

  • Risposta: l’id univoco del nuovo record

data deve essere un dizionario con la lista di possibili parametri:

  • email [obbligatorio]: indirizzo a cui inviare i comunicati

  • channels [obbligatorio]: lista dei canali di invio di interesse

  • name: nome dell’iscritto

  • surname: cognome dell’iscritto

  • phone: numero di telefono dell’iscritto

  • newspaper: nome della testata giornalistica di riferimento dell’iscritto

Altri campi verranno ignorati.

Ricerca iscritti

  • Metodo search

  • Parametri: query (dizionario con i parametri), sort_index (default=date), reverse (default=False)

  • Risposta: la lista di risultati

query è un dizionario che può contenere uno o più dei seguenti parametri:

  • text (viene ricercato nei campi nome, email e cognome)

  • channels

  • newspaper

Aggiornamento dati iscritto

  • Metodo update

  • Parametri: data (dizionario con i parametri), id (identificativo dell’iscritto)

  • Risposta:

data è un dizionario che può contenere uno o più dei parametri di iscrizione.

Cancellazione iscritto

  • Metodo delete

  • Parametri: id (identificativo dell’iscritto)

  • Risposta:

Reset database

  • Metodo clear

  • Parametri:

  • Risposta:

Rotte restapi

Lista iscritti

@subscriptions

Endpoint da chiamare in GET sulla radice del sito.

Ritorna la lista degli iscritti e i possibili canali. Solo per gli utenti che hanno il permesso “rer.ufficiostampa.ManageChannels”:

> curl -i -X GET http://localhost:8080/Plone/@subscriptions -H 'Accept: application/json' -H 'Content-Type: application/json' --user admin:admin

La risposta è simile a questa:

{
    "@id": "http://localhost:8080/Plone/@subscriptions",
    "items": [
        ...
    ],
    "items_total": 42,
    "channels": [...]
}

Creazione nuovo iscritto

@subscriptions

Endpoint da chiamare in POST sulla radice del sito.

Solo per gli utenti che hanno il permesso “rer.ufficiostampa.ManageChannels”:

> curl -i -X POST http://localhost:8080/Plone/@subscriptions -H 'Accept: application/json' -H 'Content-Type: application/json' --data-raw '{"email": "foo@plone.org", "channels": ["first", "second"]}' --user admin:admin

Se l’operazione va a buon fine, il server ritorna un 204.

Aggiornamento dati iscritto

@subscriptions

Endpoint da chiamare in PATCH sulla radice del sito.

Solo per gli utenti che hanno il permesso “rer.ufficiostampa.ManageChannels”:

> curl -i -X PATCH http://localhost:8080/Plone/@subscriptions/subscription_id -H 'Accept: application/json' -H 'Content-Type: application/json' --data-raw '{"email": "foo@plone.org", "name": "John"}' --user admin:admin

Dove subscription_id è l’id dell’iscritto da aggiornare.

Se l’operazione va a buon fine, il server ritorna un 204.

Valgono le regole dei campi per la creazione.

Cancellazione iscritto

@subscriptions

Endpoint da chiamare in DELETE sulla radice del sito.

Solo per gli utenti che hanno il permesso “rer.ufficiostampa.ManageChannels”:

> curl -i -X DELETE http://localhost:8080/Plone/@subscriptions/subscription_id -H 'Accept: application/json' --user admin:admin

Dove subscription_id è l’id dell’iscritto da aggiornare.

Se l’operazione va a buon fine, il server ritorna un 204.

Cancellazione iscritto

@subscriptions-clear

Endpoint da chiamare in GET sulla radice del sito.

Solo per gli utenti che hanno il permesso “rer.ufficiostampa.ManageChannels”:

> curl -i -X DELETE http://localhost:8080/Plone/@subscriptions-clear -H 'Accept: application/json' --user admin:admin

Svuota completamente il db degli iscritti.

Se l’operazione va a buon fine, il server ritorna un 204.

Export in CSV

@subscriptions-csv

Endpoint da chiamare in GET sulla radice del sito.

Solo per gli utenti che hanno il permesso “rer.ufficiostampa.ManageChannels”:

> curl -i -X GET http://localhost:8080/Plone/@subscriptions-csv -H 'Accept: application/json' --user admin:admin

Ritorna un file csv con la lista degli iscritti.

Import da CSV

@subscriptions-csv

Endpoint da chiamare in POST sulla radice del sito.

Solo per gli utenti che hanno il permesso “rer.ufficiostampa.ManageChannels”:

> curl -i -X POST http://localhost:8080/Plone/@subscriptions-csv -H 'Accept: application/json' -H 'Content-Type: application/json' --data-raw '{"overwrite":true,"file":{"data": "...","encoding":"base64","content-type":"text/comma-separated-values","filename":"iscritti.csv"}}' --user admin:admin

Accetta i seguenti parametri:

  • overwrite: se true, se esiste già un record nel db con l’email presente nel file, questo verrà sovrascritto con i nuovi dati. Se il parametro è mancante o false, viene mantenuto il valore già presente nel db senza aggiornarlo.

  • clear: se true, prima di eseguire l’import, viene completamente cancellato il db.

  • file: il file csv da caricare. Encodato in base64

La chiamata ritorna una risposta del genere:

{
    "imported": 0,
    "skipped": []
}

Dove imported è il numero di elementi inseriti effettivamente nel db, e skipped è la lista di righe del file che sono state ignorate per qualche motivo (entry già presenti e overwrite non impostato).

Se l’email non è valida o channels contiene uno dei canali non impostati nel panello di controllo, allora il procedimeto si interrompe e viene ritonata la risposta con la lista di righe del file che hanno dei valori non validi:

{
    "errored": []
}

Invio asincrono tramite servizio esterno

https://github.com/RegioneER/rer.newsletterdispatcher.flask

Installazione

Install rer.ufficiostampa by adding it to your buildout:

[buildout]

...

eggs =
    rer.ufficiostampa

and then running bin/buildout

Contribute

License

The project is licensed under the GPLv2.

Contributors

Changelog

3.0.8 (2026-01-29)

  • Improve validation and error handling in CSV import endpoint. [cekk]

  • Validate additional email addresses in send form endpoint. [cekk]

3.0.7 (2025-10-30)

  • Go back with package name rer.ufficiostampa. [cekk]

3.0.6 (2025-10-30)

  • Rename package on pypi to rer_ufficiostampa. [cekk]

3.0.5 (2025-10-30)

  • The CSV export service can now be filtered. [cekk]

  • When a channel is removed from the control panel, it is also removed from subscribers. [cekk]

  • Case insensitive subscribers search. [cekk]

  • Remove unused code. [cekk]

3.0.4 (2025-09-25)

  • Add endpoints to manage personal channel subscriptions. [cekk]

3.0.3 (2025-09-22)

  • Cleanup data from subscriptions csv import. [cekk]

  • Add endpoints to manage personal channel subscriptions. [cekk]

3.0.2 (2025-09-19)

  • Do not return Invito in @search-comunicati results. [cekk]

3.0.1 (2025-09-19)

  • Fix token encodings in vocabularies. [cekk]

3.0.0 (2025-09-17)

  • Revert to RER functionalities. [cekk]

  • Add restapi endpoints to search old comunicati. [cekk]

  • Set logo in control panel. [cekk]

  • Add management links in object actions to be used in Volto. [cekk]

  • Create a new CartellaStampa inside every new Comunicato. [cekk]

  • Editors can see list of subscribers but cannot edit them. [cekk]

  • Fix legislature behavior. [cekk]

  • Customize basic behaviors for Comunicato and Invito. [cekk]

  • Remove not maintained old-style browser views. Now it works only with restapi. [cekk]

  • Comunicato and Invito text is now managed with BlocksField and limited with only slate block. [cekk]

  • Flag that allow to automatically select all attachments by default in email form. [cekk]

  • Flag that allow to recursive publish/unpublish all contents inside a Comunicato/Invito. [cekk]

  • Allow to set max attachments size in control panel. [cekk]

  • Improved history and subscribers management. [cekk]

  • Handle status messages in history. [cekk]

2.0.2 (2025-05-12)

  • Add error_message field in history data. [cekk]

2.0.1 (2025-03-03)

  • Re-enable async send. [cekk]

2.0.0 (2025-03-03)

  • Plone 6 compatibility. For Plone <= 5.2 use 1.x releases. [mamico]

1.6.7 (2024-09-19)

  • Change Twitter with X in email templates. [cekk]

1.6.6 (2023-03-14)

  • Do not send duplicated emails lowering all addresses before send. [cekk]

1.6.5 (2023-01-05)

  • Add querystring modifiers for keyword indexes to prevent utf-8 errors. [cekk]

1.6.4 (2023-01-03)

  • Index also text from contents. [cekk]

1.6.3 (2022-11-23)

  • Read value of slave form fields from the querystring. [cekk]

1.6.2 (2022-11-03)

  • Fix field logic. [cekk]

  • Set proper value in legislature field. [cekk]

1.6.1 (2022-10-27)

  • Fix README indentation. [cekk]

1.6.0 (2022-10-27)

  • Handle master/select logic for Legislature and Arguments in search form. [cekk]

  • Additional validations for subscribers import, also new behavior if invalid email/channels passed [foxtrot-dfm1]

1.5.1 (2022-06-06)

  • Pass query to export-csv endpoint to export only selected subscribers. [cekk]

1.5.0 (2022-03-10)

  • Add versioning for Comunicato and Invito. [cekk]

  • Add solrpush behavior for additional fields. [cekk]

1.4.0 (2022-01-20)

  • New search endpoint for comunicati (@search-comunicati). This is needed because new rer.sitesearch overrides @search endpoint and always search on SOLR. [cekk]

1.3.0 (2022-01-20)

  • Normalize title and description on save. [cekk]

  • Add effective date in Comunicato view. [cekk]

1.2.2 (2021-11-04)

  • Arguments field is now required. [cekk]

1.2.1 (2021-09-16)

  • Cleanup subject string before send, to remove strange characters. [cekk]

1.2.0 (2021-09-02)

  • Cleanup channels (remove duplicated ones). [cekk]

  • Refactor how to perform queries (to handle also unicode problems). [cekk]

  • Accessibility fixes: modal focus trap + select keyboard events [nzambello]

1.1.0 (2021-08-05)

  • Disallow add new items in arguments field. [cekk]

  • Export in csv also title and number. [cekk]

  • Correctly wrap search terms with “’” in it. [cekk]

  • Customize social viewlets to fix title and description meta tags (and also add a light dependency with rer.agidtheme.base). [cekk]

  • Add dependency to ftfy to better encode csv exports. [cekk]

1.0.1 (2021-07-09)

  • Fix import for python2 and sort indexes. [cekk]

1.0.0 (2021-05-26)

  • Initial release. [cekk]

Release files for rer.ufficiostampa 3.0.8

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for rer.ufficiostampa 3.0.8
File Size Uploaded
rer_ufficiostampa-3.0.8.tar.gz 289.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rer.ufficiostampa 3.0.8
File Interpreter ABI Platform
rer_ufficiostampa-3.0.8-py3-none-any.whl Python 3 none any Details

Total release size: 401.2 kB

Release files / rer_ufficiostampa-3.0.8.tar.gz

Download URL rer_ufficiostampa-3.0.8.tar.gz
Size 289.8 kB
Tags Source
SHA-256 checksum
How to use checksums
e17ec2232c5de785d570ad4e95092c76927943560f4f4d19140b2dd6f8f610d8
BLAKE2b-256 checksum
How to use checksums
471a863fe3aa162a23b37f19b9dcf3362c207187fa023346b5696c263b77eeba
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release files / rer_ufficiostampa-3.0.8-py3-none-any.whl

Download URL rer_ufficiostampa-3.0.8-py3-none-any.whl
Size 111.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
faf589fcad009d69b28c5d6a5ca5b4cf0732e33fa7c1da2a7f3cf111fb5c80ad
BLAKE2b-256 checksum
How to use checksums
f62579aa13fc91c4cefbc799ac3906d9be393427c93c9c0e18bc476f733b2627
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

3.0.8 This release

2 release files

3.0.7

2 release files

3.0.6

2 release files

3.0.4

2 release files

3.0.3

2 release files

3.0.2

2 release files

3.0.1

2 release files

3.0.0

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.6.7

2 release files

1.6.6

1 release file

1.6.5

1 release file

1.6.4

1 release file

1.6.3

1 release file

1.6.2

1 release file

1.6.1

1 release file

1.5.2

1 release file

1.5.0

1 release file

1.4.0

1 release file

1.3.0

1 release file

1.2.2

1 release file

1.2.1

1 release file

1.2.0

1 release file

1.1.0

1 release file

1.0.1

1 release file

1.0.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page