Previously Héctor Velarde wrote:
> in Plone 2.1 we had a workflow script to move News Items and Documents 
> to a different location when the object was published:
> 
> from Products.CMFPlone.utils import base_hasattr
> import DateTime
> 
> o = getattr(state_change, 'object')
> obj_parent = o.aq_parent
> portal_root = context.portal_url.getPortalObject()
> 
> if o.getTypeInfo().getId()=='News Item' or 
> o.getTypeInfo().getId()=='Document':
>     today = DateTime.DateTime()
>     (year,month,day) = (str(today.year()),str(today.mm()),str(today.dd()))
>     if not base_hasattr(portal_root,year):
>         portal_root.invokeFactory('Folder', year, title=year)
>     if not base_hasattr(portal_root[year], month):
>         portal_root[year].invokeFactory('Folder', month, title=month)
>     if not base_hasattr(portal_root[year][month], day):
>         portal_root[year][month].invokeFactory('Folder', day, title=day)
>     destination = portal_root[year][month][day]
>     object_id = o.getId()
> 
> destination.manage_pasteObjects(obj_parent.manage_cutObjects(object_id))
> 
> In this way, when I published one of those objects, a new folder was 
> created based on current date and the object was moved to that folder.
> 
> now that we have migrated to Plone 2.5 I was trying to write a test to 
> see if the script was created and removed from the workflow at 
> install/uninstall time, but then I realized that I can probably use some 
> sort of event instead of this.
> 
> I think in Plone 3.0 there is a mechanism to implement this in an easy 
> way. can anybody explain me how to do it?

Content rules do just that (and more!). They are reasonably intuitive -
I suggest that you install a Plone 3 site and play with them.

Wichert.

-- 
Wichert Akkerman <[EMAIL PROTECTED]>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.

_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to