def update_main(force_start=False, **kwargs): try: stix_dedup = STIXDedup(DedupConfiguration.get()) stix_dedup.run() except Exception as e: crashlog.save('dedup_job', e.message, traceback.format_exc()) raise return 0
def ajax_load_duplicates(request, typ): try: local = request.body duplicates = STIXDedup.find_duplicates(local) return JsonResponse({typ: duplicates}, status=200) except Exception as e: return JsonResponse({'message': e.message}, status=500)
def ajax_load_parent_ids(request): result = {} try: raw_body = json.loads(request.body) original, duplicate = raw_body.get('original'), raw_body.get( 'duplicate') parents_of_original, parents_of_duplicate = STIXDedup.calculate_backlinks( original, duplicate) for _id in parents_of_original.keys(): result.setdefault('original', []).append(_id) for _id in parents_of_duplicate.keys(): result.setdefault('duplicate', []).append(_id) return JsonResponse(result, status=200) except Exception as e: return JsonResponse({'message': e.message}, status=500)
def set_OnlineDedup_config(self, config): return STIXDedup(DedupConfiguration.set_from_dict(config))
def get_OnlineDedup_config(self): return STIXDedup(DedupConfiguration.get())