Пример #1
0
    def addPosting(self, file='', REQUEST=None,RESPONSE=None):     
        """ add a Comment """
        index=1
        id=self.createId()
        msg=Comment(id, self.id)
        err, sage = msg.__of__(self)._validation(REQUEST,RESPONSE,'delete attachment',file)
        if err:
            return err
        # Set thread number. 
        msg.tnum = str(len(self.ids) + 2)

        if sage==0:
            self.modified=id     

        self.ids.insert(id)     
        self.data[id]=msg

        if index:
            msg.__of__(self).index()
          
        if RESPONSE:
            return self.showMessage(self, REQUEST=REQUEST, 
                                title='Comment Posted',
                                message  ='Your reply has been posted',
                                action=self.absolute_url()     
                                )

        return id