With the recent changes pushed to simplify the autotest
module import 'magic', we noticed that due to some
django idiosyncrasies back then the style of imports
inside the module all refer things like

frontend.afe.*

rather than

autotest.frontend.afe.*

Now that we don't support the top level dir empty on
the import setup anymore, we should refer to the
complete namespace. This fixes a number of db and
frontend related unittests on next.

CC: Eduardo Habkost <[email protected]>
CC: Cleber Rosa <[email protected]>
Signed-off-by: Lucas Meneghel Rodrigues <[email protected]>
---
 client/shared/host_queue_entry_states.py |  2 +-
 frontend/afe/management.py               |  9 +--------
 frontend/afe/urls.py                     |  6 +++---
 frontend/apache_auth.py                  |  2 +-
 frontend/frontend_unittest.py            |  2 +-
 frontend/tko/urls.py                     |  8 ++++----
 frontend/urls.py                         | 10 +++++-----
 7 files changed, 16 insertions(+), 23 deletions(-)

diff --git a/client/shared/host_queue_entry_states.py 
b/client/shared/host_queue_entry_states.py
index e3ab16e..d811cbf 100644
--- a/client/shared/host_queue_entry_states.py
+++ b/client/shared/host_queue_entry_states.py
@@ -2,7 +2,7 @@
 This module contains the status enums for use by HostQueueEntrys in the
 database.  It is a stand alone module as these status strings are needed
 from various disconnected pieces of code that should not depend on everything
-that frontend.afe.models depends on such as RPC clients.
+that autotest.frontend.afe.models depends on such as RPC clients.
 """
 
 from autotest.client.shared import enum
diff --git a/frontend/afe/management.py b/frontend/afe/management.py
index 3da8209..94e53a2 100644
--- a/frontend/afe/management.py
+++ b/frontend/afe/management.py
@@ -2,14 +2,7 @@
 
 from django.db.models import signals
 from django.contrib import auth
-# In this file, it is critical that we import models *just like this*.  In
-# particular, we *cannot* do import common; from autotest... import models.
-# This is because when we pass the models module to signal.connect(), it
-# calls id() on the module, and the id() of a module can differ depending on 
how
-# it was imported.  For that reason, we must import models as Django does -- 
not
-# through the autotest magic set up through common.py.  If you do that, the
-# connection won't work and the dispatcher will simply never call the method.
-from frontend.afe import models
+from autotest.frontend.afe import models
 
 BASIC_ADMIN = 'Basic admin'
 
diff --git a/frontend/afe/urls.py b/frontend/afe/urls.py
index 956b35a..1e70d6a 100644
--- a/frontend/afe/urls.py
+++ b/frontend/afe/urls.py
@@ -8,7 +8,7 @@ feeds = {
 }
 
 urlpatterns, debug_patterns = (
-        urls_common.generate_patterns('frontend.afe', 'AfeClient'))
+        urls_common.generate_patterns('autotest.frontend.afe', 'AfeClient'))
 
 resource_patterns = defaults.patterns(
         '',
@@ -65,8 +65,8 @@ urlpatterns += defaults.patterns(
 # Job feeds
 debug_patterns += defaults.patterns(
         '',
-        (r'^model_doc/', 'frontend.afe.views.model_documentation'),
-        (r'^feeds/(?P<url>.*)/$', 'frontend.afe.feeds.feed.feed_view',
+        (r'^model_doc/', 'autotest.frontend.afe.views.model_documentation'),
+        (r'^feeds/(?P<url>.*)/$', 'autotest.frontend.afe.feeds.feed.feed_view',
          {'feed_dict': feeds})
     )
 
diff --git a/frontend/apache_auth.py b/frontend/apache_auth.py
index 3d0ccf7..9e3f1a8 100644
--- a/frontend/apache_auth.py
+++ b/frontend/apache_auth.py
@@ -12,7 +12,7 @@ class SimpleAuthBackend(backends.ModelBackend):
     """
     Automatically allows any login.  This backend is for use when Apache is
     doing the real authentication.  Also ensures logged-in user exists in
