From 822f9cff3f2654e7143ef2b36a1b3d8526e1ffae Mon Sep 17 00:00:00 2001
From: Henrik Levkowetz <henrik@levkowetz.com>
Date: Wed, 27 Jun 2012 08:42:34 +0000
Subject: [PATCH] Remove the grep based searches in utils.py; they are too
 costly.  If tracing lists based on word search is needed, another
 implementation must be found.  - Legacy-Id: 4524

---
 ietf/community/utils.py | 42 -----------------------------------------
 1 file changed, 42 deletions(-)
 delete mode 100644 ietf/community/utils.py

diff --git a/ietf/community/utils.py b/ietf/community/utils.py
deleted file mode 100644
index b796dca88..000000000
--- a/ietf/community/utils.py
+++ /dev/null
@@ -1,42 +0,0 @@
-import subprocess
-
-from django.conf import settings
-
-from ietf.doc.models import Document
-
-def search_files(files, text):
-    p = subprocess.Popen(['grep', "-l", text] + files, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    stdout, stderr = p.communicate()
-    paths = stdout.strip().split('\n')
-    return paths
-
-
-def get_drafts_with(text):
-    draft_dir = settings.INTERNET_DRAFT_PATH
-    last_files = ['%s%s-%s.txt' % (draft_dir, i.name, i.rev) for i in Document.objects.filter(type='draft')]
-    paths = search_files(last_files, text)
-    result = []
-    for i in paths:
-        result.append(i.replace(draft_dir, '')[:-7])
-    return Document.objects.filter(type='draft', name__in=result)
-
-def search_in_path(path, text):
-    p = subprocess.Popen(['grep', "-rl", text, path], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    stdout, stderr = p.communicate()
-    paths = stdout.strip().split('\n')
-    return paths
-
-def get_rfcs_with(text):
-    rfc_dir = settings.RFC_PATH
-    paths = search_in_path(rfc_dir, text)
-    result = []
-    for i in paths:
-        if i.endswith('.txt'):
-            result.append(i.replace(rfc_dir, '')[:-4])
-    return Document.objects.filter(type='draft', docalias__name__in=result)
-
-def get_documents_with(text):
-    drafts = get_drafts_with(text)
-    rfcs = get_rfcs_with(text)
-    documents = drafts | rfcs
-    return documents.distinct()