def handleComment(self, action): # Validation form data, errors = self.extractData() if errors: return container = queryUtility(IMicroblogTool) microblog_context = get_microblog_context(self.context) if hasattr(self.context, 'thread_id') and self.context.thread_id: thread_id = self.context.thread_id # threaded elif self.context.__class__.__name__ == 'StatusUpdate': thread_id = self.context.id # first reply else: thread_id = None # new status = StatusUpdate(data['text'], context=microblog_context, thread_id=thread_id) file_upload = self.request.get('form.widgets.attachments') attachments_supported = ( IAttachmentStoragable is not None and IAttachmentStoragable.providedBy(status)) if attachments_supported and file_upload: token = self.request.get('attachment-form-token') extract_and_add_attachments( file_upload, status, workspace=self.context, token=token) # debugging only # container.clear() # save the status update container.add(status) # Redirect to portal home self.request.response.redirect(self.action)
def post_context(self): """ The context of this microblog post (the portal, a workspace, and so on...) """ return get_microblog_context(self.context)
def context(self, context): if HAVE_PLONEINTRANET_MICROBLOG: return get_microblog_context(context) else: return None
def context(self, context): return get_microblog_context(context)