Skip to main content

Policy for Ufficio Stampa

Project description

Prodotto per la gestione delle comunicazioni alla stampa.

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

Support

If you are having issues, please let us know. We have a mailing list located at: project@example.com

License

The project is licensed under the GPLv2.

Contributors

Changelog

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]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rer.ufficiostampa-3.0.0.tar.gz (287.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rer.ufficiostampa-3.0.0-py3-none-any.whl (109.8 kB view details)

Uploaded Python 3

File details

Details for the file rer.ufficiostampa-3.0.0.tar.gz.

File metadata

  • Download URL: rer.ufficiostampa-3.0.0.tar.gz
  • Upload date:
  • Size: 287.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.12

File hashes

Hashes for rer.ufficiostampa-3.0.0.tar.gz
Algorithm Hash digest
SHA256 a9d18095d601c58b2d538f665d63f3af31bc8f6097e6dac7ea9521bb62e54264
MD5 39ad712e467902eaeed0daa43400235f
BLAKE2b-256 6dea6686bcf00ef3c545b64b1e8a659456e043a5201c87d4eedae23ae1c2fe14

See more details on using hashes here.

File details

Details for the file rer.ufficiostampa-3.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for rer.ufficiostampa-3.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a883a21f77f8a34fbeda70395e16a28d11146d78d87bf5b2dfe153c97e95cabf
MD5 e2c7e989641d20df34cd30bb57799b44
BLAKE2b-256 8f550bce7acc8b0afaf13a5b750b23fdab4f10421c8c09b5d2ec384e7e9abf2e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page