-move logged-in user tracking to separate thread_local module. models.py will soon depend on it, so it had to be moved to avoid circular dependencies.
-made apache_auth set the logged-in user, rather than the rpc handling view. this way the user will be set when the admin interface is accessed as well.
git-svn-id: http://test.kernel.org/svn/autotest/trunk@1776 592f7852-d20e-0410-864c-8624ca9c26a4
diff --git a/frontend/afe/rpc_interface.py b/frontend/afe/rpc_interface.py
index ea435c9..15b4258 100644
--- a/frontend/afe/rpc_interface.py
+++ b/frontend/afe/rpc_interface.py
@@ -29,6 +29,7 @@
__author__ = 'showard@google.com (Steve Howard)'
+from frontend import thread_local
from frontend.afe import models, model_logic, control_file, rpc_utils
from frontend.afe import readonly_connection
from autotest_lib.client.common_lib import global_config
@@ -271,7 +272,7 @@
timeout=global_config.global_config.get_config_value(
'AUTOTEST_WEB', 'job_timeout_default')
- owner = rpc_utils.get_user().login
+ owner = thread_local.get_user().login
# input validation
if not hosts and not meta_hosts and not one_time_hosts:
raise model_logic.ValidationError({
@@ -333,7 +334,7 @@
Create and enqueue a copy of the given job.
"""
job = models.Job.objects.get(id=id)
- new_job = job.requeue(rpc_utils.get_user().login)
+ new_job = job.requeue(thread_local.get_user().login)
return new_job.id
@@ -467,7 +468,7 @@
result['labels'] = get_labels(sort_by=['-platform', 'name'])
result['tests'] = get_tests(sort_by=['name'])
result['profilers'] = get_profilers(sort_by=['name'])
- result['user_login'] = rpc_utils.get_user().login
+ result['user_login'] = thread_local.get_user().login
result['host_statuses'] = sorted(models.Host.Status.names)
result['job_statuses'] = sorted(models.Job.Status.names)
result['job_timeout_default'] = global_config.global_config.get_config_value(