def edit_comment_of_issue(comment_id, comment_content, user): comment = IssueComment.objects.get(pk=comment_id) _throwIfNotCommentAuthor(comment, user) old_json = comment.to_json() comment.changeContent(comment_content) ActionLog.log_edit_issue_comment(issue_comment=comment, old_json=old_json) return comment
def add_comment_to_issue(issue_id, comment_content, user): issue = Issue.objects.get(pk=issue_id) issue.touch() comment = IssueComment.newComment(issue, user, comment_content) comment.save() watches = watch_services.find_issue_watches(comment.issue) notifyWatchers_newissuecomment(comment, watches) ActionLog.log_add_issue_comment(issue_comment=comment) return issue
def edit(request): project_id = int(request.POST.get('id')) project = Project.objects.get(pk=project_id) old_json = project.to_json() if 'image3x1' in request.FILES and request.FILES['image3x1']: project.image3x1 = request.FILES['image3x1'] project.description = request.POST.get('description') project.save() ActionLog.log_edit_project(project=project, user=request.user, old_json=old_json) return redirect('core.views.project_views.view', project_id=project.id)
def edit(request): project_id = int(request.POST.get('id')) project = Project.objects.get(pk=project_id) old_json = project.to_json() if 'image3x1' in request.FILES and request.FILES['image3x1']: project.image3x1 = request.FILES['image3x1'] project.description = request.POST.get('description') project.homeURL = request.POST.get('homeURL') project.save() watches = watch_services.find_project_watches(project) mail_services.notifyWatchers_project_edited(request.user, project, old_json, watches) ActionLog.log_edit_project(project=project, user=request.user, old_json=old_json) return redirect('core.views.project_views.view', project_id=project.id)
def edit(request): project_id = int(request.POST.get('id')) project = Project.objects.get(pk=project_id) old_json = project.to_json() if 'image3x1' in request.FILES and request.FILES['image3x1']: project.image3x1 = request.FILES['image3x1'] project.description = request.POST.get('description') project.homeURL = request.POST.get('homeURL') project.save() watches = watch_services.find_project_watches(project) mail_services.notifyWatchers_project_edited(request.user, project, old_json, watches) ActionLog.log_edit_project(project=project, user=request.user, old_json=old_json) return redirect('/project/%s' % project.id)
def export_companies(request, fmt): if not request.user.has_perm("core.export_companies"): return HttpResponseForbidden() data = map( lambda p: blacklist( add_encrypted_url(p, request.user, "encrypted_company_redirect"), ["id"]), ElasticCompany.get_all_companies(), ) ActionLog(user=request.user, action="download_companies_dataset", details=fmt).save() if fmt == "json": response = JsonResponse(data, safe=False) if fmt == "xml": response = render(request, "xml.jinja", {"data": data}, content_type="application/xhtml+xml") response[ "Content-Disposition"] = "attachment; filename=companies_{:%Y%m%d_%H%M}.{}".format( datetime.now(), fmt) response["Content-Length"] = len(response.content) return response
def export_persons(request, fmt): if not request.user.has_perm("core.export_persons"): return HttpResponseForbidden() if request.user.has_perm("core.export_id_and_last_modified"): fields_to_blacklist = [] else: fields_to_blacklist = ["id", "last_change"] data = map( lambda p: blacklist( add_encrypted_url(p, request.user, "encrypted_person_redirect"), fields_to_blacklist), ElasticPerson.get_all_persons(), ) ActionLog(user=request.user, action="download_dataset", details=fmt).save() if fmt == "json": response = JsonResponse(data, safe=False) if fmt == "xml": response = render(request, "xml.jinja", {"data": data}, content_type="application/xhtml+xml") response[ "Content-Disposition"] = "attachment; filename=peps_{:%Y%m%d_%H%M}.{}".format( datetime.now(), fmt) response["Content-Length"] = len(response.content) return response
def process_ipn_return(paykey, status, tracking_id): if status == 'COMPLETED': payment = get_or_none(Payment, paykey=paykey, confirm_key=tracking_id) if not payment: raise BaseException('payment not found ' + paykey) if payment.status == Payment.CONFIRMED_IPN: return # double notification, nothing to do payment.confirm_ipn() payment.offer.paid() payment.offer.issue.touch() watches = watch_services.find_issue_watches(payment.offer.issue) notify_payment_parties_and_watchers_paymentconfirmed(payment, watches) notify_admin_payment_confirmed(payment) ActionLog.log_pay(payment) else: subject = 'received a payment confirmation with status = %s' % status msg = 'paykey = %s\nconfirm_key=%s' % (paykey, tracking_id) mail_services.notify_admin(subject, msg) logger.warn(subject) logger.warn(msg)
def process_ipn_return(paykey, status, tracking_id): if status == 'COMPLETED': payment = get_or_none(Payment, paykey=paykey, confirm_key=tracking_id) if not payment: raise BaseException('payment not found ' + paykey) if payment.status == Payment.CONFIRMED_IPN: return # double notification, nothing to do payment.confirm_ipn() payment.offer.paid() payment.offer.issue.touch() watches = watch_services.find_issue_and_project_watches( payment.offer.issue) notify_payment_parties_and_watchers_paymentconfirmed(payment, watches) notify_admin_payment_confirmed(payment) ActionLog.log_pay(payment) else: subject = 'received a payment confirmation with status = %s' % status msg = 'paykey = %s\nconfirm_key=%s' % (paykey, tracking_id) mail_services.notify_admin(subject, msg) logger.warn(subject) logger.warn(msg)