-    frontend.afe.models.User database.
+    autotest.frontend.afe.models.User database.
     """
     def authenticate(self, username=None, password=None):
         try:
diff --git a/frontend/frontend_unittest.py b/frontend/frontend_unittest.py
index a59ad96..64e3f32 100755
--- a/frontend/frontend_unittest.py
+++ b/frontend/frontend_unittest.py
@@ -25,7 +25,7 @@ class FrontendTest(unittest.TestCase):
 
 
     def test_all(self):
-        doctest_runner = test.DoctestRunner(_APP_DIR, 'frontend.afe')
+        doctest_runner = test.DoctestRunner(_APP_DIR, 'autotest.frontend.afe')
         errors = doctest_runner.run_tests()
         self.assert_(errors == 0, '%s failures in frontend unit tests' % 
errors)
 
diff --git a/frontend/tko/urls.py b/frontend/tko/urls.py
index cfa3454..adede7f 100644
--- a/frontend/tko/urls.py
+++ b/frontend/tko/urls.py
@@ -7,7 +7,7 @@ from autotest.frontend import settings, urls_common
 from autotest.frontend.tko import resources
 
 urlpatterns, debug_patterns = (
-        urls_common.generate_patterns('frontend.tko', 'TkoClient'))
+        urls_common.generate_patterns('autotest.frontend.tko', 'TkoClient'))
 
 resource_patterns = defaults.patterns(
         '',
@@ -19,9 +19,9 @@ resource_patterns = defaults.patterns(
 
 urlpatterns += defaults.patterns(
         '',
-        (r'^jsonp_rpc/', 'frontend.tko.views.handle_jsonp_rpc'),
-        (r'^csv/', 'frontend.tko.views.handle_csv'),
-        (r'^plot/', 'frontend.tko.views.handle_plot'),
+        (r'^jsonp_rpc/', 'autotest.frontend.tko.views.handle_jsonp_rpc'),
+        (r'^csv/', 'autotest.frontend.tko.views.handle_csv'),
+        (r'^plot/', 'autotest.frontend.tko.views.handle_plot'),
 
         (r'^resources/', defaults.include(resource_patterns)))
 
diff --git a/frontend/urls.py b/frontend/urls.py
index 097f7bd..6b5a07b 100644
--- a/frontend/urls.py
+++ b/frontend/urls.py
@@ -10,13 +10,13 @@ RE_PREFIX = '^' + settings.URL_PREFIX
 TKO_RE_PREFIX = '^' + settings.TKO_URL_PREFIX
 
 handler404 = 'django.views.defaults.page_not_found'
-handler500 = 'frontend.afe.views.handler500'
+handler500 = 'autotest.frontend.afe.views.handler500'
 
 urlpatterns = defaults.patterns(
         '',
         (RE_PREFIX + r'admin/', defaults.include(admin.site.urls)),
-        (RE_PREFIX, defaults.include('frontend.afe.urls')),
-        (TKO_RE_PREFIX, defaults.include('frontend.tko.urls')),
+        (RE_PREFIX, defaults.include('autotest.frontend.afe.urls')),
+        (TKO_RE_PREFIX, defaults.include('autotest.frontend.tko.urls')),
         (RE_PREFIX + r'static/(?P<path>.*)', 'django.views.static.serve',
          {'document_root': os.path.join(os.path.dirname(__file__), 'static')}),
     )
@@ -24,13 +24,13 @@ urlpatterns = defaults.patterns(
 if os.path.exists(os.path.join(os.path.dirname(__file__),
                                'tko', 'site_urls.py')):
     urlpatterns += defaults.patterns(
-            '', (TKO_RE_PREFIX, defaults.include('frontend.tko.site_urls')))
+            '', (TKO_RE_PREFIX, 
defaults.include('autotest.frontend.tko.site_urls')))
 
 debug_patterns = defaults.patterns(
         '',
         # redirect /tko and /results to local apache server
         (r'^(?P<path>(tko|results)/.*)$',
-         'frontend.afe.views.redirect_with_extra_data',
+         'autotest.frontend.afe.views.redirect_with_extra_data',
          {'url': 'http://%(server_name)s/%(path)s?%(getdata)s'}),
     )
 
-- 
1.8.1.2

_______________________________________________
Autotest-kernel mailing list
[email protected]
https://www.redhat.com/mailman/listinfo/autotest-kernel

Reply via email to