This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (pypi.python.org).
Help us improve Python packaging - Donate today!
Project Description

Introduction

Content rules are a powerfull feature in Plone 3. But create a filesystem product for every single little action we’d like to perform seems a little overkill. To help those integrators and administrators out there, RunScript brings the ability to register a condition that once matched will perform whatever the action you state in a script configured in the Rule configuration form.

Just to meet a few use cases, the product brings a some sample scripts that might come in handy:

tag_after_parent

Adds the parent’s title as a tag to the item (appends to the subject field). E.g.:

Given the structure: Plone/Folder1/Folder2/Folder3/object
>> object.Subject()
()
After Plone/Folder1/Folder2/Folder3/object/tag_after_parent
>> object.Subject()
('Folder3',)
tag_after_parents

Conditionally adds parent’s title as tags to the item (appends to the subject field). Recursively tests whether title_as_tag property is set on each part of the object’s parent’s path and adds that part’s title as a tag on the object. E.g.:

Given the structure: Plone/Folder1/Folder2/Folder3/object
Plone.title_as_tag is undefined
Folder1.title_as_tag is False
Folder2.title_as_tag is True
Folder3.title_as_tag is True
>> object.Subject()
()
After Plone/Folder1/Folder2/Folder3/object/tag_after_parents
>> object.Subject()
('Folder2','Folder3')
set_property

Adds a new property to the context object or just sets an existing one. Types must be the same in the latter case. Parameters are name,value,type. E.g.:

Given the structure: Plone/Folder1/Folder2/Folder3
After Plone/Folder1/Folder2/Folder3/set_property?name=title_as_tag&value=True&type=boolean
>> Plone.Folder1.Folder2.Folder3.getProperty('title_as_tag') == True
True

others_might_come_in_the_future

You can give your suggestions.

One could easily write a new script that just needs to be traversable from the object that will trigger the condition.

Installation

Add collective.contentrules.runscript to your buildout as an egg or from source. No (generic setup) installation is necessary, the action is registered using ZCML. So do add the package to the zcml slug list of your [instance] section.

If you’d like to use any of the available sample scripts then you should install the product by the Addons configlet.

Usage

Go to the Plone Control Panel, select Content Rules and add a new Rule. Under ‘actions’ you now have a new option: Run Script.

In the ‘Configure element’ form, point to a script that knows how to perform the desired action upon the object that will trigger the rule.

If you installed the sample scripts, you could use the ‘tag_after_parent’ script and have every object matching the rule’s condition categorized by their parent’s title.

If the script you inform at the configuration form is not traversable from the object that triggered the rule an exception will or will not be thrown depending on the state of the ‘Fail on script not found’ flag.

If you set the rule to an ‘add to container’ event, not finding the script means not fullfilling the add.

Credits

This package has been highly based on collective.contentrules.mailtolocalrole.

Changelog

0.4 (2011-02-22)

  • Added z3c.autoinclude.plugin entry point
  • Fixed reference to .runscript.RunscriptAction factory in configure.zcml (thanks to Sascha Gresk)

0.3 (2009-07-27)

  • Added option to pass parameters to scripts
  • Added tag_after_parents and set_property sample scripts

0.2 (2009-07-23)

  • Added restricted/unrestricted traversal option
  • Fixed packaging problems

0.1.1 (2009-07-23)

  • Fixed packaging problems

0.1 (xxxx-xx-xx)

  • Initial release
Release History

Release History

0.4

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3beta

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2beta

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1.1beta

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1beta

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

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

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
collective.contentrules.runscript-0.4.tar.gz (10.7 kB) Copy SHA256 Checksum SHA256 Source Feb 23, 2011

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting