Assigning jobs for a Tool??

Alain Hernandez Lopez ahernandezlop at estudiantes.uci.cu
Mon May 14 14:35:09 UTC 2007


Hello!

My problem is the following. I've created a tool which has as id
portal_SchedulerTool, also I've created a content type from which I want
to accede to a method of my tool. Now, what I want to do is that when an
object content is created, this it set a job to the tool, I've write the
following code in my content init method but it give me an error.

 

from Products.CMFCore.utils import getToolByName

 

 security.declarePrivate('__init__')
    def __init__(self,id=None):
        """
        Content type constructor
        """
        self.id = id
        
        #giving a job to the PortalSchedulerTool 

        tool = getToolByName(self, 'portal_SchedulerTool', None)
        if tool:

            tool.setJob(self.execute)
        else: print "The PortalSchedulerTool does not exist"

 

This is the bug that it gives to me

Error Type 

AttributeError 

Error Value 

portal_SchedulerTool 

 

Professedly it should found the portal_SchedulerTool by acquisition but
it didn't doing. I've tested putting the same code on a python script
and it work perfectly. I have installed the tool, that's why I don't
understand, why it didn't found the tool. Please if you cant help me.

Excuse my English 

Regards Allan. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.plone.org/pipermail/plone-product-developers/attachments/20070514/874569ae/attachment.html>


More information about the Product-Developers mailing list