John DeStefano, on 2008-04-07:
> I'm developing an "old-style" product (tried using buildout and could  
> not resolve all the errors) and I could use a bit of help in finishing  
> things up.  I have an Event-ish content type:
> http://deesto.pastebin.com/f781c1a09
> ... and a Folder-ish content type to hold the other content:
> http://deesto.pastebin.com/ff0ad888
>
> The main things I still need to do are:
> - Hook an email script into this, so that publishing an object fires  
> off a notification via email.  I have written an email script, but I  
> don't know where to put it or how to call it from my product.

You can do it with a workflow script.  Make a subversion checkout of
Poi (or get the tarball, look on plone.org):

http://svn.plone.org/svn/collective/Products.Poi/trunk/Products/Poi

Then search for sendResponseEmail and sendResponseNotificationMail.

Event handlers like you mention below are good too.  They feel more
modern.

> - I've been told that I should use an "event handler" for this, which  
> would require a registration in configure.zcml, but my attempts to  
> create one (and place it at the root of the product directory) result  
> in errors:
> http://deesto.pastebin.com/f4d16e1bd

That subscriber is now subscribed to events on *all* objects.  Not all
objects will have all the info you want, like affectedArea.  So that
can give problems.

You can either check for portal_type='Announcement' in the event
handler, or (better) you create a (marker) interface, let the
Announcement class implement it and register the subscriber for that
interface instead of '*'.

Also: perhaps an error in pasting, but lines 18 and further are
indented too much.  After the 'return' on line 17 you cannot continue
with the same indentation level.

> - I would like to modify the Folder-ish type to allow a single  
> Collection/Topic/Smart Folder object to be created within it (or to  
> create one automatically), and to make this the default view for the  
> folder-ish object.  I can use "allowed_content_types" and add "Topic"  
> to the list, but how to restrict this to just one of these objects,  
> and to allow Topic to be used as a default view?
>
> Thanks for your help.
>
> ~John


-- 
Maurits van Rees | http://maurits.vanrees.org/
            Work | http://zestsoftware.nl/
"This is your day, don't let them take it away." [Barlow Girl]


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

Reply via email to