Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Introduction

Provides a viewlet (and under-the-hood machinery) for managers that allows to publish contents to social networks (only twitter ATM). Social publication can be automated by enabling it per-content.

To enable the viewlet just mark the content-type you want with collective.socialpublisher.interfaces.IPublishable. You can do it from ZMI or trough ZMCL:

<class class="Products.ATContentTypes.content.event.ATEvent">
    <implements interface="collectinve.socialpublisher.interfaces.IPublishable" />
</class>

NOTE: this is already done by the package in this alpha stage.

Twitter accounts management is done by collective.twitter.accounts.

You can provide a publisher by registeriing an utility providing collective.socialpublisher.interfaces.ISocialPublisherUtility. See collective.socialpublisher.utility for details.

To enable auto-publishing you have to enable it per-content (waiting for global configuration) and you have to create a cron the calls @@social-auto-publish. You can do it using Products.cron4plone or trough buildout like this:

[instance]
...
zope-conf-additional =
  <clock-server>
      method /plonesite/@@social-auto-publish
      period 1000
      user admin
      password admin
  </clock-server>

See also http://collective-docs.readthedocs.org/en/latest/misc/asyncronoustasks.html.

Tested on

Plone 4.1 + 4.2rc1

Publish manager

Let’s create an Event

>>> from plone.app.testing import setRoles
>>> from plone.app.testing import TEST_USER_ID
>>> portal = layer['portal']
>>> setRoles(portal, TEST_USER_ID, ['Manager'])
>>> evid = portal.invokeFactory('Event', 'event')
>>> event = portal[evid]

and check that is enabled for publishing

>>> from collective.socialpublisher.interfaces import IPublishable
>>> IPublishable.providedBy(event)
True

get the manager

>>> from collective.socialpublisher.interfaces import IPublishStorageManager
>>> manager = IPublishStorageManager(event, None)
>>> manager is None
False

storage must be a PersistentDict

>>> from persistent.dict import PersistentDict
>>> isinstance(manager.storage,PersistentDict)
True

and accounts must be an empty dict and text an empty string.

>>> manager.get_accounts()
{}
>>> manager.get_text()
''

We can save an account for a given publisher

>>> publisher = 'twitter'
>>> account_id = 'simahawk'
>>> manager.set_account(publisher,account_id)
>>> manager.get_account(publisher)
'simahawk'
>>> manager.get_accounts()
{'twitter': 'simahawk'}

let’s add another publisher/account.

>>> publisher = 'facebook'
>>> account_id = 'simahawkfb'
>>> manager.set_account(publisher,account_id)
>>> manager.get_account(publisher)
'simahawkfb'
>>> manager.get_accounts()
{'twitter': 'simahawk', 'facebook': 'simahawkfb'}

We can also save the text to be published

>>> manager.set_text('foo bar')
>>> manager.get_text()
'foo bar'

Then we can hard reset the settings like this:

>>> manager._reset_storage()
>>> manager.get_accounts()
{}
>>> manager.get_text()
''

TODO

  • tests + docs

  • add support for linkedin and facebook

  • make query for auto-publish content dynamic/configurable

Changelog

1.0a3

  • [add] test buildout.cfg

  • [imp] improved tests

  • [imp] improved docs

  • [add] global config using p.a.registry + controlpanel

  • [imp] you can now turn off auto-publish globally

1.0a2

  • [fix] old twitter import

  • [imp] ‘update’ button for saving settings without publishing

  • [imp] ‘one-shot-text’ a flag for changing the text only for the current publishing without overwriting the stored one

  • [imp] if cron4plone is present display any available cron schedule

  • [imp] improved styles a bit

1.0a1

  • Initial release

Credits

This product was developed by Domsense.

Domsense Website

Release files for collective.socialpublisher 1.0a3

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

Source distribution (sdist)

Source distribution for collective.socialpublisher 1.0a3
File Size Uploaded
collective.socialpublisher-1.0a3.zip 40.5 kB Details

Release files / collective.socialpublisher-1.0a3.zip

Download URL collective.socialpublisher-1.0a3.zip
Size 40.5 kB
Tags Source
SHA-256 checksum
How to use checksums
dbe82c119024aa9e4acca9d42690fd2560afa162e1f7cb79d14d998fb61fd39f
BLAKE2b-256 checksum
How to use checksums
f63c398d6112ff30cdcadb1fdec171df9f0c17dfb0ab66bae93477883bf324d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

1.0a3 This release

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