def __call__(self):
        """ write attributes, if any, set state, render
        """
        form = self.request.form

        if self.request.method == "POST" and form:
            ws = self.my_workspace()
            if self.request.form.get('section', None) == 'task':
                current_tasks = self.request.form.get('current-tasks', [])
                active_tasks = self.request.form.get('active-tasks', [])

                catalog = api.portal.get_tool("portal_catalog")
                brains = catalog(UID={'query': current_tasks,
                                      'operator': 'or'})
                for brain in brains:
                    obj = brain.getObject()
                    todo = ITodo(obj)
                    if brain.UID in active_tasks:
                        todo.status = u'done'
                    else:
                        todo.status = u'tbd'
                api.portal.show_message(_(u'Changes applied'),
                                        self.request,
                                        'success')
            else:
                if form.get('title') and form.get('title') != ws.title:
                    ws.title = form.get('title').strip()
                    api.portal.show_message(_(u'Title changed'),
                                            self.request,
                                            'success')

                if form.get('description') and \
                   form.get('description') != ws.description:
                    ws.description = form.get('description').strip()
                    api.portal.show_message(_(u'Description changed'),
                                            self.request,
                                            'success')

                calendar_visible = not not form.get('calendar_visible')
                if calendar_visible != ws.calendar_visible:
                    ws.calendar_visible = calendar_visible
                    api.portal.show_message(_(u'Calendar visibility changed'),
                                            self.request,
                                            'success')

        return self.render()
def __call__ ( self ) : form = self . request . form if self . request . method == "POST" and form : ws = self . my_workspace ( ) if self . request . form . get ( 'section' , None ) == 'task' : current_tasks = self . request . form . get ( 'current-tasks' , [ ] ) active_tasks = self . request . form . get ( 'active-tasks' , [ ] ) catalog = api . portal . get_tool ( "portal_catalog" ) brains = catalog ( UID = { 'query' : current_tasks , 'operator' : 'or' } ) for brain in brains : obj = brain . getObject ( ) todo = ITodo ( obj ) if brain . UID in active_tasks : todo . status = u'done' else : todo . status = u'tbd' api . portal . show_message ( _ ( u'Changes applied' ) , self . request , 'success' ) else : if form . get ( 'title' ) and form . get ( 'title' ) != ws . title : ws . title = form . get ( 'title' ) . strip ( ) api . portal . show_message ( _ ( u'Title changed' ) , self . request , 'success' ) if form . get ( 'description' ) and form . get ( 'description' ) != ws . description : ws . description = form . get ( 'description' ) . strip ( ) api . portal . show_message ( _ ( u'Description changed' ) , self . request , 'success' ) calendar_visible = not not form . get ( 'calendar_visible' ) if calendar_visible != ws . calendar_visible : ws . calendar_visible = calendar_visible api . portal . show_message ( _ ( u'Calendar visibility changed' ) , self . request , 'success' ) return self . render ( )
write attributes, if any, set state, render