def render(self): if not self.context.is_submitted_document(): raise NoSubmittedDocument() if self.context.is_checked_out(): raise Unauthorized() with elevated_privileges(): transporter = Transporter() transporter.update(self.context, self.request) portal_path = '/'.join(api.portal.get().getPhysicalPath()) intids = getUtility(IIntIds) repository = api.portal.get_tool('portal_repository') comment = translate(_( u"Updated with a newer docment version from proposal's " "dossier."), context=self.request) repository.save(obj=self.context, comment=comment) data = { 'path': '/'.join(self.context.getPhysicalPath())[len(portal_path) + 1:], 'intid': intids.queryId(self.context) } # Set correct content type for JSON response self.request.response.setHeader("Content-type", "application/json") return json.dumps(data)
def render(self): if not self.context.is_submitted_document(): raise NoSubmittedDocument() if self.context.is_checked_out(): raise Unauthorized() with elevated_privileges(): transporter = Transporter() transporter.update(self.context, self.request) portal_path = '/'.join(api.portal.get().getPhysicalPath()) intids = getUtility(IIntIds) repository = api.portal.get_tool('portal_repository') comment = translate( _(u"Updated with a newer docment version from proposal's " "dossier."), context=self.request) repository.save(obj=self.context, comment=comment) data = { 'path': '/'.join(self.context.getPhysicalPath())[ len(portal_path) + 1:], 'intid': intids.queryId(self.context) } # Set correct content type for JSON response self.request.response.setHeader("Content-type", "application/json") return json.dumps(data)
def __call__(self): if not self.context.is_submitted_document(): raise NoSubmittedDocument() if self.context.is_checked_out(): raise Unauthorized() submitted_proposal = aq_parent(aq_inner(self.context)) history_data = advancedjson.loads(self.request.get('history_data')) with elevated_privileges(): transporter = Transporter() transporter.update(self.context, self.request) IHistory(submitted_proposal).append_record( u'document_updated', document_title=self.context.title, submitted_version=history_data['submitted_version'], uuid=history_data['uuid']) ProposalDocumentUpdatedActivity( submitted_proposal, self.request, self.context.title, history_data['submitted_version']).record() portal_path = '/'.join(api.portal.get().getPhysicalPath()) intids = getUtility(IIntIds) comment = translate(_( u"Updated with a newer docment version from proposal's " "dossier."), context=self.request) Versioner(self.context).create_version(comment) data = { 'path': '/'.join(self.context.getPhysicalPath())[len(portal_path) + 1:], 'intid': intids.queryId(self.context) } # Set correct content type for JSON response self.request.response.setHeader("Content-type", "application/json") return json.dumps(data)
def __call__(self): oguid_str = self.request.get('oguid') if not oguid_str: raise NotFound() oguid = Oguid.parse(oguid_str) with elevated_privileges(): document = oguid.resolve_object() if document.is_checked_out(): raise Unauthorized() transporter = Transporter() transporter.update(document, self.request) comment = translate(_(u"Updated with a newer excerpt version."), context=self.request) Versioner(document).create_version(comment) return json.dumps({})
def render(self): oguid_str = self.request.get('oguid') if not oguid_str: raise NotFound() oguid = Oguid.parse(oguid_str) with elevated_privileges(): document = oguid.resolve_object() if document.is_checked_out(): raise Unauthorized() transporter = Transporter() transporter.update(document, self.request) repository = api.portal.get_tool('portal_repository') comment = translate(_(u"Updated with a newer excerpt version."), context=self.request) repository.save(obj=document, comment=comment) return json.dumps({})
def render(self): oguid_str = self.request.get('oguid') if not oguid_str: raise NotFound() oguid = Oguid.parse(oguid_str) with elevated_privileges(): document = oguid.resolve_object() if document.is_checked_out(): raise Unauthorized() transporter = Transporter() transporter.update(document, self.request) repository = api.portal.get_tool('portal_repository') comment = translate( _(u"Updated with a newer excerpt version."), context=self.request) repository.save(obj=document, comment=comment) return json.dumps({})
def __call__(self): if not self.context.is_submitted_document(): raise NoSubmittedDocument() if self.context.is_checked_out(): raise Unauthorized() submitted_proposal = aq_parent(aq_inner(self.context)) history_data = advancedjson.loads(self.request.get('history_data')) with elevated_privileges(): transporter = Transporter() transporter.update(self.context, self.request) IHistory(submitted_proposal).append_record( u'document_updated', document_title=self.context.title, submitted_version=history_data['submitted_version'], uuid=history_data['uuid'] ) portal_path = '/'.join(api.portal.get().getPhysicalPath()) intids = getUtility(IIntIds) comment = translate( _(u"Updated with a newer docment version from proposal's " "dossier."), context=self.request) Versioner(self.context).create_version(comment) data = { 'path': '/'.join(self.context.getPhysicalPath())[ len(portal_path) + 1:], 'intid': intids.queryId(self.context) } # Set correct content type for JSON response self.request.response.setHeader("Content-type", "application/json") return json.dumps(data)