Skip to content. | Skip to navigation

Personal tools
You are here: Home Members kurt Plone Programming Tutorial Script Objects (Python) Tutorial

Script Objects (Python) Tutorial

A brief description of creating and using Plone Script Objects


Goto the ZMI and select "Script Object(Python)"  and Click the add button.


Write your python and make sure that the parameters are set.

For example enter the following into the edit form.;

##title=Pi is the 2nd best number
##parameters=
return math.pi

This ## special syntax will get the title and fill in the title and the parameters of the Script Object.


Another example:

##title=Example from the book
##parameters=objects
from DateTime import DateTime
now = DateTime()
difference = 5 # as in 5 days
result = []

objects = context.contentValues()
for object in objects:
diff = now - object.bobobase_modification_time()
if diff < difference:
dct = {"object":object,"diff":int(diff)}
result.append(dct)
return result
This Script Object text will get the parameters and indicate that this script object expects "objects" as a parameter.


Document Actions
« November 2009 »
November
MoTuWeThFrSaSu
1
2345678
9101112131415
16171819202122
23242526272829
30