Note: This change is to support a project that I am working on. You should see no change in the behavior of your current Autotest installations.
-----
Implement the models and set up the RPC framework for the Test Planner
Signed-off-by: James Ren <jamesren@google.com>
git-svn-id: http://test.kernel.org/svn/autotest/trunk@4039 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_utils.py b/frontend/afe/rpc_utils.py
index eb86cf4..26555d9 100644
--- a/frontend/afe/rpc_utils.py
+++ b/frontend/afe/rpc_utils.py
@@ -5,7 +5,7 @@
__author__ = 'showard@google.com (Steve Howard)'
-import datetime, os
+import datetime, os, sys
import django.http
from autotest_lib.frontend.afe import models, model_logic
@@ -620,3 +620,19 @@
special_task_index += 1
return interleaved_entries
+
+
+def get_sha1_hash(source):
+ """Gets the SHA-1 hash of the source string
+
+ @param source The string to hash
+ """
+ if sys.version_info < (2,5):
+ import sha
+ digest = sha.new()
+ else:
+ import hashlib
+ digest = hashlib.sha1()
+
+ digest.update(source)
+ return digest.hexdigest()