[Zope] PUT method & get property of parent folder

Marcus Schopen marcus.schopen@uni-bielefeld.de
Sun, 21 Apr 2002 21:15:32 +0200


Marcus Schopen wrote:
>
> how and where can I test in the PUT method, if a property called "TIDY" (boolean) is set in the
> parent folder the new instance of xyz will created in?
> 
> Class xyz(DTMLDocument):
>     [...]
>     def PUT(self, REQUEST, RESPONSE):
>         """Handle HTTP PUT requests."""
>         self.dav__init(REQUEST, RESPONSE)
>         self.dav__simpleifhandler(REQUEST, RESPONSE, refresh=1)
>         body=REQUEST.get('BODY', '')
>         self._validateProxy(REQUEST)
>         self.munge(body)
>         self.ZCacheable_invalidate()
>         RESPONSE.setStatus(204)
>         return RESPONSE
> 

I used "manage_afterAdd" (see OFS.SimpleItem for details):

   def manage_afterAdd(self, item, container):
        self.updateHTMLFile()


   def updateHTMLFile(self):
        """ do something 
            !!! object is now in zopetree, you have full access 
                to parents properties !!!
        """


   def PUT(self, REQUEST, RESPONSE):
        ...
        # only for FTP-updates; frist upload is automaticly 
        # managed by manage_afterAdd
        # 
        if hasattr(self, 'TIDY'):
            self.updateHTMLFile()



-- 

 ,---- [ Marcus Schopen ] 
|  (0>   
|  //\   P.O. Box 10 25 25
|  V_/_  33525 Bielefeld
|        Germany
 `----

__________________________________________________

Petition for a Software Patent Free Europe 
http://petition.eurolinux.org