diff --git a/horizon/__init__.py b/horizon/__init__.py index 7325d29d84..67a358e651 100644 --- a/horizon/__init__.py +++ b/horizon/__init__.py @@ -26,10 +26,10 @@ methods like :func:`~horizon.register` and :func:`~horizon.unregister`. # should that fail. Horizon = None try: - from horizon.base import Dashboard - from horizon.base import Horizon - from horizon.base import Panel - from horizon.base import PanelGroup + from horizon.base import Dashboard # noqa + from horizon.base import Horizon # noqa + from horizon.base import Panel # noqa + from horizon.base import PanelGroup # noqa except ImportError: import warnings diff --git a/horizon/base.py b/horizon/base.py index ac31eda314..9318728841 100644 --- a/horizon/base.py +++ b/horizon/base.py @@ -28,22 +28,22 @@ import inspect import logging import os -from django.conf import settings -from django.conf.urls.defaults import include -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url -from django.core.exceptions import ImproperlyConfigured -from django.core.urlresolvers import reverse -from django.utils.datastructures import SortedDict -from django.utils.functional import SimpleLazyObject -from django.utils.importlib import import_module -from django.utils.module_loading import module_has_submodule -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.conf.urls.defaults import include # noqa +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa +from django.core.exceptions import ImproperlyConfigured # noqa +from django.core.urlresolvers import reverse # noqa +from django.utils.datastructures import SortedDict # noqa +from django.utils.functional import SimpleLazyObject # noqa +from django.utils.importlib import import_module # noqa +from django.utils.module_loading import module_has_submodule # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import conf -from horizon.decorators import _current_component -from horizon.decorators import require_auth -from horizon.decorators import require_perms +from horizon.decorators import _current_component # noqa +from horizon.decorators import require_auth # noqa +from horizon.decorators import require_perms # noqa from horizon import loaders @@ -549,7 +549,7 @@ class Workflow(object): try: - from django.utils.functional import empty + from django.utils.functional import empty # noqa except ImportError: #Django 1.3 fallback empty = None diff --git a/horizon/browsers/__init__.py b/horizon/browsers/__init__.py index e6a2570d33..f49d82619d 100644 --- a/horizon/browsers/__init__.py +++ b/horizon/browsers/__init__.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -from horizon.browsers.base import ResourceBrowser -from horizon.browsers.views import ResourceBrowserView +from horizon.browsers.base import ResourceBrowser # noqa +from horizon.browsers.views import ResourceBrowserView # noqa assert ResourceBrowser assert ResourceBrowserView diff --git a/horizon/browsers/base.py b/horizon/browsers/base.py index 11bcd44625..e8ff7f3bb2 100644 --- a/horizon/browsers/base.py +++ b/horizon/browsers/base.py @@ -15,10 +15,10 @@ # under the License. from django import template -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa -from horizon.browsers.breadcrumb import Breadcrumb -from horizon.tables import DataTable +from horizon.browsers.breadcrumb import Breadcrumb # noqa +from horizon.tables import DataTable # noqa from horizon.utils import html diff --git a/horizon/browsers/views.py b/horizon/browsers/views.py index c2e8b437d8..baf1d907af 100644 --- a/horizon/browsers/views.py +++ b/horizon/browsers/views.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa -from horizon.tables import MultiTableView +from horizon.tables import MultiTableView # noqa class ResourceBrowserView(MultiTableView): diff --git a/horizon/conf/__init__.py b/horizon/conf/__init__.py index 4370028d9d..5c97dc3bcf 100644 --- a/horizon/conf/__init__.py +++ b/horizon/conf/__init__.py @@ -1,13 +1,13 @@ import copy -from django.utils.functional import empty -from django.utils.functional import LazyObject +from django.utils.functional import empty # noqa +from django.utils.functional import LazyObject # noqa class LazySettings(LazyObject): def _setup(self, name=None): - from django.conf import settings - from horizon.conf.default import HORIZON_CONFIG as DEFAULT_CONFIG + from django.conf import settings # noqa + from horizon.conf.default import HORIZON_CONFIG as DEFAULT_CONFIG # noqa HORIZON_CONFIG = copy.copy(DEFAULT_CONFIG) HORIZON_CONFIG.update(settings.HORIZON_CONFIG) diff --git a/horizon/conf/default.py b/horizon/conf/default.py index 445b2571a4..63ce6cf8e9 100644 --- a/horizon/conf/default.py +++ b/horizon/conf/default.py @@ -1,5 +1,5 @@ -from django.conf import settings -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.utils.translation import ugettext_lazy as _ # noqa # Default configuration dictionary. Do not mutate. HORIZON_CONFIG = { diff --git a/horizon/decorators.py b/horizon/decorators.py index f4d41092b2..865d843806 100644 --- a/horizon/decorators.py +++ b/horizon/decorators.py @@ -23,8 +23,8 @@ General-purpose decorators for use with Horizon. """ import functools -from django.utils.decorators import available_attrs -from django.utils.translation import ugettext_lazy as _ +from django.utils.decorators import available_attrs # noqa +from django.utils.translation import ugettext_lazy as _ # noqa def _current_component(view_func, dashboard=None, panel=None): @@ -46,7 +46,7 @@ def require_auth(view_func): :exc:`~horizon.exceptions.NotAuthenticated` exception if the user is not signed-in. """ - from horizon.exceptions import NotAuthenticated + from horizon.exceptions import NotAuthenticated # noqa @functools.wraps(view_func, assigned=available_attrs(view_func)) def dec(request, *args, **kwargs): @@ -74,7 +74,7 @@ def require_perms(view_func, required): Raises a :exc:`~horizon.exceptions.NotAuthorized` exception if the requirements are not met. """ - from horizon.exceptions import NotAuthorized + from horizon.exceptions import NotAuthorized # noqa # We only need to check each permission once for a view, so we'll use a set current_perms = getattr(view_func, '_required_perms', set([])) view_func._required_perms = current_perms | set(required) diff --git a/horizon/exceptions.py b/horizon/exceptions.py index a5d4849702..d1fb70e927 100644 --- a/horizon/exceptions.py +++ b/horizon/exceptions.py @@ -22,14 +22,14 @@ import logging import os import sys -from django.contrib.auth import logout -from django.core.management import color_style -from django.http import HttpRequest -from django.utils.translation import ugettext_lazy as _ -from django.views.debug import CLEANSED_SUBSTITUTE -from django.views.debug import SafeExceptionReporterFilter +from django.contrib.auth import logout # noqa +from django.core.management import color_style # noqa +from django.http import HttpRequest # noqa +from django.utils.translation import ugettext_lazy as _ # noqa +from django.views.debug import CLEANSED_SUBSTITUTE # noqa +from django.views.debug import SafeExceptionReporterFilter # noqa -from horizon.conf import HORIZON_CONFIG +from horizon.conf import HORIZON_CONFIG # noqa from horizon import messages LOG = logging.getLogger(__name__) diff --git a/horizon/forms/__init__.py b/horizon/forms/__init__.py index 4df93321bb..fe0f496060 100644 --- a/horizon/forms/__init__.py +++ b/horizon/forms/__init__.py @@ -19,13 +19,13 @@ from django.forms import * # noqa from django.forms import widgets # Convenience imports for public API components. -from horizon.forms.base import DateForm -from horizon.forms.base import SelfHandlingForm -from horizon.forms.base import SelfHandlingMixin -from horizon.forms.fields import DynamicChoiceField -from horizon.forms.fields import DynamicTypedChoiceField -from horizon.forms.views import ModalFormMixin -from horizon.forms.views import ModalFormView +from horizon.forms.base import DateForm # noqa +from horizon.forms.base import SelfHandlingForm # noqa +from horizon.forms.base import SelfHandlingMixin # noqa +from horizon.forms.fields import DynamicChoiceField # noqa +from horizon.forms.fields import DynamicTypedChoiceField # noqa +from horizon.forms.views import ModalFormMixin # noqa +from horizon.forms.views import ModalFormView # noqa assert widgets assert SelfHandlingMixin diff --git a/horizon/forms/base.py b/horizon/forms/base.py index aa6b0232ef..2653f00377 100644 --- a/horizon/forms/base.py +++ b/horizon/forms/base.py @@ -19,7 +19,7 @@ # under the License. from django import forms -from django.forms.forms import NON_FIELD_ERRORS +from django.forms.forms import NON_FIELD_ERRORS # noqa class SelfHandlingMixin(object): diff --git a/horizon/loaders.py b/horizon/loaders.py index 6ab86b8fee..65c4aec40d 100644 --- a/horizon/loaders.py +++ b/horizon/loaders.py @@ -4,10 +4,10 @@ Wrapper for loading templates from "templates" directories in panel modules. import os -from django.conf import settings -from django.template.base import TemplateDoesNotExist -from django.template.loader import BaseLoader -from django.utils._os import safe_join +from django.conf import settings # noqa +from django.template.base import TemplateDoesNotExist # noqa +from django.template.loader import BaseLoader # noqa +from django.utils._os import safe_join # noqa # Set up a cache of the panel directories to search. panel_template_dirs = {} diff --git a/horizon/management/commands/startdash.py b/horizon/management/commands/startdash.py index 9ffdd20e4d..43127501da 100644 --- a/horizon/management/commands/startdash.py +++ b/horizon/management/commands/startdash.py @@ -1,10 +1,10 @@ import glob -from optparse import make_option +from optparse import make_option # noqa import os -from django.core.management.base import CommandError -from django.core.management.templates import TemplateCommand -from django.utils.importlib import import_module +from django.core.management.base import CommandError # noqa +from django.core.management.templates import TemplateCommand # noqa +from django.utils.importlib import import_module # noqa import horizon diff --git a/horizon/management/commands/startpanel.py b/horizon/management/commands/startpanel.py index 61369fa693..33944f7439 100644 --- a/horizon/management/commands/startpanel.py +++ b/horizon/management/commands/startpanel.py @@ -1,10 +1,10 @@ import glob -from optparse import make_option +from optparse import make_option # noqa import os -from django.core.management.base import CommandError -from django.core.management.templates import TemplateCommand -from django.utils.importlib import import_module +from django.core.management.base import CommandError # noqa +from django.core.management.templates import TemplateCommand # noqa +from django.utils.importlib import import_module # noqa import horizon diff --git a/horizon/messages.py b/horizon/messages.py index 05b2ee1098..b3cdeb7d06 100644 --- a/horizon/messages.py +++ b/horizon/messages.py @@ -21,8 +21,8 @@ messaging needs (e.g. AJAX communication, etc.). from django.contrib import messages as _messages from django.contrib.messages import constants -from django.utils.encoding import force_unicode -from django.utils.safestring import SafeData +from django.utils.encoding import force_unicode # noqa +from django.utils.safestring import SafeData # noqa def add_message(request, level, message, extra_tags='', fail_silently=False): diff --git a/horizon/middleware.py b/horizon/middleware.py index 2dde4e4d70..3134a63371 100644 --- a/horizon/middleware.py +++ b/horizon/middleware.py @@ -25,14 +25,14 @@ import datetime import json import logging -from django.conf import settings -from django.contrib.auth import REDIRECT_FIELD_NAME -from django.contrib.auth.views import redirect_to_login +from django.conf import settings # noqa +from django.contrib.auth import REDIRECT_FIELD_NAME # noqa +from django.contrib.auth.views import redirect_to_login # noqa from django.contrib import messages as django_messages from django import http -from django.http import HttpResponseRedirect +from django.http import HttpResponseRedirect # noqa from django import shortcuts -from django.utils.encoding import iri_to_uri +from django.utils.encoding import iri_to_uri # noqa from django.utils import timezone from horizon import exceptions diff --git a/horizon/site_urls.py b/horizon/site_urls.py index 1cde0f0349..497b724217 100644 --- a/horizon/site_urls.py +++ b/horizon/site_urls.py @@ -18,11 +18,11 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf import settings -from django.conf.urls.defaults import include -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url -from django.views.generic import TemplateView +from django.conf import settings # noqa +from django.conf.urls.defaults import include # noqa +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa +from django.views.generic import TemplateView # noqa urlpatterns = patterns('horizon.views', diff --git a/horizon/tables/__init__.py b/horizon/tables/__init__.py index d279db6372..55803026bc 100644 --- a/horizon/tables/__init__.py +++ b/horizon/tables/__init__.py @@ -15,19 +15,19 @@ # under the License. # Convenience imports for public API components. -from horizon.tables.actions import Action -from horizon.tables.actions import BatchAction -from horizon.tables.actions import DeleteAction -from horizon.tables.actions import FilterAction -from horizon.tables.actions import FixedFilterAction -from horizon.tables.actions import LinkAction -from horizon.tables.base import Column -from horizon.tables.base import DataTable -from horizon.tables.base import Row -from horizon.tables.views import DataTableView -from horizon.tables.views import MixedDataTableView -from horizon.tables.views import MultiTableMixin -from horizon.tables.views import MultiTableView +from horizon.tables.actions import Action # noqa +from horizon.tables.actions import BatchAction # noqa +from horizon.tables.actions import DeleteAction # noqa +from horizon.tables.actions import FilterAction # noqa +from horizon.tables.actions import FixedFilterAction # noqa +from horizon.tables.actions import LinkAction # noqa +from horizon.tables.base import Column # noqa +from horizon.tables.base import DataTable # noqa +from horizon.tables.base import Row # noqa +from horizon.tables.views import DataTableView # noqa +from horizon.tables.views import MixedDataTableView # noqa +from horizon.tables.views import MultiTableMixin # noqa +from horizon.tables.views import MultiTableView # noqa assert Action assert BatchAction diff --git a/horizon/tables/actions.py b/horizon/tables/actions.py index b6aa0a4ad8..15ae3b56df 100644 --- a/horizon/tables/actions.py +++ b/horizon/tables/actions.py @@ -14,15 +14,15 @@ # License for the specific language governing permissions and limitations # under the License. -from collections import defaultdict +from collections import defaultdict # noqa import logging import new -from django.conf import settings +from django.conf import settings # noqa from django.core import urlresolvers from django import shortcuts -from django.utils.functional import Promise -from django.utils.translation import ugettext_lazy as _ +from django.utils.functional import Promise # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import messages diff --git a/horizon/tables/base.py b/horizon/tables/base.py index 1fdaf60744..3c690217b8 100644 --- a/horizon/tables/base.py +++ b/horizon/tables/base.py @@ -17,29 +17,29 @@ import collections import copy import logging -from operator import attrgetter +from operator import attrgetter # noqa import sys -from django.conf import settings +from django.conf import settings # noqa from django.core import urlresolvers from django import forms -from django.http import HttpResponse +from django.http import HttpResponse # noqa from django import template -from django.template.defaultfilters import truncatechars -from django.template.loader import render_to_string -from django.utils.datastructures import SortedDict -from django.utils.html import escape +from django.template.defaultfilters import truncatechars # noqa +from django.template.loader import render_to_string # noqa +from django.utils.datastructures import SortedDict # noqa +from django.utils.html import escape # noqa from django.utils import http -from django.utils.http import urlencode -from django.utils.safestring import mark_safe +from django.utils.http import urlencode # noqa +from django.utils.safestring import mark_safe # noqa from django.utils import termcolors -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import conf from horizon import exceptions from horizon import messages -from horizon.tables.actions import FilterAction -from horizon.tables.actions import LinkAction +from horizon.tables.actions import FilterAction # noqa +from horizon.tables.actions import LinkAction # noqa from horizon.utils import html diff --git a/horizon/tables/views.py b/horizon/tables/views.py index ad7dc4333f..d00b8f456e 100644 --- a/horizon/tables/views.py +++ b/horizon/tables/views.py @@ -14,11 +14,11 @@ # License for the specific language governing permissions and limitations # under the License. -from collections import defaultdict +from collections import defaultdict # noqa from django.views import generic -from horizon.templatetags.horizon import has_permissions +from horizon.templatetags.horizon import has_permissions # noqa class MultiTableMixin(object): diff --git a/horizon/tabs/__init__.py b/horizon/tabs/__init__.py index 75a7dddefd..33241ebd35 100644 --- a/horizon/tabs/__init__.py +++ b/horizon/tabs/__init__.py @@ -14,11 +14,11 @@ # License for the specific language governing permissions and limitations # under the License. -from horizon.tabs.base import Tab -from horizon.tabs.base import TabGroup -from horizon.tabs.base import TableTab -from horizon.tabs.views import TabbedTableView -from horizon.tabs.views import TabView +from horizon.tabs.base import Tab # noqa +from horizon.tabs.base import TabGroup # noqa +from horizon.tabs.base import TableTab # noqa +from horizon.tabs.views import TabbedTableView # noqa +from horizon.tabs.views import TabView # noqa assert TabGroup assert Tab diff --git a/horizon/tabs/base.py b/horizon/tabs/base.py index 5a00a241f4..e01814821b 100644 --- a/horizon/tabs/base.py +++ b/horizon/tabs/base.py @@ -16,9 +16,9 @@ import sys -from django.template.loader import render_to_string -from django.template import TemplateSyntaxError -from django.utils.datastructures import SortedDict +from django.template.loader import render_to_string # noqa +from django.template import TemplateSyntaxError # noqa +from django.utils.datastructures import SortedDict # noqa from horizon import exceptions from horizon.utils import html diff --git a/horizon/tabs/views.py b/horizon/tabs/views.py index c5d8f262c7..d2bc4ba6e7 100644 --- a/horizon/tabs/views.py +++ b/horizon/tabs/views.py @@ -3,7 +3,7 @@ from django.views import generic from horizon import exceptions from horizon import tables -from horizon.tabs.base import TableTab +from horizon.tabs.base import TableTab # noqa class TabView(generic.TemplateView): diff --git a/horizon/templatetags/branding.py b/horizon/templatetags/branding.py index 195c4cdfd9..28ac8374b8 100644 --- a/horizon/templatetags/branding.py +++ b/horizon/templatetags/branding.py @@ -22,9 +22,9 @@ Template tags for customizing Horizon. """ -from django.conf import settings +from django.conf import settings # noqa from django import template -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa register = template.Library() diff --git a/horizon/templatetags/horizon.py b/horizon/templatetags/horizon.py index 4de7ab33b7..1ede4e4c62 100644 --- a/horizon/templatetags/horizon.py +++ b/horizon/templatetags/horizon.py @@ -17,11 +17,11 @@ from __future__ import absolute_import from django import template -from django.utils.datastructures import SortedDict -from django.utils.encoding import force_unicode -from django.utils.translation import ugettext_lazy as _ +from django.utils.datastructures import SortedDict # noqa +from django.utils.encoding import force_unicode # noqa +from django.utils.translation import ugettext_lazy as _ # noqa -from horizon.base import Horizon +from horizon.base import Horizon # noqa from horizon import conf diff --git a/horizon/templatetags/parse_date.py b/horizon/templatetags/parse_date.py index bebe797b98..dbf71a1922 100644 --- a/horizon/templatetags/parse_date.py +++ b/horizon/templatetags/parse_date.py @@ -22,7 +22,7 @@ Template tags for parsing date strings. """ -from datetime import datetime +from datetime import datetime # noqa from django import template from django.utils import timezone diff --git a/horizon/test/customization/cust_test1.py b/horizon/test/customization/cust_test1.py index 965f1fafe7..8063873fc7 100644 --- a/horizon/test/customization/cust_test1.py +++ b/horizon/test/customization/cust_test1.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/horizon/test/helpers.py b/horizon/test/helpers.py index 9253f20dbe..1e5be2fd81 100644 --- a/horizon/test/helpers.py +++ b/horizon/test/helpers.py @@ -22,22 +22,22 @@ import logging import os import socket -from django.contrib.auth.middleware import AuthenticationMiddleware -from django.contrib.auth.models import Permission -from django.contrib.auth.models import User -from django.contrib.contenttypes.models import ContentType -from django.contrib.messages.storage import default_storage +from django.contrib.auth.middleware import AuthenticationMiddleware # noqa +from django.contrib.auth.models import Permission # noqa +from django.contrib.auth.models import User # noqa +from django.contrib.contenttypes.models import ContentType # noqa +from django.contrib.messages.storage import default_storage # noqa from django.core.handlers import wsgi from django import http from django import test as django_test -from django.test.client import RequestFactory +from django.test.client import RequestFactory # noqa from django.utils import unittest LOG = logging.getLogger(__name__) try: - from selenium.webdriver.firefox.webdriver import WebDriver + from selenium.webdriver.firefox.webdriver import WebDriver # noqa from selenium.webdriver.support import ui as selenium_ui except ImportError as e: # NOTE(saschpe): Several distribution can't ship selenium due to it's diff --git a/horizon/test/settings.py b/horizon/test/settings.py index 98c52721d1..270b90f587 100644 --- a/horizon/test/settings.py +++ b/horizon/test/settings.py @@ -21,7 +21,7 @@ import os import socket -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa socket.setdefaulttimeout(1) diff --git a/horizon/test/test_dashboards/cats/dashboard.py b/horizon/test/test_dashboards/cats/dashboard.py index 25c2bd4b5d..e919ff0899 100644 --- a/horizon/test/test_dashboards/cats/dashboard.py +++ b/horizon/test/test_dashboards/cats/dashboard.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/horizon/test/test_dashboards/cats/kittens/panel.py b/horizon/test/test_dashboards/cats/kittens/panel.py index a56e9c3f55..530387a62c 100644 --- a/horizon/test/test_dashboards/cats/kittens/panel.py +++ b/horizon/test/test_dashboards/cats/kittens/panel.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/horizon/test/test_dashboards/cats/kittens/urls.py b/horizon/test/test_dashboards/cats/kittens/urls.py index f660597185..53889dc420 100644 --- a/horizon/test/test_dashboards/cats/kittens/urls.py +++ b/horizon/test/test_dashboards/cats/kittens/urls.py @@ -1,7 +1,7 @@ -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from horizon.test.test_dashboards.cats.kittens.views import IndexView +from horizon.test.test_dashboards.cats.kittens.views import IndexView # noqa urlpatterns = patterns('', url(r'^$', IndexView.as_view(), name='index'), diff --git a/horizon/test/test_dashboards/cats/tigers/panel.py b/horizon/test/test_dashboards/cats/tigers/panel.py index 6439ef51af..11edfc76bd 100644 --- a/horizon/test/test_dashboards/cats/tigers/panel.py +++ b/horizon/test/test_dashboards/cats/tigers/panel.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/horizon/test/test_dashboards/cats/tigers/urls.py b/horizon/test/test_dashboards/cats/tigers/urls.py index 65352324c4..65e78dbc21 100644 --- a/horizon/test/test_dashboards/cats/tigers/urls.py +++ b/horizon/test/test_dashboards/cats/tigers/urls.py @@ -1,7 +1,7 @@ -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from horizon.test.test_dashboards.cats.tigers.views import IndexView +from horizon.test.test_dashboards.cats.tigers.views import IndexView # noqa urlpatterns = patterns('', url(r'^$', IndexView.as_view(), name='index'), diff --git a/horizon/test/test_dashboards/dogs/dashboard.py b/horizon/test/test_dashboards/dogs/dashboard.py index 0596eb4e0b..db28a37b68 100644 --- a/horizon/test/test_dashboards/dogs/dashboard.py +++ b/horizon/test/test_dashboards/dogs/dashboard.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/horizon/test/test_dashboards/dogs/puppies/panel.py b/horizon/test/test_dashboards/dogs/puppies/panel.py index a660436d94..775ca1da77 100644 --- a/horizon/test/test_dashboards/dogs/puppies/panel.py +++ b/horizon/test/test_dashboards/dogs/puppies/panel.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/horizon/test/test_dashboards/dogs/puppies/urls.py b/horizon/test/test_dashboards/dogs/puppies/urls.py index 356501850e..df661ab838 100644 --- a/horizon/test/test_dashboards/dogs/puppies/urls.py +++ b/horizon/test/test_dashboards/dogs/puppies/urls.py @@ -1,7 +1,7 @@ -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from horizon.test.test_dashboards.dogs.puppies.views import IndexView +from horizon.test.test_dashboards.dogs.puppies.views import IndexView # noqa urlpatterns = patterns('', url(r'^$', IndexView.as_view(), name='index'), diff --git a/horizon/test/tests/base.py b/horizon/test/tests/base.py index fd942fd0bb..f2185b7ed0 100644 --- a/horizon/test/tests/base.py +++ b/horizon/test/tests/base.py @@ -19,21 +19,21 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf import settings -from django.contrib.auth.models import User +from django.conf import settings # noqa +from django.contrib.auth.models import User # noqa from django.core import urlresolvers -from django.utils.importlib import import_module -from django.utils.translation import ugettext_lazy as _ +from django.utils.importlib import import_module # noqa +from django.utils.translation import ugettext_lazy as _ # noqa import horizon from horizon import base from horizon import conf from horizon.test import helpers as test -from horizon.test.test_dashboards.cats.dashboard import Cats -from horizon.test.test_dashboards.cats.kittens.panel import Kittens -from horizon.test.test_dashboards.cats.tigers.panel import Tigers -from horizon.test.test_dashboards.dogs.dashboard import Dogs -from horizon.test.test_dashboards.dogs.puppies.panel import Puppies +from horizon.test.test_dashboards.cats.dashboard import Cats # noqa +from horizon.test.test_dashboards.cats.kittens.panel import Kittens # noqa +from horizon.test.test_dashboards.cats.tigers.panel import Tigers # noqa +from horizon.test.test_dashboards.dogs.dashboard import Dogs # noqa +from horizon.test.test_dashboards.dogs.puppies.panel import Puppies # noqa class MyDash(horizon.Dashboard): diff --git a/horizon/test/tests/messages.py b/horizon/test/tests/messages.py index 8548ff4df9..164d9a0748 100644 --- a/horizon/test/tests/messages.py +++ b/horizon/test/tests/messages.py @@ -17,9 +17,9 @@ import json from django import http -from django.utils.encoding import force_unicode -from django.utils.safestring import mark_safe -from django.utils.translation import ugettext_lazy as _ +from django.utils.encoding import force_unicode # noqa +from django.utils.safestring import mark_safe # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import messages from horizon import middleware diff --git a/horizon/test/tests/middleware.py b/horizon/test/tests/middleware.py index 958e4233fe..af5b4516b0 100644 --- a/horizon/test/tests/middleware.py +++ b/horizon/test/tests/middleware.py @@ -15,7 +15,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf import settings +from django.conf import settings # noqa from horizon import exceptions from horizon import middleware diff --git a/horizon/test/tests/tables.py b/horizon/test/tests/tables.py index d17dc95d06..4dde51a78a 100644 --- a/horizon/test/tests/tables.py +++ b/horizon/test/tests/tables.py @@ -14,12 +14,12 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http from django import shortcuts -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa -from mox import IsA +from mox import IsA # noqa from horizon import tables from horizon.tables import views as table_views diff --git a/horizon/test/tests/tabs.py b/horizon/test/tests/tabs.py index 346fe581c0..157d96df51 100644 --- a/horizon/test/tests/tabs.py +++ b/horizon/test/tests/tabs.py @@ -17,14 +17,14 @@ import copy from django import http -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs as horizon_tabs from horizon.test import helpers as test -from horizon.test.tests.tables import MyTable -from horizon.test.tests.tables import TEST_DATA +from horizon.test.tests.tables import MyTable # noqa +from horizon.test.tests.tables import TEST_DATA # noqa class BaseTestTab(horizon_tabs.Tab): diff --git a/horizon/test/tests/templatetags.py b/horizon/test/tests/templatetags.py index 2c772c2696..25df8b6b97 100644 --- a/horizon/test/tests/templatetags.py +++ b/horizon/test/tests/templatetags.py @@ -20,10 +20,10 @@ import re -from django.conf import settings -from django.template import Context -from django.template import Template -from django.utils.text import normalize_newlines +from django.conf import settings # noqa +from django.template import Context # noqa +from django.template import Template # noqa +from django.utils.text import normalize_newlines # noqa from horizon.test import helpers as test diff --git a/horizon/test/tests/utils.py b/horizon/test/tests/utils.py index aceee4e76e..2f99d4561c 100644 --- a/horizon/test/tests/utils.py +++ b/horizon/test/tests/utils.py @@ -17,7 +17,7 @@ import os -from django.core.exceptions import ValidationError +from django.core.exceptions import ValidationError # noqa from horizon.test import helpers as test from horizon.utils import fields diff --git a/horizon/test/tests/workflows.py b/horizon/test/tests/workflows.py index 005228420f..0e9e4f0722 100644 --- a/horizon/test/tests/workflows.py +++ b/horizon/test/tests/workflows.py @@ -16,7 +16,7 @@ from django import forms from django import http -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon.test import helpers as test diff --git a/horizon/test/urls.py b/horizon/test/urls.py index 4fd0957b6b..b6bce7dca6 100644 --- a/horizon/test/urls.py +++ b/horizon/test/urls.py @@ -22,11 +22,11 @@ URL patterns for testing Horizon views. """ -from django.conf.urls.defaults import include -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url -from django.contrib.staticfiles.urls import staticfiles_urlpatterns -from django.views.generic import TemplateView +from django.conf.urls.defaults import include # noqa +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa +from django.contrib.staticfiles.urls import staticfiles_urlpatterns # noqa +from django.views.generic import TemplateView # noqa import horizon diff --git a/horizon/utils/fields.py b/horizon/utils/fields.py index 955ebd9aae..39f98c248c 100644 --- a/horizon/utils/fields.py +++ b/horizon/utils/fields.py @@ -1,11 +1,11 @@ -from django.core.exceptions import ValidationError +from django.core.exceptions import ValidationError # noqa from django.forms import forms from django.forms import widgets -from django.utils.encoding import force_unicode -from django.utils.functional import Promise -from django.utils.html import conditional_escape -from django.utils.html import escape -from django.utils.translation import ugettext_lazy as _ +from django.utils.encoding import force_unicode # noqa +from django.utils.functional import Promise # noqa +from django.utils.html import conditional_escape # noqa +from django.utils.html import escape # noqa +from django.utils.translation import ugettext_lazy as _ # noqa import netaddr import re diff --git a/horizon/utils/filters.py b/horizon/utils/filters.py index b47a0cf387..e73b18886b 100644 --- a/horizon/utils/filters.py +++ b/horizon/utils/filters.py @@ -16,7 +16,7 @@ import iso8601 -from django.template.defaultfilters import register +from django.template.defaultfilters import register # noqa @register.filter diff --git a/horizon/utils/functions.py b/horizon/utils/functions.py index e7ae8d4685..c0c0875beb 100644 --- a/horizon/utils/functions.py +++ b/horizon/utils/functions.py @@ -1,7 +1,7 @@ import math -from django.utils.encoding import force_unicode -from django.utils.functional import lazy +from django.utils.encoding import force_unicode # noqa +from django.utils.functional import lazy # noqa def _lazy_join(separator, strings): diff --git a/horizon/utils/html.py b/horizon/utils/html.py index a3bb3f8c49..3250ba9eda 100644 --- a/horizon/utils/html.py +++ b/horizon/utils/html.py @@ -1,6 +1,6 @@ import copy -from django.forms.util import flatatt +from django.forms.util import flatatt # noqa class HTMLElement(object): diff --git a/horizon/utils/validators.py b/horizon/utils/validators.py index 183e5a4188..529c7a5fe3 100644 --- a/horizon/utils/validators.py +++ b/horizon/utils/validators.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.exceptions import ValidationError +from django.core.exceptions import ValidationError # noqa from horizon import conf diff --git a/horizon/workflows/__init__.py b/horizon/workflows/__init__.py index dc87dad8b1..5c72562038 100644 --- a/horizon/workflows/__init__.py +++ b/horizon/workflows/__init__.py @@ -1,9 +1,9 @@ -from horizon.workflows.base import Action -from horizon.workflows.base import MembershipAction -from horizon.workflows.base import Step -from horizon.workflows.base import UpdateMembersStep -from horizon.workflows.base import Workflow -from horizon.workflows.views import WorkflowView +from horizon.workflows.base import Action # noqa +from horizon.workflows.base import MembershipAction # noqa +from horizon.workflows.base import Step # noqa +from horizon.workflows.base import UpdateMembersStep # noqa +from horizon.workflows.base import Workflow # noqa +from horizon.workflows.views import WorkflowView # noqa assert Action assert MembershipAction diff --git a/horizon/workflows/base.py b/horizon/workflows/base.py index b63a621780..7e17886807 100644 --- a/horizon/workflows/base.py +++ b/horizon/workflows/base.py @@ -20,18 +20,18 @@ import logging from django.core import urlresolvers from django import forms -from django.forms.forms import NON_FIELD_ERRORS +from django.forms.forms import NON_FIELD_ERRORS # noqa from django import template -from django.template.defaultfilters import linebreaks -from django.template.defaultfilters import safe -from django.template.defaultfilters import slugify -from django.utils.encoding import force_unicode -from django.utils.importlib import import_module -from django.utils.translation import ugettext_lazy as _ +from django.template.defaultfilters import linebreaks # noqa +from django.template.defaultfilters import safe # noqa +from django.template.defaultfilters import slugify # noqa +from django.utils.encoding import force_unicode # noqa +from django.utils.importlib import import_module # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import base from horizon import exceptions -from horizon.templatetags.horizon import has_permissions +from horizon.templatetags.horizon import has_permissions # noqa from horizon.utils import html diff --git a/horizon/workflows/views.py b/horizon/workflows/views.py index db782ce3f2..beb9db12d9 100644 --- a/horizon/workflows/views.py +++ b/horizon/workflows/views.py @@ -22,7 +22,7 @@ from django import shortcuts from django.views import generic from horizon import exceptions -from horizon.forms.views import ADD_TO_FIELD_HEADER +from horizon.forms.views import ADD_TO_FIELD_HEADER # noqa from horizon import messages diff --git a/openstack_dashboard/api/base.py b/openstack_dashboard/api/base.py index 3edb52262f..d2e63b402f 100644 --- a/openstack_dashboard/api/base.py +++ b/openstack_dashboard/api/base.py @@ -18,10 +18,10 @@ # License for the specific language governing permissions and limitations # under the License. -from collections import Sequence +from collections import Sequence # noqa import logging -from django.conf import settings +from django.conf import settings # noqa from horizon import exceptions diff --git a/openstack_dashboard/api/cinder.py b/openstack_dashboard/api/cinder.py index aa6b7740e5..b29313f4b4 100644 --- a/openstack_dashboard/api/cinder.py +++ b/openstack_dashboard/api/cinder.py @@ -24,15 +24,14 @@ from __future__ import absolute_import import logging -from django.conf import settings -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from cinderclient.v1 import client as cinder_client from horizon import exceptions -from openstack_dashboard.api.base import QuotaSet -from openstack_dashboard.api.base import url_for +from openstack_dashboard.api import base from openstack_dashboard.api import nova LOG = logging.getLogger(__name__) @@ -46,7 +45,7 @@ def cinderclient(request): insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) cinder_url = "" try: - cinder_url = url_for(request, 'volume') + cinder_url = base.url_for(request, 'volume') except exceptions.ServiceCatalogException: LOG.debug('no volume service configured.') return None @@ -123,8 +122,8 @@ def volume_snapshot_delete(request, snapshot_id): def tenant_quota_get(request, tenant_id): c_client = cinderclient(request) if c_client is None: - return QuotaSet() - return QuotaSet(c_client.quotas.get(tenant_id)) + return base.QuotaSet() + return base.QuotaSet(c_client.quotas.get(tenant_id)) def tenant_quota_update(request, tenant_id, **kwargs): @@ -132,7 +131,7 @@ def tenant_quota_update(request, tenant_id, **kwargs): def default_quota_get(request, tenant_id): - return QuotaSet(cinderclient(request).quotas.defaults(tenant_id)) + return base.QuotaSet(cinderclient(request).quotas.defaults(tenant_id)) def volume_type_list(request): diff --git a/openstack_dashboard/api/glance.py b/openstack_dashboard/api/glance.py index 1537acac1a..ca9db82d00 100644 --- a/openstack_dashboard/api/glance.py +++ b/openstack_dashboard/api/glance.py @@ -25,18 +25,18 @@ import logging import thread import urlparse -from django.conf import settings +from django.conf import settings # noqa import glanceclient as glance_client -from openstack_dashboard.api.base import url_for +from openstack_dashboard.api import base LOG = logging.getLogger(__name__) def glanceclient(request): - o = urlparse.urlparse(url_for(request, 'image')) + o = urlparse.urlparse(base.url_for(request, 'image')) url = "://".join((o.scheme, o.netloc)) insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) LOG.debug('glanceclient connection created using token "%s" and url "%s"' diff --git a/openstack_dashboard/api/heat.py b/openstack_dashboard/api/heat.py index 815b09632f..2f2449c57a 100644 --- a/openstack_dashboard/api/heat.py +++ b/openstack_dashboard/api/heat.py @@ -14,9 +14,9 @@ import logging -from django.conf import settings +from django.conf import settings # noqa from heatclient import client as heat_client -from openstack_dashboard.api.base import url_for +from openstack_dashboard.api import base LOG = logging.getLogger(__name__) @@ -32,7 +32,7 @@ def format_parameters(params): def heatclient(request, password=None): api_version = "1" insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) - endpoint = url_for(request, 'orchestration') + endpoint = base.url_for(request, 'orchestration') LOG.debug('heatclient connection created using token "%s" and url "%s"' % (request.user.token.id, endpoint)) kwargs = { diff --git a/openstack_dashboard/api/keystone.py b/openstack_dashboard/api/keystone.py index 5dc9864f40..6104baa417 100644 --- a/openstack_dashboard/api/keystone.py +++ b/openstack_dashboard/api/keystone.py @@ -22,13 +22,13 @@ import logging import urlparse -from django.conf import settings -from django.contrib.auth import logout -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.contrib.auth import logout # noqa +from django.utils.translation import ugettext_lazy as _ # noqa -from keystoneclient.exceptions import ClientException +from keystoneclient.exceptions import ClientException # noqa -from openstack_auth.backend import KEYSTONE_CLIENT_ATTR +from openstack_auth.backend import KEYSTONE_CLIENT_ATTR # noqa from horizon import exceptions from horizon import messages diff --git a/openstack_dashboard/api/lbaas.py b/openstack_dashboard/api/lbaas.py index 990b12f3f1..36a3829207 100644 --- a/openstack_dashboard/api/lbaas.py +++ b/openstack_dashboard/api/lbaas.py @@ -16,9 +16,9 @@ from __future__ import absolute_import -from openstack_dashboard.api.neutron import NeutronAPIDictWrapper -from openstack_dashboard.api.neutron import neutronclient -from openstack_dashboard.api.neutron import subnet_get +from openstack_dashboard.api.neutron import NeutronAPIDictWrapper # noqa +from openstack_dashboard.api.neutron import neutronclient # noqa +from openstack_dashboard.api.neutron import subnet_get # noqa class Vip(NeutronAPIDictWrapper): diff --git a/openstack_dashboard/api/network.py b/openstack_dashboard/api/network.py index b6abbc6d27..b4ed3c3525 100644 --- a/openstack_dashboard/api/network.py +++ b/openstack_dashboard/api/network.py @@ -21,7 +21,7 @@ introduced to abstract the differences between them for seamless consumption by different dashboard implementations. """ -from django.conf import settings +from django.conf import settings # noqa from openstack_dashboard.api import base from openstack_dashboard.api import neutron diff --git a/openstack_dashboard/api/neutron.py b/openstack_dashboard/api/neutron.py index de060e7dc0..0e24ccd132 100644 --- a/openstack_dashboard/api/neutron.py +++ b/openstack_dashboard/api/neutron.py @@ -23,12 +23,11 @@ from __future__ import absolute_import import logging -from django.conf import settings -from django.utils.datastructures import SortedDict -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.utils.datastructures import SortedDict # noqa +from django.utils.translation import ugettext_lazy as _ # noqa -from openstack_dashboard.api.base import APIDictWrapper -from openstack_dashboard.api.base import url_for +from openstack_dashboard.api import base from openstack_dashboard.api import network_base from openstack_dashboard.api import nova @@ -39,7 +38,7 @@ LOG = logging.getLogger(__name__) IP_VERSION_DICT = {4: 'IPv4', 6: 'IPv6'} -class NeutronAPIDictWrapper(APIDictWrapper): +class NeutronAPIDictWrapper(base.APIDictWrapper): def set_id_as_name_if_empty(self, length=8): try: @@ -262,7 +261,7 @@ class SecurityGroupManager(network_base.SecurityGroupManager): port_modify(self.request, p.id, **params) -class FloatingIp(APIDictWrapper): +class FloatingIp(base.APIDictWrapper): _attrs = ['id', 'ip', 'fixed_ip', 'port_id', 'instance_id', 'pool'] def __init__(self, fip): @@ -272,11 +271,11 @@ class FloatingIp(APIDictWrapper): super(FloatingIp, self).__init__(fip) -class FloatingIpPool(APIDictWrapper): +class FloatingIpPool(base.APIDictWrapper): pass -class FloatingIpTarget(APIDictWrapper): +class FloatingIpTarget(base.APIDictWrapper): pass @@ -382,11 +381,11 @@ def get_ipver_str(ip_version): def neutronclient(request): insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) LOG.debug('neutronclient connection created using token "%s" and url "%s"' - % (request.user.token.id, url_for(request, 'network'))) + % (request.user.token.id, base.url_for(request, 'network'))) LOG.debug('user_id=%(user)s, tenant_id=%(tenant)s' % {'user': request.user.id, 'tenant': request.user.tenant_id}) c = neutron_client.Client(token=request.user.token.id, - endpoint_url=url_for(request, 'network'), + endpoint_url=base.url_for(request, 'network'), insecure=insecure) return c diff --git a/openstack_dashboard/api/nova.py b/openstack_dashboard/api/nova.py index 396b92042b..dad8d016fc 100644 --- a/openstack_dashboard/api/nova.py +++ b/openstack_dashboard/api/nova.py @@ -24,23 +24,20 @@ from __future__ import absolute_import import logging -from django.conf import settings -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from novaclient.v1_1 import client as nova_client -from novaclient.v1_1.contrib.list_extensions import ListExtManager +from novaclient.v1_1.contrib.list_extensions import ListExtManager # noqa from novaclient.v1_1 import security_group_rules as nova_rules -from novaclient.v1_1.security_groups import SecurityGroup as NovaSecurityGroup -from novaclient.v1_1.servers import REBOOT_HARD -from novaclient.v1_1.servers import REBOOT_SOFT +from novaclient.v1_1.security_groups import SecurityGroup as NovaSecurityGroup # noqa +from novaclient.v1_1.servers import REBOOT_HARD # noqa +from novaclient.v1_1.servers import REBOOT_SOFT # noqa -from horizon.conf import HORIZON_CONFIG -from horizon.utils.memoized import memoized +from horizon.conf import HORIZON_CONFIG # noqa +from horizon.utils.memoized import memoized # noqa -from openstack_dashboard.api.base import APIDictWrapper -from openstack_dashboard.api.base import APIResourceWrapper -from openstack_dashboard.api.base import QuotaSet -from openstack_dashboard.api.base import url_for +from openstack_dashboard.api import base from openstack_dashboard.api import network_base @@ -52,21 +49,21 @@ INSTANCE_ACTIVE_STATE = 'ACTIVE' VOLUME_STATE_AVAILABLE = "available" -class VNCConsole(APIDictWrapper): +class VNCConsole(base.APIDictWrapper): """Wrapper for the "console" dictionary returned by the novaclient.servers.get_vnc_console method. """ _attrs = ['url', 'type'] -class SPICEConsole(APIDictWrapper): +class SPICEConsole(base.APIDictWrapper): """Wrapper for the "console" dictionary returned by the novaclient.servers.get_spice_console method. """ _attrs = ['url', 'type'] -class Server(APIResourceWrapper): +class Server(base.APIResourceWrapper): """Simple wrapper around novaclient.server.Server Preserves the request info so image name can later be retrieved @@ -100,7 +97,7 @@ class Server(APIResourceWrapper): return getattr(self, 'OS-EXT-SRV-ATTR:instance_name', "") -class NovaUsage(APIResourceWrapper): +class NovaUsage(base.APIResourceWrapper): """Simple wrapper around contrib/simple_usage.py.""" _attrs = ['start', 'server_usages', 'stop', 'tenant_id', 'total_local_gb_usage', 'total_memory_mb_usage', @@ -142,7 +139,7 @@ class NovaUsage(APIResourceWrapper): return getattr(self, "total_local_gb_usage", 0) -class SecurityGroup(APIResourceWrapper): +class SecurityGroup(base.APIResourceWrapper): """Wrapper around novaclient.security_groups.SecurityGroup which wraps its rules in SecurityGroupRule objects and allows access to them. """ @@ -159,7 +156,7 @@ class SecurityGroup(APIResourceWrapper): return self.__dict__['_rules'] -class SecurityGroupRule(APIResourceWrapper): +class SecurityGroupRule(base.APIResourceWrapper): """ Wrapper for individual rules in a SecurityGroup. """ _attrs = ['id', 'ip_protocol', 'from_port', 'to_port', 'ip_range', 'group'] @@ -275,7 +272,7 @@ class FlavorExtraSpec(object): self.value = val -class FloatingIp(APIResourceWrapper): +class FloatingIp(base.APIResourceWrapper): _attrs = ['id', 'ip', 'fixed_ip', 'port_id', 'instance_id', 'pool'] def __init__(self, fip): @@ -283,14 +280,14 @@ class FloatingIp(APIResourceWrapper): super(FloatingIp, self).__init__(fip) -class FloatingIpPool(APIDictWrapper): +class FloatingIpPool(base.APIDictWrapper): def __init__(self, pool): pool_dict = {'id': pool.name, 'name': pool.name} super(FloatingIpPool, self).__init__(pool_dict) -class FloatingIpTarget(APIDictWrapper): +class FloatingIpTarget(base.APIDictWrapper): def __init__(self, server): server_dict = {'name': '%s (%s)' % (server.name, server.id), 'id': server.id} @@ -343,15 +340,15 @@ class FloatingIpManager(network_base.FloatingIpManager): def novaclient(request): insecure = getattr(settings, 'OPENSTACK_SSL_NO_VERIFY', False) LOG.debug('novaclient connection created using token "%s" and url "%s"' % - (request.user.token.id, url_for(request, 'compute'))) + (request.user.token.id, base.url_for(request, 'compute'))) c = nova_client.Client(request.user.username, request.user.token.id, project_id=request.user.tenant_id, - auth_url=url_for(request, 'compute'), + auth_url=base.url_for(request, 'compute'), insecure=insecure, http_log_debug=settings.DEBUG) c.client.auth_token = request.user.token.id - c.client.management_url = url_for(request, 'compute') + c.client.management_url = base.url_for(request, 'compute') return c @@ -545,7 +542,7 @@ def server_stop(request, instance_id): def tenant_quota_get(request, tenant_id): - return QuotaSet(novaclient(request).quotas.get(tenant_id)) + return base.QuotaSet(novaclient(request).quotas.get(tenant_id)) def tenant_quota_update(request, tenant_id, **kwargs): @@ -553,7 +550,7 @@ def tenant_quota_update(request, tenant_id, **kwargs): def default_quota_get(request, tenant_id): - return QuotaSet(novaclient(request).quotas.defaults(tenant_id)) + return base.QuotaSet(novaclient(request).quotas.defaults(tenant_id)) def usage_get(request, tenant_id, start, end): @@ -589,7 +586,7 @@ def instance_volume_detach(request, instance_id, att_id): def instance_volumes_list(request, instance_id): - from openstack_dashboard.api.cinder import cinderclient + from openstack_dashboard.api.cinder import cinderclient # noqa volumes = novaclient(request).volumes.get_server_volumes(instance_id) diff --git a/openstack_dashboard/api/swift.py b/openstack_dashboard/api/swift.py index b48133aaa7..200c7107e6 100644 --- a/openstack_dashboard/api/swift.py +++ b/openstack_dashboard/api/swift.py @@ -22,14 +22,13 @@ import logging import swiftclient -from django.conf import settings -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import messages -from openstack_dashboard.api.base import APIDictWrapper -from openstack_dashboard.api.base import url_for +from openstack_dashboard.api import base from openstack_dashboard.openstack.common import timeutils @@ -37,11 +36,11 @@ LOG = logging.getLogger(__name__) FOLDER_DELIMITER = "/" -class Container(APIDictWrapper): +class Container(base.APIDictWrapper): pass -class StorageObject(APIDictWrapper): +class StorageObject(base.APIDictWrapper): def __init__(self, apidict, container_name, orig_name=None, data=None): super(StorageObject, self).__init__(apidict) self.container_name = container_name @@ -53,7 +52,7 @@ class StorageObject(APIDictWrapper): return self.name -class PseudoFolder(APIDictWrapper): +class PseudoFolder(base.APIDictWrapper): def __init__(self, apidict, container_name): super(PseudoFolder, self).__init__(apidict) self.container_name = container_name @@ -92,7 +91,7 @@ def _objectify(items, container_name): def swift_api(request): - endpoint = url_for(request, 'object-store') + endpoint = base.url_for(request, 'object-store') LOG.debug('Swift connection created using token "%s" and url "%s"' % (request.user.token.id, endpoint)) return swiftclient.client.Connection(None, diff --git a/openstack_dashboard/context_processors.py b/openstack_dashboard/context_processors.py index 4d715f36a9..6ba0ed42ad 100644 --- a/openstack_dashboard/context_processors.py +++ b/openstack_dashboard/context_processors.py @@ -23,7 +23,7 @@ Context processors used by Horizon. import logging -from django.conf import settings +from django.conf import settings # noqa LOG = logging.getLogger(__name__) diff --git a/openstack_dashboard/dashboards/admin/dashboard.py b/openstack_dashboard/dashboards/admin/dashboard.py index ce4456c7ec..a77807cb37 100644 --- a/openstack_dashboard/dashboards/admin/dashboard.py +++ b/openstack_dashboard/dashboards/admin/dashboard.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/admin/domains/panel.py b/openstack_dashboard/dashboards/admin/domains/panel.py index 68f1058e81..6ee3984de5 100644 --- a/openstack_dashboard/dashboards/admin/domains/panel.py +++ b/openstack_dashboard/dashboards/admin/domains/panel.py @@ -14,11 +14,11 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon -from openstack_dashboard.api.keystone import VERSIONS as IDENTITY_VERSIONS +from openstack_dashboard.api.keystone import VERSIONS as IDENTITY_VERSIONS # noqa from openstack_dashboard.dashboards.admin import dashboard diff --git a/openstack_dashboard/dashboards/admin/domains/tables.py b/openstack_dashboard/dashboards/admin/domains/tables.py index 7c954a6b6e..d880bcf11d 100644 --- a/openstack_dashboard/dashboards/admin/domains/tables.py +++ b/openstack_dashboard/dashboards/admin/domains/tables.py @@ -16,22 +16,17 @@ import logging -from django.conf import settings -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.utils.translation import ugettext_lazy as _ # noqa -from keystoneclient.exceptions import ClientException +from keystoneclient.exceptions import ClientException # noqa from horizon import messages from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.domains.constants \ - import DOMAINS_CREATE_URL -from openstack_dashboard.dashboards.admin.domains.constants \ - import DOMAINS_INDEX_URL -from openstack_dashboard.dashboards.admin.domains.constants \ - import DOMAINS_UPDATE_URL +from openstack_dashboard.dashboards.admin.domains import constants LOG = logging.getLogger(__name__) @@ -40,7 +35,7 @@ LOG = logging.getLogger(__name__) class CreateDomainLink(tables.LinkAction): name = "create" verbose_name = _("Create Domain") - url = DOMAINS_CREATE_URL + url = constants.DOMAINS_CREATE_URL classes = ("ajax-modal", "btn-create") def allowed(self, request, domain): @@ -50,7 +45,7 @@ class CreateDomainLink(tables.LinkAction): class EditDomainLink(tables.LinkAction): name = "edit" verbose_name = _("Edit") - url = DOMAINS_UPDATE_URL + url = constants.DOMAINS_UPDATE_URL classes = ("ajax-modal", "btn-edit") def allowed(self, request, domain): @@ -99,7 +94,7 @@ class DomainFilterAction(tables.FilterAction): class SetDomainContext(tables.Action): name = "set_domain_context" verbose_name = _("Set Domain Context") - url = DOMAINS_INDEX_URL + url = constants.DOMAINS_INDEX_URL preempt = True def allowed(self, request, datum): @@ -132,7 +127,7 @@ class SetDomainContext(tables.Action): class UnsetDomainContext(tables.Action): name = "clear_domain_context" verbose_name = _("Clear Domain Context") - url = DOMAINS_INDEX_URL + url = constants.DOMAINS_INDEX_URL preempt = True requires_input = False diff --git a/openstack_dashboard/dashboards/admin/domains/tests.py b/openstack_dashboard/dashboards/admin/domains/tests.py index f3f2e984f8..2edf989dbc 100644 --- a/openstack_dashboard/dashboards/admin/domains/tests.py +++ b/openstack_dashboard/dashboards/admin/domains/tests.py @@ -15,32 +15,24 @@ # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IgnoreArg -from mox import IsA +from mox import IgnoreArg # noqa +from mox import IsA # noqa -from horizon.workflows.views import WorkflowView +from horizon.workflows import views from openstack_dashboard import api from openstack_dashboard.test import helpers as test -from openstack_dashboard.dashboards.admin.domains.constants \ - import DOMAINS_CREATE_URL as create_url -from openstack_dashboard.dashboards.admin.domains.constants \ - import DOMAINS_INDEX_URL as index_url -from openstack_dashboard.dashboards.admin.domains.constants \ - import DOMAINS_INDEX_VIEW_TEMPLATE -from openstack_dashboard.dashboards.admin.domains.constants \ - import DOMAINS_UPDATE_URL as update_url -from openstack_dashboard.dashboards.admin.domains.workflows import CreateDomain -from openstack_dashboard.dashboards.admin.domains.workflows import UpdateDomain +from openstack_dashboard.dashboards.admin.domains import constants +from openstack_dashboard.dashboards.admin.domains import workflows -DOMAINS_INDEX_URL = reverse(index_url) -DOMAIN_CREATE_URL = reverse(create_url) -DOMAIN_UPDATE_URL = reverse(update_url, args=[1]) +DOMAINS_INDEX_URL = reverse(constants.DOMAINS_INDEX_URL) +DOMAIN_CREATE_URL = reverse(constants.DOMAINS_CREATE_URL) +DOMAIN_UPDATE_URL = reverse(constants.DOMAINS_UPDATE_URL, args=[1]) class DomainsViewTests(test.BaseAdminViewTests): @@ -52,7 +44,7 @@ class DomainsViewTests(test.BaseAdminViewTests): res = self.client.get(DOMAINS_INDEX_URL) - self.assertTemplateUsed(res, DOMAINS_INDEX_VIEW_TEMPLATE) + self.assertTemplateUsed(res, constants.DOMAINS_INDEX_VIEW_TEMPLATE) self.assertItemsEqual(res.context['table'].data, self.domains.list()) self.assertContains(res, 'Create Domain') self.assertContains(res, 'Edit') @@ -69,7 +61,7 @@ class DomainsViewTests(test.BaseAdminViewTests): res = self.client.get(DOMAINS_INDEX_URL) - self.assertTemplateUsed(res, DOMAINS_INDEX_VIEW_TEMPLATE) + self.assertTemplateUsed(res, constants.DOMAINS_INDEX_VIEW_TEMPLATE) self.assertItemsEqual(res.context['table'].data, self.domains.list()) self.assertNotContains(res, 'Create Domain') self.assertNotContains(res, 'Edit') @@ -119,14 +111,14 @@ class DomainsViewTests(test.BaseAdminViewTests): formData = {'action': 'domains__set_domain_context__%s' % domain.id} res = self.client.post(DOMAINS_INDEX_URL, formData) - self.assertTemplateUsed(res, DOMAINS_INDEX_VIEW_TEMPLATE) + self.assertTemplateUsed(res, constants.DOMAINS_INDEX_VIEW_TEMPLATE) self.assertItemsEqual(res.context['table'].data, [domain, ]) self.assertContains(res, "test_domain:") formData = {'action': 'domains__clear_domain_context__%s' % domain.id} res = self.client.post(DOMAINS_INDEX_URL, formData) - self.assertTemplateUsed(res, DOMAINS_INDEX_VIEW_TEMPLATE) + self.assertTemplateUsed(res, constants.DOMAINS_INDEX_VIEW_TEMPLATE) self.assertItemsEqual(res.context['table'].data, self.domains.list()) self.assertNotContains(res, "test_domain:") @@ -146,10 +138,11 @@ class CreateDomainWorkflowTests(test.BaseAdminViewTests): url = reverse('horizon:admin:domains:create') res = self.client.get(url) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) workflow = res.context['workflow'] - self.assertEqual(res.context['workflow'].name, CreateDomain.name) + self.assertEqual(res.context['workflow'].name, + workflows.CreateDomain.name) self.assertQuerysetEqual(workflow.steps, ['', ]) @@ -195,10 +188,11 @@ class UpdateDomainWorkflowTests(test.BaseAdminViewTests): res = self.client.get(DOMAIN_UPDATE_URL) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) workflow = res.context['workflow'] - self.assertEqual(res.context['workflow'].name, UpdateDomain.name) + self.assertEqual(res.context['workflow'].name, + workflows.UpdateDomain.name) self.assertQuerysetEqual(workflow.steps, ['', ]) diff --git a/openstack_dashboard/dashboards/admin/domains/urls.py b/openstack_dashboard/dashboards/admin/domains/urls.py index 19448ecf73..51b92f18fa 100644 --- a/openstack_dashboard/dashboards/admin/domains/urls.py +++ b/openstack_dashboard/dashboards/admin/domains/urls.py @@ -14,17 +14,15 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.domains.views import CreateDomainView -from openstack_dashboard.dashboards.admin.domains.views import IndexView -from openstack_dashboard.dashboards.admin.domains.views import UpdateDomainView +from openstack_dashboard.dashboards.admin.domains import views urlpatterns = patterns('', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^create$', CreateDomainView.as_view(), name='create'), + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^create$', views.CreateDomainView.as_view(), name='create'), url(r'^(?P[^/]+)/update/$', - UpdateDomainView.as_view(), name='update') + views.UpdateDomainView.as_view(), name='update') ) diff --git a/openstack_dashboard/dashboards/admin/domains/views.py b/openstack_dashboard/dashboards/admin/domains/views.py index 2a3b3d78a4..fd8853cf28 100644 --- a/openstack_dashboard/dashboards/admin/domains/views.py +++ b/openstack_dashboard/dashboards/admin/domains/views.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables @@ -23,22 +23,16 @@ from horizon import workflows from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.domains.constants \ - import DOMAIN_INFO_FIELDS -from openstack_dashboard.dashboards.admin.domains.constants \ - import DOMAINS_INDEX_URL -from openstack_dashboard.dashboards.admin.domains.constants \ - import DOMAINS_INDEX_VIEW_TEMPLATE -from openstack_dashboard.dashboards.admin.domains.tables import DomainsTable -from openstack_dashboard.dashboards.admin.domains.workflows \ - import CreateDomain -from openstack_dashboard.dashboards.admin.domains.workflows \ - import UpdateDomain +from openstack_dashboard.dashboards.admin.domains import constants +from openstack_dashboard.dashboards.admin.domains \ + import tables as project_tables +from openstack_dashboard.dashboards.admin.domains \ + import workflows as project_workflows class IndexView(tables.DataTableView): - table_class = DomainsTable - template_name = DOMAINS_INDEX_VIEW_TEMPLATE + table_class = project_tables.DomainsTable + template_name = constants.DOMAINS_INDEX_VIEW_TEMPLATE def get_data(self): domains = [] @@ -57,11 +51,11 @@ class IndexView(tables.DataTableView): class CreateDomainView(workflows.WorkflowView): - workflow_class = CreateDomain + workflow_class = project_workflows.CreateDomain class UpdateDomainView(workflows.WorkflowView): - workflow_class = UpdateDomain + workflow_class = project_workflows.UpdateDomain def get_initial(self): initial = super(UpdateDomainView, self).get_initial() @@ -73,10 +67,10 @@ class UpdateDomainView(workflows.WorkflowView): # get initial domain info domain_info = api.keystone.domain_get(self.request, domain_id) - for field in DOMAIN_INFO_FIELDS: + for field in constants.DOMAIN_INFO_FIELDS: initial[field] = getattr(domain_info, field, None) except Exception: exceptions.handle(self.request, _('Unable to retrieve domain details.'), - redirect=reverse(DOMAINS_INDEX_URL)) + redirect=reverse(constants.DOMAINS_INDEX_URL)) return initial diff --git a/openstack_dashboard/dashboards/admin/domains/workflows.py b/openstack_dashboard/dashboards/admin/domains/workflows.py index 7b01300e4d..42d71085cd 100644 --- a/openstack_dashboard/dashboards/admin/domains/workflows.py +++ b/openstack_dashboard/dashboards/admin/domains/workflows.py @@ -16,7 +16,7 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -24,8 +24,7 @@ from horizon import workflows from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.domains.constants \ - import DOMAINS_INDEX_URL +from openstack_dashboard.dashboards.admin.domains import constants LOG = logging.getLogger(__name__) @@ -61,7 +60,7 @@ class CreateDomain(workflows.Workflow): finalize_button_name = _("Create Domain") success_message = _('Created new domain "%s".') failure_message = _('Unable to create domain "%s".') - success_url = DOMAINS_INDEX_URL + success_url = constants.DOMAINS_INDEX_URL default_steps = (CreateDomainInfo, ) def format_status_message(self, message): @@ -105,7 +104,7 @@ class UpdateDomain(workflows.Workflow): finalize_button_name = _("Save") success_message = _('Modified domain "%s".') failure_message = _('Unable to modify domain "%s".') - success_url = DOMAINS_INDEX_URL + success_url = constants.DOMAINS_INDEX_URL default_steps = (UpdateDomainInfo, ) def format_status_message(self, message): diff --git a/openstack_dashboard/dashboards/admin/flavors/extras/forms.py b/openstack_dashboard/dashboards/admin/flavors/extras/forms.py index 11241087c2..b54731cef8 100644 --- a/openstack_dashboard/dashboards/admin/flavors/extras/forms.py +++ b/openstack_dashboard/dashboards/admin/flavors/extras/forms.py @@ -20,7 +20,7 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/admin/flavors/extras/tables.py b/openstack_dashboard/dashboards/admin/flavors/extras/tables.py index f8f8e07a80..dac0e4afe4 100644 --- a/openstack_dashboard/dashboards/admin/flavors/extras/tables.py +++ b/openstack_dashboard/dashboards/admin/flavors/extras/tables.py @@ -16,8 +16,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables diff --git a/openstack_dashboard/dashboards/admin/flavors/extras/tests.py b/openstack_dashboard/dashboards/admin/flavors/extras/tests.py index 946645a03e..10c91a198f 100644 --- a/openstack_dashboard/dashboards/admin/flavors/extras/tests.py +++ b/openstack_dashboard/dashboards/admin/flavors/extras/tests.py @@ -1,7 +1,7 @@ -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/flavors/extras/urls.py b/openstack_dashboard/dashboards/admin/flavors/extras/urls.py index 17812a8b1b..8fc76c06f6 100644 --- a/openstack_dashboard/dashboards/admin/flavors/extras/urls.py +++ b/openstack_dashboard/dashboards/admin/flavors/extras/urls.py @@ -18,16 +18,13 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.flavors.extras.views \ - import CreateView -from openstack_dashboard.dashboards.admin.flavors.extras.views import EditView -from openstack_dashboard.dashboards.admin.flavors.extras.views import IndexView +from openstack_dashboard.dashboards.admin.flavors.extras import views urlpatterns = patterns('', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^create/$', CreateView.as_view(), name='create'), - url(r'^(?P[^/]+)/edit/$', EditView.as_view(), name='edit') + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^create/$', views.CreateView.as_view(), name='create'), + url(r'^(?P[^/]+)/edit/$', views.EditView.as_view(), name='edit') ) diff --git a/openstack_dashboard/dashboards/admin/flavors/extras/views.py b/openstack_dashboard/dashboards/admin/flavors/extras/views.py index 9255ee45be..ecbd78a23b 100644 --- a/openstack_dashboard/dashboards/admin/flavors/extras/views.py +++ b/openstack_dashboard/dashboards/admin/flavors/extras/views.py @@ -20,7 +20,7 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -28,12 +28,10 @@ from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.flavors.extras.forms \ - import CreateExtraSpec -from openstack_dashboard.dashboards.admin.flavors.extras.forms \ - import EditExtraSpec -from openstack_dashboard.dashboards.admin.flavors.extras.tables \ - import ExtraSpecsTable +from openstack_dashboard.dashboards.admin.flavors.extras \ + import forms as project_forms +from openstack_dashboard.dashboards.admin.flavors.extras \ + import tables as project_tables LOG = logging.getLogger(__name__) @@ -52,7 +50,7 @@ class ExtraSpecMixin(object): class IndexView(ExtraSpecMixin, forms.ModalFormMixin, tables.DataTableView): - table_class = ExtraSpecsTable + table_class = project_tables.ExtraSpecsTable template_name = 'admin/flavors/extras/index.html' def get_data(self): @@ -68,7 +66,7 @@ class IndexView(ExtraSpecMixin, forms.ModalFormMixin, tables.DataTableView): class CreateView(ExtraSpecMixin, forms.ModalFormView): - form_class = CreateExtraSpec + form_class = project_forms.CreateExtraSpec template_name = 'admin/flavors/extras/create.html' def get_initial(self): @@ -79,7 +77,7 @@ class CreateView(ExtraSpecMixin, forms.ModalFormView): class EditView(ExtraSpecMixin, forms.ModalFormView): - form_class = EditExtraSpec + form_class = project_forms.EditExtraSpec template_name = 'admin/flavors/extras/edit.html' def get_initial(self): diff --git a/openstack_dashboard/dashboards/admin/flavors/forms.py b/openstack_dashboard/dashboards/admin/flavors/forms.py index 6ea4218817..9a08df8ea2 100644 --- a/openstack_dashboard/dashboards/admin/flavors/forms.py +++ b/openstack_dashboard/dashboards/admin/flavors/forms.py @@ -20,7 +20,7 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/admin/flavors/panel.py b/openstack_dashboard/dashboards/admin/flavors/panel.py index 2f769b0299..1e14b09b3d 100644 --- a/openstack_dashboard/dashboards/admin/flavors/panel.py +++ b/openstack_dashboard/dashboards/admin/flavors/panel.py @@ -18,7 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/admin/flavors/tables.py b/openstack_dashboard/dashboards/admin/flavors/tables.py index d5428c7346..d167b9a3bc 100644 --- a/openstack_dashboard/dashboards/admin/flavors/tables.py +++ b/openstack_dashboard/dashboards/admin/flavors/tables.py @@ -1,6 +1,6 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables diff --git a/openstack_dashboard/dashboards/admin/flavors/tests.py b/openstack_dashboard/dashboards/admin/flavors/tests.py index 82c33e3d50..9dbfc6139d 100644 --- a/openstack_dashboard/dashboards/admin/flavors/tests.py +++ b/openstack_dashboard/dashboards/admin/flavors/tests.py @@ -1,6 +1,6 @@ -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/flavors/urls.py b/openstack_dashboard/dashboards/admin/flavors/urls.py index 7ef8c91f62..8c4318610e 100644 --- a/openstack_dashboard/dashboards/admin/flavors/urls.py +++ b/openstack_dashboard/dashboards/admin/flavors/urls.py @@ -18,19 +18,17 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import include -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import include # noqa +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa from openstack_dashboard.dashboards.admin.flavors.extras \ import urls as extras_urls -from openstack_dashboard.dashboards.admin.flavors.views import CreateView -from openstack_dashboard.dashboards.admin.flavors.views import EditView -from openstack_dashboard.dashboards.admin.flavors.views import IndexView +from openstack_dashboard.dashboards.admin.flavors import views urlpatterns = patterns('openstack_dashboard.dashboards.admin.flavors.views', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^create/$', CreateView.as_view(), name='create'), - url(r'^(?P[^/]+)/edit/$', EditView.as_view(), name='edit'), + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^create/$', views.CreateView.as_view(), name='create'), + url(r'^(?P[^/]+)/edit/$', views.EditView.as_view(), name='edit'), url(r'^(?P[^/]+)/extras/', include(extras_urls, namespace='extras')), ) diff --git a/openstack_dashboard/dashboards/admin/flavors/views.py b/openstack_dashboard/dashboards/admin/flavors/views.py index 968d71d39d..118f4c1425 100644 --- a/openstack_dashboard/dashboards/admin/flavors/views.py +++ b/openstack_dashboard/dashboards/admin/flavors/views.py @@ -20,8 +20,8 @@ import logging -from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -29,16 +29,17 @@ from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.flavors.forms import CreateFlavor -from openstack_dashboard.dashboards.admin.flavors.forms import EditFlavor -from openstack_dashboard.dashboards.admin.flavors.tables import FlavorsTable +from openstack_dashboard.dashboards.admin.flavors \ + import forms as project_forms +from openstack_dashboard.dashboards.admin.flavors \ + import tables as project_tables LOG = logging.getLogger(__name__) class IndexView(tables.DataTableView): - table_class = FlavorsTable + table_class = project_tables.FlavorsTable template_name = 'admin/flavors/index.html' def get_data(self): @@ -55,13 +56,13 @@ class IndexView(tables.DataTableView): class CreateView(forms.ModalFormView): - form_class = CreateFlavor + form_class = project_forms.CreateFlavor template_name = 'admin/flavors/create.html' success_url = reverse_lazy('horizon:admin:flavors:index') class EditView(forms.ModalFormView): - form_class = EditFlavor + form_class = project_forms.EditFlavor template_name = 'admin/flavors/edit.html' success_url = reverse_lazy('horizon:admin:flavors:index') diff --git a/openstack_dashboard/dashboards/admin/groups/forms.py b/openstack_dashboard/dashboards/admin/groups/forms.py index bbc36d9214..19b58641cb 100644 --- a/openstack_dashboard/dashboards/admin/groups/forms.py +++ b/openstack_dashboard/dashboards/admin/groups/forms.py @@ -16,7 +16,7 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/admin/groups/panel.py b/openstack_dashboard/dashboards/admin/groups/panel.py index 92452a6de1..0f1ce6e296 100644 --- a/openstack_dashboard/dashboards/admin/groups/panel.py +++ b/openstack_dashboard/dashboards/admin/groups/panel.py @@ -14,11 +14,11 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon -from openstack_dashboard.api.keystone import VERSIONS as IDENTITY_VERSIONS +from openstack_dashboard.api.keystone import VERSIONS as IDENTITY_VERSIONS # noqa from openstack_dashboard.dashboards.admin import dashboard diff --git a/openstack_dashboard/dashboards/admin/groups/tables.py b/openstack_dashboard/dashboards/admin/groups/tables.py index 9d2a14178c..46ded8ffb4 100644 --- a/openstack_dashboard/dashboards/admin/groups/tables.py +++ b/openstack_dashboard/dashboards/admin/groups/tables.py @@ -16,22 +16,15 @@ import logging -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django.template import defaultfilters -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_ADD_MEMBER_URL -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_CREATE_URL -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_MANAGE_URL -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_UPDATE_URL +from openstack_dashboard.dashboards.admin.groups import constants LOG = logging.getLogger(__name__) @@ -45,7 +38,7 @@ STATUS_CHOICES = ( class CreateGroupLink(tables.LinkAction): name = "create" verbose_name = _("Create Group") - url = GROUPS_CREATE_URL + url = constants.GROUPS_CREATE_URL classes = ("ajax-modal", "btn-create") def allowed(self, request, group): @@ -55,7 +48,7 @@ class CreateGroupLink(tables.LinkAction): class EditGroupLink(tables.LinkAction): name = "edit" verbose_name = _("Edit Group") - url = GROUPS_UPDATE_URL + url = constants.GROUPS_UPDATE_URL classes = ("ajax-modal", "btn-edit") def allowed(self, request, group): @@ -78,7 +71,7 @@ class DeleteGroupsAction(tables.DeleteAction): class ManageUsersLink(tables.LinkAction): name = "users" verbose_name = _("Modify Users") - url = GROUPS_MANAGE_URL + url = constants.GROUPS_MANAGE_URL classes = ("btn-edit") def allowed(self, request, datum): @@ -148,7 +141,7 @@ class AddMembersLink(tables.LinkAction): name = "add_user_link" verbose_name = _("Add...") classes = ("ajax-modal", "btn-create") - url = GROUPS_ADD_MEMBER_URL + url = constants.GROUPS_ADD_MEMBER_URL def allowed(self, request, user=None): return api.keystone.keystone_can_edit_group() @@ -183,7 +176,7 @@ class AddMembers(tables.BatchAction): data_type_plural = _("Users") classes = ("btn-create", ) requires_input = True - success_url = GROUPS_MANAGE_URL + success_url = constants.GROUPS_MANAGE_URL def allowed(self, request, user=None): return api.keystone.keystone_can_edit_group() diff --git a/openstack_dashboard/dashboards/admin/groups/tests.py b/openstack_dashboard/dashboards/admin/groups/tests.py index a0b36e5b71..f53ffaccdd 100644 --- a/openstack_dashboard/dashboards/admin/groups/tests.py +++ b/openstack_dashboard/dashboards/admin/groups/tests.py @@ -14,36 +14,23 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IgnoreArg -from mox import IsA +from mox import IgnoreArg # noqa +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_ADD_MEMBER_URL as add_member_url -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_CREATE_URL as create_url -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_INDEX_URL as index_url -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_INDEX_VIEW_TEMPLATE -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_MANAGE_URL as manage_url -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_MANAGE_VIEW_TEMPLATE -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_UPDATE_URL as update_url +from openstack_dashboard.dashboards.admin.groups import constants -GROUPS_INDEX_URL = reverse(index_url) -GROUP_CREATE_URL = reverse(create_url) -GROUP_UPDATE_URL = reverse(update_url, args=[1]) -GROUP_MANAGE_URL = reverse(manage_url, args=[1]) -GROUP_ADD_MEMBER_URL = reverse(add_member_url, args=[1]) +GROUPS_INDEX_URL = reverse(constants.GROUPS_INDEX_URL) +GROUP_CREATE_URL = reverse(constants.GROUPS_CREATE_URL) +GROUP_UPDATE_URL = reverse(constants.GROUPS_UPDATE_URL, args=[1]) +GROUP_MANAGE_URL = reverse(constants.GROUPS_MANAGE_URL, args=[1]) +GROUP_ADD_MEMBER_URL = reverse(constants.GROUPS_ADD_MEMBER_URL, args=[1]) class GroupsViewTests(test.BaseAdminViewTests): @@ -70,7 +57,7 @@ class GroupsViewTests(test.BaseAdminViewTests): res = self.client.get(GROUPS_INDEX_URL) - self.assertTemplateUsed(res, GROUPS_INDEX_VIEW_TEMPLATE) + self.assertTemplateUsed(res, constants.GROUPS_INDEX_VIEW_TEMPLATE) self.assertItemsEqual(res.context['table'].data, groups) if domain_id: for group in res.context['table'].data: @@ -101,7 +88,7 @@ class GroupsViewTests(test.BaseAdminViewTests): res = self.client.get(GROUPS_INDEX_URL) - self.assertTemplateUsed(res, GROUPS_INDEX_VIEW_TEMPLATE) + self.assertTemplateUsed(res, constants.GROUPS_INDEX_VIEW_TEMPLATE) self.assertItemsEqual(res.context['table'].data, groups) self.assertNotContains(res, 'Create Group') @@ -189,7 +176,7 @@ class GroupsViewTests(test.BaseAdminViewTests): res = self.client.get(GROUP_MANAGE_URL) - self.assertTemplateUsed(res, GROUPS_MANAGE_VIEW_TEMPLATE) + self.assertTemplateUsed(res, constants.GROUPS_MANAGE_VIEW_TEMPLATE) self.assertItemsEqual(res.context['table'].data, group_members) @test.create_stubs({api.keystone: ('user_list', diff --git a/openstack_dashboard/dashboards/admin/groups/urls.py b/openstack_dashboard/dashboards/admin/groups/urls.py index 56b7e4f4ca..9557f0362f 100644 --- a/openstack_dashboard/dashboards/admin/groups/urls.py +++ b/openstack_dashboard/dashboards/admin/groups/urls.py @@ -14,23 +14,19 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.groups.views import CreateView -from openstack_dashboard.dashboards.admin.groups.views import IndexView -from openstack_dashboard.dashboards.admin.groups.views import ManageMembersView -from openstack_dashboard.dashboards.admin.groups.views import NonMembersView -from openstack_dashboard.dashboards.admin.groups.views import UpdateView +from openstack_dashboard.dashboards.admin.groups import views urlpatterns = patterns('', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^create$', CreateView.as_view(), name='create'), + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^create$', views.CreateView.as_view(), name='create'), url(r'^(?P[^/]+)/update/$', - UpdateView.as_view(), name='update'), + views.UpdateView.as_view(), name='update'), url(r'^(?P[^/]+)/manage_members/$', - ManageMembersView.as_view(), name='manage_members'), + views.ManageMembersView.as_view(), name='manage_members'), url(r'^(?P[^/]+)/add_members/$', - NonMembersView.as_view(), name='add_members'), + views.NonMembersView.as_view(), name='add_members'), ) diff --git a/openstack_dashboard/dashboards/admin/groups/views.py b/openstack_dashboard/dashboards/admin/groups/views.py index d6b5a029f1..dc821753cf 100644 --- a/openstack_dashboard/dashboards/admin/groups/views.py +++ b/openstack_dashboard/dashboards/admin/groups/views.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -24,32 +24,16 @@ from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_ADD_MEMBER_AJAX_VIEW_TEMPLATE -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_ADD_MEMBER_VIEW_TEMPLATE -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_CREATE_VIEW_TEMPLATE -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_INDEX_URL -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_INDEX_VIEW_TEMPLATE -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_MANAGE_VIEW_TEMPLATE -from openstack_dashboard.dashboards.admin.groups.constants \ - import GROUPS_UPDATE_VIEW_TEMPLATE -from openstack_dashboard.dashboards.admin.groups.forms import CreateGroupForm -from openstack_dashboard.dashboards.admin.groups.forms import UpdateGroupForm -from openstack_dashboard.dashboards.admin.groups.tables \ - import GroupMembersTable -from openstack_dashboard.dashboards.admin.groups.tables \ - import GroupNonMembersTable -from openstack_dashboard.dashboards.admin.groups.tables import GroupsTable +from openstack_dashboard.dashboards.admin.groups import constants +from openstack_dashboard.dashboards.admin.groups \ + import forms as project_forms +from openstack_dashboard.dashboards.admin.groups \ + import tables as project_tables class IndexView(tables.DataTableView): - table_class = GroupsTable - template_name = GROUPS_INDEX_VIEW_TEMPLATE + table_class = project_tables.GroupsTable + template_name = constants.GROUPS_INDEX_VIEW_TEMPLATE def get_data(self): groups = [] @@ -64,15 +48,15 @@ class IndexView(tables.DataTableView): class CreateView(forms.ModalFormView): - form_class = CreateGroupForm - template_name = GROUPS_CREATE_VIEW_TEMPLATE - success_url = reverse_lazy(GROUPS_INDEX_URL) + form_class = project_forms.CreateGroupForm + template_name = constants.GROUPS_CREATE_VIEW_TEMPLATE + success_url = reverse_lazy(constants.GROUPS_INDEX_URL) class UpdateView(forms.ModalFormView): - form_class = UpdateGroupForm - template_name = GROUPS_UPDATE_VIEW_TEMPLATE - success_url = reverse_lazy(GROUPS_INDEX_URL) + form_class = project_forms.UpdateGroupForm + template_name = constants.GROUPS_UPDATE_VIEW_TEMPLATE + success_url = reverse_lazy(constants.GROUPS_INDEX_URL) def get_object(self): if not hasattr(self, "_object"): @@ -80,7 +64,7 @@ class UpdateView(forms.ModalFormView): self._object = api.keystone.group_get(self.request, self.kwargs['group_id']) except Exception: - redirect = reverse(GROUPS_INDEX_URL) + redirect = reverse(constants.GROUPS_INDEX_URL) exceptions.handle(self.request, _('Unable to update group.'), redirect=redirect) @@ -125,8 +109,8 @@ class GroupManageMixin(object): class ManageMembersView(GroupManageMixin, tables.DataTableView): - table_class = GroupMembersTable - template_name = GROUPS_MANAGE_VIEW_TEMPLATE + table_class = project_tables.GroupMembersTable + template_name = constants.GROUPS_MANAGE_VIEW_TEMPLATE def get_context_data(self, **kwargs): context = super(ManageMembersView, self).get_context_data(**kwargs) @@ -145,9 +129,9 @@ class ManageMembersView(GroupManageMixin, tables.DataTableView): class NonMembersView(GroupManageMixin, forms.ModalFormMixin, tables.DataTableView): - template_name = GROUPS_ADD_MEMBER_VIEW_TEMPLATE - ajax_template_name = GROUPS_ADD_MEMBER_AJAX_VIEW_TEMPLATE - table_class = GroupNonMembersTable + template_name = constants.GROUPS_ADD_MEMBER_VIEW_TEMPLATE + ajax_template_name = constants.GROUPS_ADD_MEMBER_AJAX_VIEW_TEMPLATE + table_class = project_tables.GroupNonMembersTable def get_context_data(self, **kwargs): context = super(NonMembersView, self).get_context_data(**kwargs) diff --git a/openstack_dashboard/dashboards/admin/hypervisors/panel.py b/openstack_dashboard/dashboards/admin/hypervisors/panel.py index 156702ef6f..aa6cae5e2e 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/panel.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/panel.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon from openstack_dashboard.dashboards.admin import dashboard diff --git a/openstack_dashboard/dashboards/admin/hypervisors/tables.py b/openstack_dashboard/dashboards/admin/hypervisors/tables.py index c72712c9cc..062d5f40f5 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/tables.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/tables.py @@ -16,7 +16,7 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables from horizon.templatetags import sizeformat diff --git a/openstack_dashboard/dashboards/admin/hypervisors/tests.py b/openstack_dashboard/dashboards/admin/hypervisors/tests.py index f3fbfd5811..428b7b1381 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/tests.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/tests.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/hypervisors/urls.py b/openstack_dashboard/dashboards/admin/hypervisors/urls.py index a47c123fda..f1ef98cc37 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/urls.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/urls.py @@ -14,14 +14,13 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.hypervisors.views \ - import AdminIndexView +from openstack_dashboard.dashboards.admin.hypervisors import views urlpatterns = patterns( 'openstack_dashboard.dashboards.admin.hypervisors.views', - url(r'^$', AdminIndexView.as_view(), name='index') + url(r'^$', views.AdminIndexView.as_view(), name='index') ) diff --git a/openstack_dashboard/dashboards/admin/hypervisors/views.py b/openstack_dashboard/dashboards/admin/hypervisors/views.py index d58f09651b..c4c0bb15f8 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/views.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/views.py @@ -16,19 +16,19 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.hypervisors.tables import \ - AdminHypervisorsTable +from openstack_dashboard.dashboards.admin.hypervisors \ + import tables as project_tables LOG = logging.getLogger(__name__) class AdminIndexView(tables.DataTableView): - table_class = AdminHypervisorsTable + table_class = project_tables.AdminHypervisorsTable template_name = 'admin/hypervisors/index.html' def get_data(self): diff --git a/openstack_dashboard/dashboards/admin/images/panel.py b/openstack_dashboard/dashboards/admin/images/panel.py index aa8d354d6e..0ff71af67a 100644 --- a/openstack_dashboard/dashboards/admin/images/panel.py +++ b/openstack_dashboard/dashboards/admin/images/panel.py @@ -18,7 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/admin/images/tables.py b/openstack_dashboard/dashboards/admin/images/tables.py index 3ccd3314b4..ef4317b998 100644 --- a/openstack_dashboard/dashboards/admin/images/tables.py +++ b/openstack_dashboard/dashboards/admin/images/tables.py @@ -14,25 +14,19 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables -from openstack_dashboard.dashboards.project.images_and_snapshots \ - .images.tables import CreateImage -from openstack_dashboard.dashboards.project.images_and_snapshots \ - .images.tables import DeleteImage -from openstack_dashboard.dashboards.project.images_and_snapshots \ - .images.tables import EditImage -from openstack_dashboard.dashboards.project.images_and_snapshots \ - .images.tables import ImagesTable +from openstack_dashboard.dashboards.project.images_and_snapshots.images \ + import tables as project_tables -class AdminCreateImage(CreateImage): +class AdminCreateImage(project_tables.CreateImage): url = "horizon:admin:images:create" -class AdminDeleteImage(DeleteImage): +class AdminDeleteImage(project_tables.DeleteImage): def allowed(self, request, image=None): if image and image.protected: return False @@ -40,14 +34,14 @@ class AdminDeleteImage(DeleteImage): return True -class AdminEditImage(EditImage): +class AdminEditImage(project_tables.EditImage): url = "horizon:admin:images:update" def allowed(self, request, image=None): return True -class AdminImagesTable(ImagesTable): +class AdminImagesTable(project_tables.ImagesTable): name = tables.Column("name", link="horizon:admin:images:detail", verbose_name=_("Image Name")) diff --git a/openstack_dashboard/dashboards/admin/images/tests.py b/openstack_dashboard/dashboards/admin/images/tests.py index 07aa378dff..39f92c65cf 100644 --- a/openstack_dashboard/dashboards/admin/images/tests.py +++ b/openstack_dashboard/dashboards/admin/images/tests.py @@ -14,17 +14,17 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf import settings -from django.core.urlresolvers import reverse +from django.conf import settings # noqa +from django.core.urlresolvers import reverse # noqa from django import http -from django.test.utils import override_settings +from django.test.utils import override_settings # noqa -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test -from openstack_dashboard.dashboards.admin.images.tables import AdminImagesTable +from openstack_dashboard.dashboards.admin.images import tables class ImageCreateViewTest(test.BaseAdminViewTests): @@ -90,16 +90,16 @@ class ImagesViewTest(test.BaseAdminViewTests): settings.API_RESULT_PAGE_SIZE) url = "?".join([reverse('horizon:admin:images:index'), - "=".join([AdminImagesTable._meta.pagination_param, - images[2].id])]) + "=".join([tables.AdminImagesTable._meta.pagination_param, + images[2].id])]) res = self.client.get(url) # get second page (items 2-4) self.assertEqual(len(res.context['images_table'].data), settings.API_RESULT_PAGE_SIZE) url = "?".join([reverse('horizon:admin:images:index'), - "=".join([AdminImagesTable._meta.pagination_param, - images[4].id])]) + "=".join([tables.AdminImagesTable._meta.pagination_param, + images[4].id])]) res = self.client.get(url) # get third page (item 5) self.assertEqual(len(res.context['images_table'].data), diff --git a/openstack_dashboard/dashboards/admin/images/urls.py b/openstack_dashboard/dashboards/admin/images/urls.py index 8976629044..85a74c914b 100644 --- a/openstack_dashboard/dashboards/admin/images/urls.py +++ b/openstack_dashboard/dashboards/admin/images/urls.py @@ -18,18 +18,17 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.images.views import CreateView -from openstack_dashboard.dashboards.admin.images.views import DetailView -from openstack_dashboard.dashboards.admin.images.views import IndexView -from openstack_dashboard.dashboards.admin.images.views import UpdateView +from openstack_dashboard.dashboards.admin.images import views urlpatterns = patterns('openstack_dashboard.dashboards.admin.images.views', - url(r'^images/$', IndexView.as_view(), name='index'), - url(r'^create/$', CreateView.as_view(), name='create'), - url(r'^(?P[^/]+)/update/$', UpdateView.as_view(), name='update'), - url(r'^(?P[^/]+)/detail/$', DetailView.as_view(), name='detail') + url(r'^images/$', views.IndexView.as_view(), name='index'), + url(r'^create/$', views.CreateView.as_view(), name='create'), + url(r'^(?P[^/]+)/update/$', + views.UpdateView.as_view(), name='update'), + url(r'^(?P[^/]+)/detail/$', + views.DetailView.as_view(), name='detail') ) diff --git a/openstack_dashboard/dashboards/admin/images/views.py b/openstack_dashboard/dashboards/admin/images/views.py index c273d8de7b..0ccc9d9e4d 100644 --- a/openstack_dashboard/dashboards/admin/images/views.py +++ b/openstack_dashboard/dashboards/admin/images/views.py @@ -20,8 +20,8 @@ import logging -from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables @@ -30,19 +30,16 @@ from openstack_dashboard import api from openstack_dashboard.dashboards.project \ .images_and_snapshots.images import views -from openstack_dashboard.dashboards.admin.images.forms \ - import AdminCreateImageForm -from openstack_dashboard.dashboards.admin.images.forms \ - import AdminUpdateImageForm -from openstack_dashboard.dashboards.admin.images.tables \ - import AdminImagesTable +from openstack_dashboard.dashboards.admin.images import forms +from openstack_dashboard.dashboards.admin.images \ + import tables as project_tables LOG = logging.getLogger(__name__) class IndexView(tables.DataTableView): - table_class = AdminImagesTable + table_class = project_tables.AdminImagesTable template_name = 'admin/images/index.html' def has_more_data(self, table): @@ -50,8 +47,8 @@ class IndexView(tables.DataTableView): def get_data(self): images = [] - marker = self.request.GET.get(AdminImagesTable._meta.pagination_param, - None) + marker = self.request.GET.get( + project_tables.AdminImagesTable._meta.pagination_param, None) try: images, self._more = api.glance.image_list_detailed(self.request, marker=marker, @@ -65,13 +62,13 @@ class IndexView(tables.DataTableView): class CreateView(views.CreateView): template_name = 'admin/images/create.html' - form_class = AdminCreateImageForm + form_class = forms.AdminCreateImageForm success_url = reverse_lazy('horizon:admin:images:index') class UpdateView(views.UpdateView): template_name = 'admin/images/update.html' - form_class = AdminUpdateImageForm + form_class = forms.AdminUpdateImageForm success_url = reverse_lazy('horizon:admin:images:index') diff --git a/openstack_dashboard/dashboards/admin/info/panel.py b/openstack_dashboard/dashboards/admin/info/panel.py index 6c0508cccc..413903143c 100644 --- a/openstack_dashboard/dashboards/admin/info/panel.py +++ b/openstack_dashboard/dashboards/admin/info/panel.py @@ -18,7 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/admin/info/tables.py b/openstack_dashboard/dashboards/admin/info/tables.py index 7ab85a2cc4..0d64ea281f 100644 --- a/openstack_dashboard/dashboards/admin/info/tables.py +++ b/openstack_dashboard/dashboards/admin/info/tables.py @@ -2,10 +2,10 @@ import logging from django import template from django.template import defaultfilters as filters -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables -from horizon.utils.filters import parse_isotime +from horizon.utils.filters import parse_isotime # noqa LOG = logging.getLogger(__name__) diff --git a/openstack_dashboard/dashboards/admin/info/tabs.py b/openstack_dashboard/dashboards/admin/info/tabs.py index 39b93d76b4..fa3c0484a7 100644 --- a/openstack_dashboard/dashboards/admin/info/tabs.py +++ b/openstack_dashboard/dashboards/admin/info/tabs.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs @@ -24,15 +24,11 @@ from openstack_dashboard.api import keystone from openstack_dashboard.api import nova from openstack_dashboard.usage import quotas -from openstack_dashboard.dashboards.admin.info.tables import AggregatesTable -from openstack_dashboard.dashboards.admin.info.tables import NovaServicesTable -from openstack_dashboard.dashboards.admin.info.tables import QuotasTable -from openstack_dashboard.dashboards.admin.info.tables import ServicesTable -from openstack_dashboard.dashboards.admin.info.tables import ZonesTable +from openstack_dashboard.dashboards.admin.info import tables class DefaultQuotasTab(tabs.TableTab): - table_classes = (QuotasTable,) + table_classes = (tables.QuotasTable,) name = _("Default Quotas") slug = "quotas" template_name = ("horizon/common/_detail_table.html") @@ -55,7 +51,7 @@ class DefaultQuotasTab(tabs.TableTab): class ServicesTab(tabs.TableTab): - table_classes = (ServicesTable,) + table_classes = (tables.ServicesTable,) name = _("Services") slug = "services" template_name = ("horizon/common/_detail_table.html") @@ -71,7 +67,7 @@ class ServicesTab(tabs.TableTab): class ZonesTab(tabs.TableTab): - table_classes = (ZonesTable,) + table_classes = (tables.ZonesTable,) name = _("Availability Zones") slug = "zones" template_name = ("horizon/common/_detail_table.html") @@ -88,7 +84,7 @@ class ZonesTab(tabs.TableTab): class HostAggregatesTab(tabs.TableTab): - table_classes = (AggregatesTable,) + table_classes = (tables.AggregatesTable,) name = _("Host Aggregates") slug = "aggregates" template_name = ("horizon/common/_detail_table.html") @@ -104,7 +100,7 @@ class HostAggregatesTab(tabs.TableTab): class NovaServicesTab(tabs.TableTab): - table_classes = (NovaServicesTable,) + table_classes = (tables.NovaServicesTable,) name = _("Compute Services") slug = "nova_services" template_name = ("horizon/common/_detail_table.html") diff --git a/openstack_dashboard/dashboards/admin/info/tests.py b/openstack_dashboard/dashboards/admin/info/tests.py index 39deea1712..b4fb79a10d 100644 --- a/openstack_dashboard/dashboards/admin/info/tests.py +++ b/openstack_dashboard/dashboards/admin/info/tests.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/info/urls.py b/openstack_dashboard/dashboards/admin/info/urls.py index 8509abdb46..aefbdb80d9 100644 --- a/openstack_dashboard/dashboards/admin/info/urls.py +++ b/openstack_dashboard/dashboards/admin/info/urls.py @@ -18,11 +18,11 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.info.views import IndexView +from openstack_dashboard.dashboards.admin.info import views urlpatterns = patterns('openstack_dashboard.dashboards.admin.info.views', - url(r'^$', IndexView.as_view(), name='index')) + url(r'^$', views.IndexView.as_view(), name='index')) diff --git a/openstack_dashboard/dashboards/admin/info/views.py b/openstack_dashboard/dashboards/admin/info/views.py index 3dd1e2e7a5..58ec8ca6e0 100644 --- a/openstack_dashboard/dashboards/admin/info/views.py +++ b/openstack_dashboard/dashboards/admin/info/views.py @@ -22,12 +22,12 @@ import logging from horizon import tabs -from openstack_dashboard.dashboards.admin.info.tabs import SystemInfoTabs +from openstack_dashboard.dashboards.admin.info import tabs as project_tabs LOG = logging.getLogger(__name__) class IndexView(tabs.TabbedTableView): - tab_group_class = SystemInfoTabs + tab_group_class = project_tabs.SystemInfoTabs template_name = 'admin/info/index.html' diff --git a/openstack_dashboard/dashboards/admin/instances/panel.py b/openstack_dashboard/dashboards/admin/instances/panel.py index 3e4fd51103..9e43252132 100644 --- a/openstack_dashboard/dashboards/admin/instances/panel.py +++ b/openstack_dashboard/dashboards/admin/instances/panel.py @@ -18,7 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/admin/instances/tables.py b/openstack_dashboard/dashboards/admin/instances/tables.py index 265a952970..ced016a1b8 100644 --- a/openstack_dashboard/dashboards/admin/instances/tables.py +++ b/openstack_dashboard/dashboards/admin/instances/tables.py @@ -17,57 +17,58 @@ import logging -from django.template.defaultfilters import timesince -from django.template.defaultfilters import title -from django.utils.translation import ugettext_lazy as _ +from django.template.defaultfilters import timesince # noqa +from django.template.defaultfilters import title # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables -from horizon.utils.filters import parse_isotime -from horizon.utils.filters import replace_underscores +from horizon.utils.filters import parse_isotime # noqa +from horizon.utils.filters import replace_underscores # noqa from openstack_dashboard import api -from openstack_dashboard.dashboards.project.instances.tables import \ - ACTIVE_STATES -from openstack_dashboard.dashboards.project.instances.tables import \ - ConfirmResize -from openstack_dashboard.dashboards.project.instances.tables import \ - ConsoleLink -from openstack_dashboard.dashboards.project.instances.tables import \ - CreateSnapshot -from openstack_dashboard.dashboards.project.instances.tables import \ - EditInstance -from openstack_dashboard.dashboards.project.instances.tables import \ - get_ips -from openstack_dashboard.dashboards.project.instances.tables import \ - get_power_state -from openstack_dashboard.dashboards.project.instances.tables import \ - get_size -from openstack_dashboard.dashboards.project.instances.tables import \ - is_deleting -from openstack_dashboard.dashboards.project.instances.tables import \ - LogLink -from openstack_dashboard.dashboards.project.instances.tables import \ - RebootInstance -from openstack_dashboard.dashboards.project.instances.tables import \ - RevertResize -from openstack_dashboard.dashboards.project.instances.tables import \ - SoftRebootInstance -from openstack_dashboard.dashboards.project.instances.tables import \ - STATUS_DISPLAY_CHOICES -from openstack_dashboard.dashboards.project.instances.tables import \ - TASK_DISPLAY_CHOICES -from openstack_dashboard.dashboards.project.instances.tables import \ - TerminateInstance -from openstack_dashboard.dashboards.project.instances.tables import \ - TogglePause -from openstack_dashboard.dashboards.project.instances.tables import \ - ToggleSuspend -from openstack_dashboard.dashboards.project.instances.tables import \ - UpdateRow +from openstack_dashboard.dashboards.project.instances \ + import tables as project_tables +# ACTIVE_STATES +#from openstack_dashboard.dashboards.project.instances.tables import \ +# ConfirmResize +#from openstack_dashboard.dashboards.project.instances.tables import \ +# ConsoleLink +#from openstack_dashboard.dashboards.project.instances.tables import \ +# CreateSnapshot +#from openstack_dashboard.dashboards.project.instances.tables import \ +# EditInstance +#from openstack_dashboard.dashboards.project.instances.tables import \ +# get_ips +#from openstack_dashboard.dashboards.project.instances.tables import \ +# get_power_state +#from openstack_dashboard.dashboards.project.instances.tables import \ +# get_size +#from openstack_dashboard.dashboards.project.instances.tables import \ +# is_deleting +#from openstack_dashboard.dashboards.project.instances.tables import \ +# LogLink +#from openstack_dashboard.dashboards.project.instances.tables import \ +# RebootInstance +#from openstack_dashboard.dashboards.project.instances.tables import \ +# RevertResize +#from openstack_dashboard.dashboards.project.instances.tables import \ +# SoftRebootInstance +#from openstack_dashboard.dashboards.project.instances.tables import \ +# STATUS_DISPLAY_CHOICES +#from openstack_dashboard.dashboards.project.instances.tables import \ +# TASK_DISPLAY_CHOICES +#from openstack_dashboard.dashboards.project.instances.tables import \ +# TerminateInstance +#from openstack_dashboard.dashboards.project.instances.tables import \ +# TogglePause +#from openstack_dashboard.dashboards.project.instances.tables import \ +# ToggleSuspend +#from openstack_dashboard.dashboards.project.instances.tables import \ +# UpdateRow LOG = logging.getLogger(__name__) -class AdminEditInstance(EditInstance): +class AdminEditInstance(project_tables.EditInstance): url = "horizon:admin:instances:update" @@ -80,15 +81,15 @@ class MigrateInstance(tables.BatchAction): classes = ("btn-migrate", "btn-danger") def allowed(self, request, instance): - return ((instance.status in ACTIVE_STATES + return ((instance.status in project_tables.ACTIVE_STATES or instance.status == 'SHUTOFF') - and not is_deleting(instance)) + and not project_tables.is_deleting(instance)) def action(self, request, obj_id): api.nova.server_migrate(request, obj_id) -class AdminUpdateRow(UpdateRow): +class AdminUpdateRow(project_tables.UpdateRow): def get_data(self, request, instance_id): instance = super(AdminUpdateRow, self).get_data(request, instance_id) tenant = api.keystone.tenant_get(request, @@ -132,10 +133,10 @@ class AdminInstancesTable(tables.DataTable): verbose_name=_("Name")) image_name = tables.Column("image_name", verbose_name=_("Image Name")) - ip = tables.Column(get_ips, + ip = tables.Column(project_tables.get_ips, verbose_name=_("IP Address"), attrs={'data-type': "ip"}) - size = tables.Column(get_size, + size = tables.Column(project_tables.get_size, verbose_name=_("Size"), classes=('nowrap-col',), attrs={'data-type': 'size'}) @@ -144,14 +145,15 @@ class AdminInstancesTable(tables.DataTable): verbose_name=_("Status"), status=True, status_choices=STATUS_CHOICES, - display_choices=STATUS_DISPLAY_CHOICES) + display_choices= + project_tables.STATUS_DISPLAY_CHOICES) task = tables.Column("OS-EXT-STS:task_state", verbose_name=_("Task"), filters=(title, replace_underscores), status=True, status_choices=TASK_STATUS_CHOICES, - display_choices=TASK_DISPLAY_CHOICES) - state = tables.Column(get_power_state, + display_choices=project_tables.TASK_DISPLAY_CHOICES) + state = tables.Column(project_tables.get_power_state, filters=(title, replace_underscores), verbose_name=_("Power State")) created = tables.Column("created", @@ -162,9 +164,18 @@ class AdminInstancesTable(tables.DataTable): name = "instances" verbose_name = _("Instances") status_columns = ["status", "task"] - table_actions = (TerminateInstance, AdminInstanceFilterAction) + table_actions = (project_tables.TerminateInstance, + AdminInstanceFilterAction) row_class = AdminUpdateRow - row_actions = (ConfirmResize, RevertResize, AdminEditInstance, - ConsoleLink, LogLink, CreateSnapshot, TogglePause, - ToggleSuspend, MigrateInstance, SoftRebootInstance, - RebootInstance, TerminateInstance) + row_actions = (project_tables.ConfirmResize, + project_tables.RevertResize, + AdminEditInstance, + project_tables.ConsoleLink, + project_tables.LogLink, + project_tables.CreateSnapshot, + project_tables.TogglePause, + project_tables.ToggleSuspend, + MigrateInstance, + project_tables.SoftRebootInstance, + project_tables.RebootInstance, + project_tables.TerminateInstance) diff --git a/openstack_dashboard/dashboards/admin/instances/tests.py b/openstack_dashboard/dashboards/admin/instances/tests.py index be2373fabd..74fc85d611 100644 --- a/openstack_dashboard/dashboards/admin/instances/tests.py +++ b/openstack_dashboard/dashboards/admin/instances/tests.py @@ -16,11 +16,11 @@ import uuid -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from django.utils.datastructures import SortedDict +from django.utils.datastructures import SortedDict # noqa -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/instances/urls.py b/openstack_dashboard/dashboards/admin/instances/urls.py index 58f4816cf5..b12ed911e8 100644 --- a/openstack_dashboard/dashboards/admin/instances/urls.py +++ b/openstack_dashboard/dashboards/admin/instances/urls.py @@ -18,23 +18,22 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.instances.views import AdminIndexView -from openstack_dashboard.dashboards.admin.instances.views \ - import AdminUpdateView -from openstack_dashboard.dashboards.project.instances.views \ - import DetailView +from openstack_dashboard.dashboards.admin.instances import views +from openstack_dashboard.dashboards.project.instances \ + import views as project_views INSTANCES = r'^(?P[^/]+)/%s$' urlpatterns = patterns('openstack_dashboard.dashboards.admin.instances.views', - url(r'^$', AdminIndexView.as_view(), name='index'), - url(INSTANCES % 'update', AdminUpdateView.as_view(), name='update'), - url(INSTANCES % 'detail', DetailView.as_view(), name='detail'), + url(r'^$', views.AdminIndexView.as_view(), name='index'), + url(INSTANCES % 'update', views.AdminUpdateView.as_view(), name='update'), + url(INSTANCES % 'detail', + project_views.DetailView.as_view(), name='detail'), url(INSTANCES % 'console', 'console', name='console'), url(INSTANCES % 'vnc', 'vnc', name='vnc'), url(INSTANCES % 'spice', 'spice', name='spice'), diff --git a/openstack_dashboard/dashboards/admin/instances/views.py b/openstack_dashboard/dashboards/admin/instances/views.py index 03c0e73ca6..3bec0ce48c 100644 --- a/openstack_dashboard/dashboards/admin/instances/views.py +++ b/openstack_dashboard/dashboards/admin/instances/views.py @@ -21,50 +21,43 @@ import logging -from django.utils.datastructures import SortedDict -from django.utils.translation import ugettext_lazy as _ +from django.utils.datastructures import SortedDict # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.instances.tables import \ - AdminInstancesTable -from openstack_dashboard.dashboards.project.instances.views import \ - console as p_console -from openstack_dashboard.dashboards.project.instances.views import \ - spice as p_spice -from openstack_dashboard.dashboards.project.instances.views import \ - UpdateView -from openstack_dashboard.dashboards.project.instances.views import \ - vnc as p_vnc -from openstack_dashboard.dashboards.project.instances.workflows.\ - update_instance import AdminUpdateInstance +from openstack_dashboard.dashboards.admin.instances \ + import tables as project_tables +from openstack_dashboard.dashboards.project.instances import views +from openstack_dashboard.dashboards.project.instances.workflows \ + import update_instance LOG = logging.getLogger(__name__) # re-use console from project.instances.views to make reflection work def console(args, **kvargs): - return p_console(args, **kvargs) + return views.console(args, **kvargs) # re-use vnc from project.instances.views to make reflection work def vnc(args, **kvargs): - return p_vnc(args, **kvargs) + return views.vnc(args, **kvargs) # re-use spice from project.instances.views to make reflection work def spice(args, **kvargs): - return p_spice(args, **kvargs) + return views.spice(args, **kvargs) -class AdminUpdateView(UpdateView): - workflow_class = AdminUpdateInstance +class AdminUpdateView(views.UpdateView): + workflow_class = update_instance.AdminUpdateInstance class AdminIndexView(tables.DataTableView): - table_class = AdminInstancesTable + table_class = project_tables.AdminInstancesTable template_name = 'admin/instances/index.html' def has_more_data(self, table): @@ -73,7 +66,7 @@ class AdminIndexView(tables.DataTableView): def get_data(self): instances = [] marker = self.request.GET.get( - AdminInstancesTable._meta.pagination_param, None) + project_tables.AdminInstancesTable._meta.pagination_param, None) try: instances, self._more = api.nova.server_list( self.request, diff --git a/openstack_dashboard/dashboards/admin/networks/forms.py b/openstack_dashboard/dashboards/admin/networks/forms.py index e1d5321a07..3bd06724ed 100644 --- a/openstack_dashboard/dashboards/admin/networks/forms.py +++ b/openstack_dashboard/dashboards/admin/networks/forms.py @@ -16,8 +16,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/admin/networks/panel.py b/openstack_dashboard/dashboards/admin/networks/panel.py index 22774c6c69..de8aff8dbf 100644 --- a/openstack_dashboard/dashboards/admin/networks/panel.py +++ b/openstack_dashboard/dashboards/admin/networks/panel.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/admin/networks/ports/forms.py b/openstack_dashboard/dashboards/admin/networks/ports/forms.py index 1b0f32d39e..5944be9dc0 100644 --- a/openstack_dashboard/dashboards/admin/networks/ports/forms.py +++ b/openstack_dashboard/dashboards/admin/networks/ports/forms.py @@ -16,8 +16,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/admin/networks/ports/tables.py b/openstack_dashboard/dashboards/admin/networks/ports/tables.py index 2ed8f658ae..6e47302efd 100644 --- a/openstack_dashboard/dashboards/admin/networks/ports/tables.py +++ b/openstack_dashboard/dashboards/admin/networks/ports/tables.py @@ -16,17 +16,15 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.project.networks.ports.tables import \ - get_attached -from openstack_dashboard.dashboards.project.networks.ports.tables import \ - get_fixed_ips +from openstack_dashboard.dashboards.project.networks.ports import \ + tables as project_tables LOG = logging.getLogger(__name__) @@ -74,8 +72,10 @@ class PortsTable(tables.DataTable): name = tables.Column("name", verbose_name=_("Name"), link="horizon:admin:networks:ports:detail") - fixed_ips = tables.Column(get_fixed_ips, verbose_name=_("Fixed IPs")) - device_id = tables.Column(get_attached, verbose_name=_("Device Attached")) + fixed_ips = tables.Column( + project_tables.get_fixed_ips, verbose_name=_("Fixed IPs")) + device_id = tables.Column( + project_tables.get_attached, verbose_name=_("Device Attached")) status = tables.Column("status", verbose_name=_("Status")) admin_state = tables.Column("admin_state", verbose_name=_("Admin State")) diff --git a/openstack_dashboard/dashboards/admin/networks/ports/tabs.py b/openstack_dashboard/dashboards/admin/networks/ports/tabs.py index 297d3574d7..b0f187cdf3 100644 --- a/openstack_dashboard/dashboards/admin/networks/ports/tabs.py +++ b/openstack_dashboard/dashboards/admin/networks/ports/tabs.py @@ -16,8 +16,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs diff --git a/openstack_dashboard/dashboards/admin/networks/ports/urls.py b/openstack_dashboard/dashboards/admin/networks/ports/urls.py index c91ea6b964..54fd08af53 100644 --- a/openstack_dashboard/dashboards/admin/networks/ports/urls.py +++ b/openstack_dashboard/dashboards/admin/networks/ports/urls.py @@ -14,16 +14,15 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.networks.ports.views import \ - DetailView +from openstack_dashboard.dashboards.project.networks.ports import views PORTS = r'^(?P[^/]+)/%s$' VIEW_MOD = 'openstack_dashboard.dashboards.admin.networks.ports.views' urlpatterns = patterns(VIEW_MOD, - url(PORTS % 'detail', DetailView.as_view(), name='detail') + url(PORTS % 'detail', views.DetailView.as_view(), name='detail') ) diff --git a/openstack_dashboard/dashboards/admin/networks/ports/views.py b/openstack_dashboard/dashboards/admin/networks/ports/views.py index 0db4a4a37d..846e9ca0f1 100644 --- a/openstack_dashboard/dashboards/admin/networks/ports/views.py +++ b/openstack_dashboard/dashboards/admin/networks/ports/views.py @@ -16,8 +16,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -26,16 +26,14 @@ from openstack_dashboard import api from openstack_dashboard.dashboards.project.networks.ports \ import views as project_views -from openstack_dashboard.dashboards.admin.networks.ports.forms \ - import CreatePort -from openstack_dashboard.dashboards.admin.networks.ports.forms \ - import UpdatePort +from openstack_dashboard.dashboards.admin.networks.ports \ + import forms as project_forms LOG = logging.getLogger(__name__) class CreateView(forms.ModalFormView): - form_class = CreatePort + form_class = project_forms.CreatePort template_name = 'admin/networks/ports/create.html' success_url = 'horizon:admin:networks:detail' failure_url = 'horizon:admin:networks:detail' @@ -69,7 +67,7 @@ class CreateView(forms.ModalFormView): class UpdateView(project_views.UpdateView): - form_class = UpdatePort + form_class = project_forms.UpdatePort template_name = 'admin/networks/ports/update.html' context_object_name = 'port' success_url = 'horizon:admin:networks:detail' diff --git a/openstack_dashboard/dashboards/admin/networks/subnets/tables.py b/openstack_dashboard/dashboards/admin/networks/subnets/tables.py index 099d667ed5..0ea8cdd77a 100644 --- a/openstack_dashboard/dashboards/admin/networks/subnets/tables.py +++ b/openstack_dashboard/dashboards/admin/networks/subnets/tables.py @@ -16,8 +16,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables diff --git a/openstack_dashboard/dashboards/admin/networks/subnets/urls.py b/openstack_dashboard/dashboards/admin/networks/subnets/urls.py index 3779372da5..e7c44f2da5 100644 --- a/openstack_dashboard/dashboards/admin/networks/subnets/urls.py +++ b/openstack_dashboard/dashboards/admin/networks/subnets/urls.py @@ -14,11 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.networks.subnets.views import \ - DetailView +from openstack_dashboard.dashboards.project.networks.subnets import views SUBNETS = r'^(?P[^/]+)/%s$' @@ -26,5 +25,5 @@ VIEW_MOD = 'openstack_dashboard.dashboards.admin.networks.subnets.views' urlpatterns = patterns(VIEW_MOD, - url(SUBNETS % 'detail', DetailView.as_view(), name='detail') + url(SUBNETS % 'detail', views.DetailView.as_view(), name='detail') ) diff --git a/openstack_dashboard/dashboards/admin/networks/subnets/views.py b/openstack_dashboard/dashboards/admin/networks/subnets/views.py index b802b1ac80..d226a4a8db 100644 --- a/openstack_dashboard/dashboards/admin/networks/subnets/views.py +++ b/openstack_dashboard/dashboards/admin/networks/subnets/views.py @@ -19,18 +19,15 @@ import logging from openstack_dashboard.dashboards.project.networks.subnets \ import views as project_views -from openstack_dashboard.dashboards.admin.networks.subnets.workflows \ - import CreateSubnet -from openstack_dashboard.dashboards.admin.networks.subnets.workflows \ - import UpdateSubnet +from openstack_dashboard.dashboards.admin.networks.subnets import workflows LOG = logging.getLogger(__name__) class CreateView(project_views.CreateView): - workflow_class = CreateSubnet + workflow_class = workflows.CreateSubnet class UpdateView(project_views.UpdateView): - workflow_class = UpdateSubnet + workflow_class = workflows.UpdateSubnet diff --git a/openstack_dashboard/dashboards/admin/networks/subnets/workflows.py b/openstack_dashboard/dashboards/admin/networks/subnets/workflows.py index 4775fde50a..55baaa668b 100644 --- a/openstack_dashboard/dashboards/admin/networks/subnets/workflows.py +++ b/openstack_dashboard/dashboards/admin/networks/subnets/workflows.py @@ -16,8 +16,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions diff --git a/openstack_dashboard/dashboards/admin/networks/tables.py b/openstack_dashboard/dashboards/admin/networks/tables.py index 49193aeb81..982259e40c 100644 --- a/openstack_dashboard/dashboards/admin/networks/tables.py +++ b/openstack_dashboard/dashboards/admin/networks/tables.py @@ -16,15 +16,16 @@ import logging -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django.template import defaultfilters as filters -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.project.networks.tables import get_subnets +from openstack_dashboard.dashboards.project.networks \ + import tables as project_tables LOG = logging.getLogger(__name__) @@ -67,7 +68,7 @@ class NetworksTable(tables.DataTable): tenant = tables.Column("tenant_name", verbose_name=_("Project")) name = tables.Column("name", verbose_name=_("Network Name"), link='horizon:admin:networks:detail') - subnets = tables.Column(get_subnets, + subnets = tables.Column(project_tables.get_subnets, verbose_name=_("Subnets Associated"),) shared = tables.Column("shared", verbose_name=_("Shared"), filters=(filters.yesno, filters.capfirst)) diff --git a/openstack_dashboard/dashboards/admin/networks/tests.py b/openstack_dashboard/dashboards/admin/networks/tests.py index 9a3eb4ffe1..8a556afa35 100644 --- a/openstack_dashboard/dashboards/admin/networks/tests.py +++ b/openstack_dashboard/dashboards/admin/networks/tests.py @@ -14,16 +14,16 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from horizon.workflows.views import WorkflowView +from horizon.workflows import views -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.dashboards.project.networks.tests \ - import form_data_subnet + import form_data_subnet # noqa from openstack_dashboard.test import helpers as test @@ -383,7 +383,7 @@ class NetworkSubnetTests(test.BaseAdminViewTests): args=[network.id]) res = self.client.get(url) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) @test.create_stubs({api.neutron: ('network_get', 'subnet_create',)}) diff --git a/openstack_dashboard/dashboards/admin/networks/urls.py b/openstack_dashboard/dashboards/admin/networks/urls.py index ddf878803a..ef5c9e4784 100644 --- a/openstack_dashboard/dashboards/admin/networks/urls.py +++ b/openstack_dashboard/dashboards/admin/networks/urls.py @@ -14,46 +14,40 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import include -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import include # noqa +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.networks.views import CreateView -from openstack_dashboard.dashboards.admin.networks.views import DetailView -from openstack_dashboard.dashboards.admin.networks.views import IndexView -from openstack_dashboard.dashboards.admin.networks.views import UpdateView +from openstack_dashboard.dashboards.admin.networks import views from openstack_dashboard.dashboards.admin.networks.subnets \ import urls as subnet_urls -from openstack_dashboard.dashboards.admin.networks.subnets.views \ - import CreateView as AddSubnetView -from openstack_dashboard.dashboards.admin.networks.subnets.views \ - import UpdateView as EditSubnetView +from openstack_dashboard.dashboards.admin.networks.subnets \ + import views as subnet_views from openstack_dashboard.dashboards.admin.networks.ports \ import urls as port_urls -from openstack_dashboard.dashboards.admin.networks.ports.views \ - import CreateView as AddPortView -from openstack_dashboard.dashboards.admin.networks.ports.views \ - import UpdateView as EditPortView +from openstack_dashboard.dashboards.admin.networks.ports \ + import views as port_views NETWORKS = r'^(?P[^/]+)/%s$' urlpatterns = patterns('', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^create/$', CreateView.as_view(), name='create'), - url(NETWORKS % 'update', UpdateView.as_view(), name='update'), + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^create/$', views.CreateView.as_view(), name='create'), + url(NETWORKS % 'update', views.UpdateView.as_view(), name='update'), # for detail view - url(NETWORKS % 'detail', DetailView.as_view(), name='detail'), - url(NETWORKS % 'subnets/create', AddSubnetView.as_view(), - name='addsubnet'), - url(NETWORKS % 'ports/create', AddPortView.as_view(), name='addport'), + url(NETWORKS % 'detail', views.DetailView.as_view(), name='detail'), + url(NETWORKS % 'subnets/create', + subnet_views.CreateView.as_view(), name='addsubnet'), + url(NETWORKS % 'ports/create', + port_views.CreateView.as_view(), name='addport'), url(r'^(?P[^/]+)/subnets/(?P[^/]+)/update$', - EditSubnetView.as_view(), name='editsubnet'), + subnet_views.UpdateView.as_view(), name='editsubnet'), url(r'^(?P[^/]+)/ports/(?P[^/]+)/update$', - EditPortView.as_view(), name='editport'), + port_views.UpdateView.as_view(), name='editport'), url(r'^subnets/', include(subnet_urls, namespace='subnets')), url(r'^ports/', include(port_urls, namespace='ports'))) diff --git a/openstack_dashboard/dashboards/admin/networks/views.py b/openstack_dashboard/dashboards/admin/networks/views.py index 02ab19c11d..b92b69bf4f 100644 --- a/openstack_dashboard/dashboards/admin/networks/views.py +++ b/openstack_dashboard/dashboards/admin/networks/views.py @@ -16,9 +16,9 @@ import logging -from django.core.urlresolvers import reverse_lazy -from django.utils.datastructures import SortedDict -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.datastructures import SortedDict # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -27,20 +27,21 @@ from horizon import tables from openstack_dashboard import api from openstack_dashboard.dashboards.project.networks import views as user_views -from openstack_dashboard.dashboards.admin.networks.forms import CreateNetwork -from openstack_dashboard.dashboards.admin.networks.forms import UpdateNetwork -from openstack_dashboard.dashboards.admin.networks.ports.tables \ - import PortsTable -from openstack_dashboard.dashboards.admin.networks.subnets.tables \ - import SubnetsTable -from openstack_dashboard.dashboards.admin.networks.tables import NetworksTable +from openstack_dashboard.dashboards.admin.networks \ + import forms as project_forms +from openstack_dashboard.dashboards.admin.networks.ports \ + import tables as ports_tables +from openstack_dashboard.dashboards.admin.networks.subnets \ + import tables as subnets_tables +from openstack_dashboard.dashboards.admin.networks \ + import tables as networks_tables LOG = logging.getLogger(__name__) class IndexView(tables.DataTableView): - table_class = NetworksTable + table_class = networks_tables.NetworksTable template_name = 'admin/networks/index.html' def _get_tenant_list(self): @@ -75,13 +76,14 @@ class IndexView(tables.DataTableView): class CreateView(forms.ModalFormView): - form_class = CreateNetwork + form_class = project_forms.CreateNetwork template_name = 'admin/networks/create.html' success_url = reverse_lazy('horizon:admin:networks:index') class DetailView(tables.MultiTableView): - table_classes = (SubnetsTable, PortsTable) + table_classes = (subnets_tables.SubnetsTable, + ports_tables.PortsTable) template_name = 'project/networks/detail.html' failure_url = reverse_lazy('horizon:admin:networks:index') @@ -132,7 +134,7 @@ class DetailView(tables.MultiTableView): class UpdateView(user_views.UpdateView): - form_class = UpdateNetwork + form_class = project_forms.UpdateNetwork template_name = 'admin/networks/update.html' success_url = reverse_lazy('horizon:admin:networks:index') diff --git a/openstack_dashboard/dashboards/admin/overview/panel.py b/openstack_dashboard/dashboards/admin/overview/panel.py index ec23757863..0028c6943a 100644 --- a/openstack_dashboard/dashboards/admin/overview/panel.py +++ b/openstack_dashboard/dashboards/admin/overview/panel.py @@ -18,7 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/admin/overview/tests.py b/openstack_dashboard/dashboards/admin/overview/tests.py index 22499285e0..e227509096 100644 --- a/openstack_dashboard/dashboards/admin/overview/tests.py +++ b/openstack_dashboard/dashboards/admin/overview/tests.py @@ -20,13 +20,13 @@ import datetime -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http from django.utils import timezone -from mox import IsA +from mox import IsA # noqa -from horizon.templatetags.sizeformat import mbformat +from horizon.templatetags.sizeformat import mbformat # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/overview/urls.py b/openstack_dashboard/dashboards/admin/overview/urls.py index 6cf1bde0d4..de1238b004 100644 --- a/openstack_dashboard/dashboards/admin/overview/urls.py +++ b/openstack_dashboard/dashboards/admin/overview/urls.py @@ -19,12 +19,12 @@ # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.overview.views import GlobalOverview +from openstack_dashboard.dashboards.admin.overview import views urlpatterns = patterns('', - url(r'^$', GlobalOverview.as_view(), name='index'), + url(r'^$', views.GlobalOverview.as_view(), name='index'), ) diff --git a/openstack_dashboard/dashboards/admin/overview/views.py b/openstack_dashboard/dashboards/admin/overview/views.py index f26c3cd71e..c9c9e9fc27 100644 --- a/openstack_dashboard/dashboards/admin/overview/views.py +++ b/openstack_dashboard/dashboards/admin/overview/views.py @@ -18,18 +18,18 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf import settings -from django.template.defaultfilters import floatformat -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.template.defaultfilters import floatformat # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from openstack_dashboard import api from openstack_dashboard import usage -from openstack_dashboard.usage.base import BaseCsvResponse +from openstack_dashboard.usage import base -class GlobalUsageCsvRenderer(BaseCsvResponse): +class GlobalUsageCsvRenderer(base.BaseCsvResponse): columns = [_("Project Name"), _("VCPUs"), _("Ram (MB)"), _("Disk (GB)"), _("Usage (Hours)")] diff --git a/openstack_dashboard/dashboards/admin/projects/panel.py b/openstack_dashboard/dashboards/admin/projects/panel.py index 8eb9757d07..e957f693b9 100644 --- a/openstack_dashboard/dashboards/admin/projects/panel.py +++ b/openstack_dashboard/dashboards/admin/projects/panel.py @@ -18,7 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/admin/projects/tables.py b/openstack_dashboard/dashboards/admin/projects/tables.py index 296d8001c0..8fa9a3e176 100644 --- a/openstack_dashboard/dashboards/admin/projects/tables.py +++ b/openstack_dashboard/dashboards/admin/projects/tables.py @@ -1,13 +1,13 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.http import urlencode -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.http import urlencode # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables from openstack_dashboard import api -from openstack_dashboard.api.keystone import VERSIONS as IDENTITY_VERSIONS +from openstack_dashboard.api import keystone LOG = logging.getLogger(__name__) @@ -33,7 +33,7 @@ class ViewGroupsLink(tables.LinkAction): classes = ("ajax-modal", "btn-edit") def allowed(self, request, project): - return IDENTITY_VERSIONS.active >= 3 + return keystone.VERSIONS.active >= 3 def get_link_url(self, project): step = 'update_group_members' diff --git a/openstack_dashboard/dashboards/admin/projects/tests.py b/openstack_dashboard/dashboards/admin/projects/tests.py index dc60a6cab2..edf52353af 100644 --- a/openstack_dashboard/dashboards/admin/projects/tests.py +++ b/openstack_dashboard/dashboards/admin/projects/tests.py @@ -16,31 +16,24 @@ import logging -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from horizon import exceptions -from horizon.workflows.views import WorkflowView +from horizon.workflows import views from openstack_dashboard import api from openstack_dashboard.test import helpers as test from openstack_dashboard.usage import quotas -from openstack_dashboard.dashboards.admin.projects.workflows \ - import CreateProject -from openstack_dashboard.dashboards.admin.projects.workflows \ - import PROJECT_GROUP_MEMBER_SLUG -from openstack_dashboard.dashboards.admin.projects.workflows \ - import PROJECT_USER_MEMBER_SLUG -from openstack_dashboard.dashboards.admin.projects.workflows \ - import UpdateProject +from openstack_dashboard.dashboards.admin.projects import workflows INDEX_URL = reverse('horizon:admin:projects:index') -USER_ROLE_PREFIX = PROJECT_GROUP_MEMBER_SLUG + "_role_" -GROUP_ROLE_PREFIX = PROJECT_USER_MEMBER_SLUG + "_role_" +USER_ROLE_PREFIX = workflows.PROJECT_GROUP_MEMBER_SLUG + "_role_" +GROUP_ROLE_PREFIX = workflows.PROJECT_USER_MEMBER_SLUG + "_role_" @test.create_stubs({api.keystone: ('tenant_list',)}) @@ -153,10 +146,11 @@ class CreateProjectWorkflowTests(test.BaseAdminViewTests): url = reverse('horizon:admin:projects:create') res = self.client.get(url) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) workflow = res.context['workflow'] - self.assertEqual(res.context['workflow'].name, CreateProject.name) + self.assertEqual(res.context['workflow'].name, + workflows.CreateProject.name) step = workflow.get_step("createprojectinfoaction") self.assertEqual(step.action.initial['ram'], quota.get('ram').limit) @@ -286,7 +280,7 @@ class CreateProjectWorkflowTests(test.BaseAdminViewTests): url = reverse('horizon:admin:projects:create') res = self.client.get(url) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) self.assertContains(res, "Unable to retrieve default quota values") def test_add_project_quota_defaults_error_domain(self): @@ -629,10 +623,11 @@ class UpdateProjectWorkflowTests(test.BaseAdminViewTests): args=[self.tenant.id]) res = self.client.get(url) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) workflow = res.context['workflow'] - self.assertEqual(res.context['workflow'].name, UpdateProject.name) + self.assertEqual(res.context['workflow'].name, + workflows.UpdateProject.name) step = workflow.get_step("update_info") self.assertEqual(step.action.initial['ram'], quota.get('ram').limit) diff --git a/openstack_dashboard/dashboards/admin/projects/urls.py b/openstack_dashboard/dashboards/admin/projects/urls.py index 6f69fc9000..059aa27395 100644 --- a/openstack_dashboard/dashboards/admin/projects/urls.py +++ b/openstack_dashboard/dashboards/admin/projects/urls.py @@ -18,23 +18,17 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.projects.views \ - import CreateProjectView -from openstack_dashboard.dashboards.admin.projects.views import IndexView -from openstack_dashboard.dashboards.admin.projects.views \ - import ProjectUsageView -from openstack_dashboard.dashboards.admin.projects.views \ - import UpdateProjectView +from openstack_dashboard.dashboards.admin.projects import views urlpatterns = patterns('', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^create$', CreateProjectView.as_view(), name='create'), + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^create$', views.CreateProjectView.as_view(), name='create'), url(r'^(?P[^/]+)/update/$', - UpdateProjectView.as_view(), name='update'), + views.UpdateProjectView.as_view(), name='update'), url(r'^(?P[^/]+)/usage/$', - ProjectUsageView.as_view(), name='usage'), + views.ProjectUsageView.as_view(), name='usage'), ) diff --git a/openstack_dashboard/dashboards/admin/projects/views.py b/openstack_dashboard/dashboards/admin/projects/views.py index 8fdb30b038..5e893783b3 100644 --- a/openstack_dashboard/dashboards/admin/projects/views.py +++ b/openstack_dashboard/dashboards/admin/projects/views.py @@ -20,8 +20,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables @@ -31,11 +31,10 @@ from openstack_dashboard import api from openstack_dashboard import usage from openstack_dashboard.usage import quotas -from openstack_dashboard.dashboards.admin.projects.tables import TenantsTable -from openstack_dashboard.dashboards.admin.projects.workflows \ - import CreateProject -from openstack_dashboard.dashboards.admin.projects.workflows \ - import UpdateProject +from openstack_dashboard.dashboards.admin.projects \ + import tables as project_tables +from openstack_dashboard.dashboards.admin.projects \ + import workflows as project_workflows LOG = logging.getLogger(__name__) @@ -67,7 +66,7 @@ class TenantContextMixin(object): class IndexView(tables.DataTableView): - table_class = TenantsTable + table_class = project_tables.TenantsTable template_name = 'admin/projects/index.html' def has_more_data(self, table): @@ -76,7 +75,7 @@ class IndexView(tables.DataTableView): def get_data(self): tenants = [] marker = self.request.GET.get( - TenantsTable._meta.pagination_param, None) + project_tables.TenantsTable._meta.pagination_param, None) domain_context = self.request.session.get('domain_context', None) try: tenants, self._more = api.keystone.tenant_list( @@ -102,7 +101,7 @@ class ProjectUsageView(usage.UsageView): class CreateProjectView(workflows.WorkflowView): - workflow_class = CreateProject + workflow_class = project_workflows.CreateProject def get_initial(self): initial = super(CreateProjectView, self).get_initial() @@ -121,7 +120,7 @@ class CreateProjectView(workflows.WorkflowView): class UpdateProjectView(workflows.WorkflowView): - workflow_class = UpdateProject + workflow_class = project_workflows.UpdateProject def get_initial(self): initial = super(UpdateProjectView, self).get_initial() diff --git a/openstack_dashboard/dashboards/admin/projects/workflows.py b/openstack_dashboard/dashboards/admin/projects/workflows.py index 4dbede1fda..f1dcb65070 100644 --- a/openstack_dashboard/dashboards/admin/projects/workflows.py +++ b/openstack_dashboard/dashboards/admin/projects/workflows.py @@ -19,9 +19,9 @@ # under the License. -from django.conf import settings -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -29,18 +29,15 @@ from horizon import messages from horizon import workflows from openstack_dashboard import api -from openstack_dashboard.api.base import is_service_enabled +from openstack_dashboard.api import base from openstack_dashboard.api import cinder -from openstack_dashboard.api.keystone import VERSIONS as IDENTITY_VERSIONS +from openstack_dashboard.api import keystone from openstack_dashboard.api import nova -from openstack_dashboard.usage.quotas import CINDER_QUOTA_FIELDS -from openstack_dashboard.usage.quotas import get_disabled_quotas -from openstack_dashboard.usage.quotas import NOVA_QUOTA_FIELDS -from openstack_dashboard.usage.quotas import QUOTA_FIELDS +from openstack_dashboard.usage import quotas INDEX_URL = "horizon:admin:projects:index" ADD_USER_URL = "horizon:admin:projects:create_user" -PROJECT_GROUP_ENABLED = IDENTITY_VERSIONS.active >= 3 +PROJECT_GROUP_ENABLED = keystone.VERSIONS.active >= 3 PROJECT_USER_MEMBER_SLUG = "update_members" PROJECT_GROUP_MEMBER_SLUG = "update_group_members" @@ -70,7 +67,7 @@ class UpdateProjectQuotaAction(workflows.Action): super(UpdateProjectQuotaAction, self).__init__(request, *args, **kwargs) - disabled_quotas = get_disabled_quotas(request) + disabled_quotas = quotas.get_disabled_quotas(request) for field in disabled_quotas: if field in self.fields: self.fields[field].required = False @@ -86,7 +83,7 @@ class UpdateProjectQuotaAction(workflows.Action): class UpdateProjectQuota(workflows.Step): action_class = UpdateProjectQuotaAction depends_on = ("project_id",) - contributes = QUOTA_FIELDS + contributes = quotas.QUOTA_FIELDS class CreateProjectInfoAction(workflows.Action): @@ -410,13 +407,14 @@ class CreateProject(workflows.Workflow): % groups_to_add)) # Update the project quota. - nova_data = dict([(key, data[key]) for key in NOVA_QUOTA_FIELDS]) + nova_data = dict( + [(key, data[key]) for key in quotas.NOVA_QUOTA_FIELDS]) try: nova.tenant_quota_update(request, project_id, **nova_data) - if is_service_enabled(request, 'volume'): + if base.is_service_enabled(request, 'volume'): cinder_data = dict([(key, data[key]) for key in - CINDER_QUOTA_FIELDS]) + quotas.CINDER_QUOTA_FIELDS]) cinder.tenant_quota_update(request, project_id, **cinder_data) @@ -656,15 +654,16 @@ class UpdateProject(workflows.Workflow): return True # update the project quota - nova_data = dict([(key, data[key]) for key in NOVA_QUOTA_FIELDS]) + nova_data = dict( + [(key, data[key]) for key in quotas.NOVA_QUOTA_FIELDS]) try: nova.tenant_quota_update(request, project_id, **nova_data) - if is_service_enabled(request, 'volume'): + if base.is_service_enabled(request, 'volume'): cinder_data = dict([(key, data[key]) for key in - CINDER_QUOTA_FIELDS]) + quotas.CINDER_QUOTA_FIELDS]) cinder.tenant_quota_update(request, project_id, **cinder_data) diff --git a/openstack_dashboard/dashboards/admin/roles/forms.py b/openstack_dashboard/dashboards/admin/roles/forms.py index 9827e01d0e..e2651069cd 100644 --- a/openstack_dashboard/dashboards/admin/roles/forms.py +++ b/openstack_dashboard/dashboards/admin/roles/forms.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/admin/roles/panel.py b/openstack_dashboard/dashboards/admin/roles/panel.py index f8fa674808..c752a9b19b 100644 --- a/openstack_dashboard/dashboards/admin/roles/panel.py +++ b/openstack_dashboard/dashboards/admin/roles/panel.py @@ -14,11 +14,11 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon -from openstack_dashboard.api.keystone import VERSIONS as IDENTITY_VERSIONS +from openstack_dashboard.api.keystone import VERSIONS as IDENTITY_VERSIONS # noqa from openstack_dashboard.dashboards.admin import dashboard diff --git a/openstack_dashboard/dashboards/admin/roles/tables.py b/openstack_dashboard/dashboards/admin/roles/tables.py index 97431e184e..c2070ae676 100644 --- a/openstack_dashboard/dashboards/admin/roles/tables.py +++ b/openstack_dashboard/dashboards/admin/roles/tables.py @@ -16,7 +16,7 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables diff --git a/openstack_dashboard/dashboards/admin/roles/tests.py b/openstack_dashboard/dashboards/admin/roles/tests.py index 4fa9127e10..7267d65850 100644 --- a/openstack_dashboard/dashboards/admin/roles/tests.py +++ b/openstack_dashboard/dashboards/admin/roles/tests.py @@ -14,11 +14,11 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IgnoreArg -from mox import IsA +from mox import IgnoreArg # noqa +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/roles/urls.py b/openstack_dashboard/dashboards/admin/roles/urls.py index 178888a106..a2afe16740 100644 --- a/openstack_dashboard/dashboards/admin/roles/urls.py +++ b/openstack_dashboard/dashboards/admin/roles/urls.py @@ -14,14 +14,13 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.roles.views import CreateView -from openstack_dashboard.dashboards.admin.roles.views import IndexView -from openstack_dashboard.dashboards.admin.roles.views import UpdateView +from openstack_dashboard.dashboards.admin.roles import views urlpatterns = patterns('openstack_dashboard.dashboards.admin.roles.views', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^(?P[^/]+)/update/$', UpdateView.as_view(), name='update'), - url(r'^create/$', CreateView.as_view(), name='create')) + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^(?P[^/]+)/update/$', + views.UpdateView.as_view(), name='update'), + url(r'^create/$', views.CreateView.as_view(), name='create')) diff --git a/openstack_dashboard/dashboards/admin/roles/views.py b/openstack_dashboard/dashboards/admin/roles/views.py index b232e052e1..b0016c5e3f 100644 --- a/openstack_dashboard/dashboards/admin/roles/views.py +++ b/openstack_dashboard/dashboards/admin/roles/views.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -24,13 +24,14 @@ from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.roles.forms import CreateRoleForm -from openstack_dashboard.dashboards.admin.roles.forms import UpdateRoleForm -from openstack_dashboard.dashboards.admin.roles.tables import RolesTable +from openstack_dashboard.dashboards.admin.roles \ + import forms as project_forms +from openstack_dashboard.dashboards.admin.roles \ + import tables as project_tables class IndexView(tables.DataTableView): - table_class = RolesTable + table_class = project_tables.RolesTable template_name = 'admin/roles/index.html' def get_data(self): @@ -44,7 +45,7 @@ class IndexView(tables.DataTableView): class UpdateView(forms.ModalFormView): - form_class = UpdateRoleForm + form_class = project_forms.UpdateRoleForm template_name = 'admin/roles/update.html' success_url = reverse_lazy('horizon:admin:roles:index') @@ -72,6 +73,6 @@ class UpdateView(forms.ModalFormView): class CreateView(forms.ModalFormView): - form_class = CreateRoleForm + form_class = project_forms.CreateRoleForm template_name = 'admin/roles/create.html' success_url = reverse_lazy('horizon:admin:roles:index') diff --git a/openstack_dashboard/dashboards/admin/routers/panel.py b/openstack_dashboard/dashboards/admin/routers/panel.py index 69709363f0..f8969bfa63 100644 --- a/openstack_dashboard/dashboards/admin/routers/panel.py +++ b/openstack_dashboard/dashboards/admin/routers/panel.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/admin/routers/ports/tables.py b/openstack_dashboard/dashboards/admin/routers/ports/tables.py index 83b6be24bf..550cd2adc9 100644 --- a/openstack_dashboard/dashboards/admin/routers/ports/tables.py +++ b/openstack_dashboard/dashboards/admin/routers/ports/tables.py @@ -16,13 +16,13 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables -from openstack_dashboard.dashboards.project.networks.ports.tables import\ - get_fixed_ips -from openstack_dashboard.dashboards.project.routers.ports.tables import\ - get_device_owner +from openstack_dashboard.dashboards.project.networks.ports \ + import tables as networks_tables +from openstack_dashboard.dashboards.project.routers.ports \ + import tables as routers_tables LOG = logging.getLogger(__name__) @@ -32,9 +32,10 @@ class PortsTable(tables.DataTable): name = tables.Column("name", verbose_name=_("Name"), link="horizon:admin:networks:ports:detail") - fixed_ips = tables.Column(get_fixed_ips, verbose_name=_("Fixed IPs")) + fixed_ips = tables.Column(networks_tables.get_fixed_ips, + verbose_name=_("Fixed IPs")) status = tables.Column("status", verbose_name=_("Status")) - device_owner = tables.Column(get_device_owner, + device_owner = tables.Column(routers_tables.get_device_owner, verbose_name=_("Type")) admin_state = tables.Column("admin_state", verbose_name=_("Admin State")) diff --git a/openstack_dashboard/dashboards/admin/routers/ports/urls.py b/openstack_dashboard/dashboards/admin/routers/ports/urls.py index 89ac65f800..0084782902 100644 --- a/openstack_dashboard/dashboards/admin/routers/ports/urls.py +++ b/openstack_dashboard/dashboards/admin/routers/ports/urls.py @@ -14,12 +14,12 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.routers.ports.views import DetailView +from openstack_dashboard.dashboards.admin.routers.ports import views PORTS = r'^(?P[^/]+)/%s$' urlpatterns = patterns('horizon.dashboards.admin.networks.ports.views', - url(PORTS % 'detail', DetailView.as_view(), name='detail')) + url(PORTS % 'detail', views.DetailView.as_view(), name='detail')) diff --git a/openstack_dashboard/dashboards/admin/routers/ports/views.py b/openstack_dashboard/dashboards/admin/routers/ports/views.py index 06deaf4459..1f40c6e55b 100644 --- a/openstack_dashboard/dashboards/admin/routers/ports/views.py +++ b/openstack_dashboard/dashboards/admin/routers/ports/views.py @@ -18,13 +18,13 @@ import logging from horizon import tabs -from openstack_dashboard.dashboards.admin.routers.ports.tabs \ - import PortDetailTabs +from openstack_dashboard.dashboards.admin.routers.ports \ + import tabs as project_tabs LOG = logging.getLogger(__name__) class DetailView(tabs.TabView): - tab_group_class = PortDetailTabs + tab_group_class = project_tabs.PortDetailTabs template_name = 'admin/networks/ports/detail.html' diff --git a/openstack_dashboard/dashboards/admin/routers/tables.py b/openstack_dashboard/dashboards/admin/routers/tables.py index a9d262e997..a2ba1ab8bf 100644 --- a/openstack_dashboard/dashboards/admin/routers/tables.py +++ b/openstack_dashboard/dashboards/admin/routers/tables.py @@ -16,8 +16,8 @@ import logging -from django.template.defaultfilters import title -from django.utils.translation import ugettext_lazy as _ +from django.template.defaultfilters import title # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/admin/routers/tests.py b/openstack_dashboard/dashboards/admin/routers/tests.py index 41ec2d1f05..fc64a1ac8b 100644 --- a/openstack_dashboard/dashboards/admin/routers/tests.py +++ b/openstack_dashboard/dashboards/admin/routers/tests.py @@ -14,10 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.dashboards.project.routers import tests as r_test diff --git a/openstack_dashboard/dashboards/admin/routers/urls.py b/openstack_dashboard/dashboards/admin/routers/urls.py index 21f8b1568b..cd02483f08 100644 --- a/openstack_dashboard/dashboards/admin/routers/urls.py +++ b/openstack_dashboard/dashboards/admin/routers/urls.py @@ -14,16 +14,15 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.routers.views import DetailView -from openstack_dashboard.dashboards.admin.routers.views import IndexView +from openstack_dashboard.dashboards.admin.routers import views urlpatterns = patterns('horizon.dashboards.admin.routers.views', - url(r'^$', IndexView.as_view(), name='index'), + url(r'^$', views.IndexView.as_view(), name='index'), url(r'^(?P[^/]+)/$', - DetailView.as_view(), + views.DetailView.as_view(), name='detail'), ) diff --git a/openstack_dashboard/dashboards/admin/routers/views.py b/openstack_dashboard/dashboards/admin/routers/views.py index 6199da6a13..0da2c0500e 100644 --- a/openstack_dashboard/dashboards/admin/routers/views.py +++ b/openstack_dashboard/dashboards/admin/routers/views.py @@ -20,24 +20,24 @@ Views for managing Neutron Routers. import logging -from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from openstack_dashboard import api from openstack_dashboard.dashboards.admin.networks import views as n_views from openstack_dashboard.dashboards.project.routers import views as r_views -from openstack_dashboard.dashboards.admin.routers.ports.tables \ - import PortsTable -from openstack_dashboard.dashboards.admin.routers.tables import RoutersTable +from openstack_dashboard.dashboards.admin.routers.ports \ + import tables as ports_tables +from openstack_dashboard.dashboards.admin.routers import tables LOG = logging.getLogger(__name__) class IndexView(r_views.IndexView, n_views.IndexView): - table_class = RoutersTable + table_class = tables.RoutersTable template_name = 'admin/routers/index.html' def _get_routers(self, search_opts=None): @@ -67,6 +67,6 @@ class IndexView(r_views.IndexView, n_views.IndexView): class DetailView(r_views.DetailView): - table_classes = (PortsTable, ) + table_classes = (ports_tables.PortsTable, ) template_name = 'admin/routers/detail.html' failure_url = reverse_lazy('horizon:admin:routers:index') diff --git a/openstack_dashboard/dashboards/admin/users/forms.py b/openstack_dashboard/dashboards/admin/users/forms.py index 9b44f22b19..c29b8f2402 100644 --- a/openstack_dashboard/dashboards/admin/users/forms.py +++ b/openstack_dashboard/dashboards/admin/users/forms.py @@ -20,9 +20,9 @@ import logging -from django.forms import ValidationError -from django.utils.translation import ugettext_lazy as _ -from django.views.decorators.debug import sensitive_variables +from django.forms import ValidationError # noqa +from django.utils.translation import ugettext_lazy as _ # noqa +from django.views.decorators.debug import sensitive_variables # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/admin/users/panel.py b/openstack_dashboard/dashboards/admin/users/panel.py index a813fa4ac2..797556cab0 100644 --- a/openstack_dashboard/dashboards/admin/users/panel.py +++ b/openstack_dashboard/dashboards/admin/users/panel.py @@ -18,7 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/admin/users/tables.py b/openstack_dashboard/dashboards/admin/users/tables.py index 9e30cc295f..935a2be129 100644 --- a/openstack_dashboard/dashboards/admin/users/tables.py +++ b/openstack_dashboard/dashboards/admin/users/tables.py @@ -1,7 +1,7 @@ import logging from django.template import defaultfilters -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import messages from horizon import tables diff --git a/openstack_dashboard/dashboards/admin/users/tests.py b/openstack_dashboard/dashboards/admin/users/tests.py index 276fdbfc5c..97a6cf3ddf 100644 --- a/openstack_dashboard/dashboards/admin/users/tests.py +++ b/openstack_dashboard/dashboards/admin/users/tests.py @@ -18,13 +18,13 @@ # License for the specific language governing permissions and limitations # under the License. -from socket import timeout as socket_timeout +from socket import timeout as socket_timeout # noqa -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IgnoreArg -from mox import IsA +from mox import IgnoreArg # noqa +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/users/urls.py b/openstack_dashboard/dashboards/admin/users/urls.py index 3387f5b290..1e33dff6ab 100644 --- a/openstack_dashboard/dashboards/admin/users/urls.py +++ b/openstack_dashboard/dashboards/admin/users/urls.py @@ -18,14 +18,13 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.users.views import CreateView -from openstack_dashboard.dashboards.admin.users.views import IndexView -from openstack_dashboard.dashboards.admin.users.views import UpdateView +from openstack_dashboard.dashboards.admin.users import views urlpatterns = patterns('openstack_dashboard.dashboards.admin.users.views', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^(?P[^/]+)/update/$', UpdateView.as_view(), name='update'), - url(r'^create/$', CreateView.as_view(), name='create')) + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^(?P[^/]+)/update/$', + views.UpdateView.as_view(), name='update'), + url(r'^create/$', views.CreateView.as_view(), name='create')) diff --git a/openstack_dashboard/dashboards/admin/users/views.py b/openstack_dashboard/dashboards/admin/users/views.py index 4223ff45da..70c35004ca 100644 --- a/openstack_dashboard/dashboards/admin/users/views.py +++ b/openstack_dashboard/dashboards/admin/users/views.py @@ -20,11 +20,11 @@ import operator -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy -from django.utils.decorators import method_decorator -from django.utils.translation import ugettext_lazy as _ -from django.views.decorators.debug import sensitive_post_parameters +from django.core.urlresolvers import reverse # noqa +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.decorators import method_decorator # noqa +from django.utils.translation import ugettext_lazy as _ # noqa +from django.views.decorators.debug import sensitive_post_parameters # noqa from horizon import exceptions from horizon import forms @@ -32,13 +32,14 @@ from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.admin.users.forms import CreateUserForm -from openstack_dashboard.dashboards.admin.users.forms import UpdateUserForm -from openstack_dashboard.dashboards.admin.users.tables import UsersTable +from openstack_dashboard.dashboards.admin.users \ + import forms as project_forms +from openstack_dashboard.dashboards.admin.users \ + import tables as project_tables class IndexView(tables.DataTableView): - table_class = UsersTable + table_class = project_tables.UsersTable template_name = 'admin/users/index.html' def get_data(self): @@ -54,7 +55,7 @@ class IndexView(tables.DataTableView): class UpdateView(forms.ModalFormView): - form_class = UpdateUserForm + form_class = project_forms.UpdateUserForm template_name = 'admin/users/update.html' success_url = reverse_lazy('horizon:admin:users:index') @@ -90,7 +91,7 @@ class UpdateView(forms.ModalFormView): class CreateView(forms.ModalFormView): - form_class = CreateUserForm + form_class = project_forms.CreateUserForm template_name = 'admin/users/create.html' success_url = reverse_lazy('horizon:admin:users:index') diff --git a/openstack_dashboard/dashboards/admin/volumes/forms.py b/openstack_dashboard/dashboards/admin/volumes/forms.py index 5b6b7c4377..701238b127 100644 --- a/openstack_dashboard/dashboards/admin/volumes/forms.py +++ b/openstack_dashboard/dashboards/admin/volumes/forms.py @@ -18,7 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/admin/volumes/panel.py b/openstack_dashboard/dashboards/admin/volumes/panel.py index 0a0eba498e..cd62aeb33b 100644 --- a/openstack_dashboard/dashboards/admin/volumes/panel.py +++ b/openstack_dashboard/dashboards/admin/volumes/panel.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/admin/volumes/tables.py b/openstack_dashboard/dashboards/admin/volumes/tables.py index cbf300a686..0dcee3fafb 100644 --- a/openstack_dashboard/dashboards/admin/volumes/tables.py +++ b/openstack_dashboard/dashboards/admin/volumes/tables.py @@ -1,13 +1,9 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables from openstack_dashboard.api import cinder -from openstack_dashboard.dashboards.project.volumes.tables import \ - DeleteVolume -from openstack_dashboard.dashboards.project.volumes.tables import \ - UpdateRow -from openstack_dashboard.dashboards.project.volumes.tables import \ - VolumesTable as _VolumesTable +from openstack_dashboard.dashboards.project.volumes \ + import tables as project_tables class CreateVolumeType(tables.LinkAction): @@ -34,7 +30,7 @@ class VolumesFilterAction(tables.FilterAction): if q in volume.display_name.lower()] -class VolumesTable(_VolumesTable): +class VolumesTable(project_tables.VolumesTable): name = tables.Column("display_name", verbose_name=_("Name"), link="horizon:admin:volumes:detail") @@ -45,9 +41,9 @@ class VolumesTable(_VolumesTable): name = "volumes" verbose_name = _("Volumes") status_columns = ["status"] - row_class = UpdateRow - table_actions = (DeleteVolume, VolumesFilterAction) - row_actions = (DeleteVolume,) + row_class = project_tables.UpdateRow + table_actions = (project_tables.DeleteVolume, VolumesFilterAction) + row_actions = (project_tables.DeleteVolume,) columns = ('tenant', 'host', 'name', 'size', 'status', 'volume_type', 'attachments',) diff --git a/openstack_dashboard/dashboards/admin/volumes/tests.py b/openstack_dashboard/dashboards/admin/volumes/tests.py index 6c8473b461..a69da85464 100644 --- a/openstack_dashboard/dashboards/admin/volumes/tests.py +++ b/openstack_dashboard/dashboards/admin/volumes/tests.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.api import cinder diff --git a/openstack_dashboard/dashboards/admin/volumes/urls.py b/openstack_dashboard/dashboards/admin/volumes/urls.py index edcafe735f..54c79075ab 100644 --- a/openstack_dashboard/dashboards/admin/volumes/urls.py +++ b/openstack_dashboard/dashboards/admin/volumes/urls.py @@ -1,13 +1,11 @@ -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.admin.volumes.views \ - import CreateVolumeTypeView -from openstack_dashboard.dashboards.admin.volumes.views import DetailView -from openstack_dashboard.dashboards.admin.volumes.views import IndexView +from openstack_dashboard.dashboards.admin.volumes import views urlpatterns = patterns('', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^create_type$', CreateVolumeTypeView.as_view(), name='create_type'), - url(r'^(?P[^/]+)/$', DetailView.as_view(), name='detail'), + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^create_type$', views.CreateVolumeTypeView.as_view(), + name='create_type'), + url(r'^(?P[^/]+)/$', views.DetailView.as_view(), name='detail'), ) diff --git a/openstack_dashboard/dashboards/admin/volumes/views.py b/openstack_dashboard/dashboards/admin/volumes/views.py index 05d0998087..497b720a52 100644 --- a/openstack_dashboard/dashboards/admin/volumes/views.py +++ b/openstack_dashboard/dashboards/admin/volumes/views.py @@ -18,30 +18,28 @@ Admin views for managing volumes. """ -from django.core.urlresolvers import reverse -from django.utils.datastructures import SortedDict -from django.utils.translation import ugettext_lazy as _ - -from openstack_dashboard.dashboards.project.volumes.views import \ - DetailView as _DetailView -from openstack_dashboard.dashboards.project.volumes.views import \ - VolumeTableMixIn - -from openstack_dashboard.api import cinder -from openstack_dashboard.api import keystone - -from openstack_dashboard.dashboards.admin.volumes.forms import CreateVolumeType -from openstack_dashboard.dashboards.admin.volumes.tables import VolumesTable -from openstack_dashboard.dashboards.admin.volumes.tables \ - import VolumeTypesTable +from django.core.urlresolvers import reverse # noqa +from django.utils.datastructures import SortedDict # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms from horizon import tables +from openstack_dashboard.api import cinder +from openstack_dashboard.api import keystone -class IndexView(tables.MultiTableView, VolumeTableMixIn): - table_classes = (VolumesTable, VolumeTypesTable) +from openstack_dashboard.dashboards.admin.volumes \ + import forms as project_forms +from openstack_dashboard.dashboards.admin.volumes \ + import tables as project_tables + +from openstack_dashboard.dashboards.project.volumes import views + + +class IndexView(tables.MultiTableView, views.VolumeTableMixIn): + table_classes = (project_tables.VolumesTable, + project_tables.VolumeTypesTable) template_name = "admin/volumes/index.html" def get_volumes_data(self): @@ -76,12 +74,12 @@ class IndexView(tables.MultiTableView, VolumeTableMixIn): return volume_types -class DetailView(_DetailView): +class DetailView(views.DetailView): template_name = "admin/volumes/detail.html" class CreateVolumeTypeView(forms.ModalFormView): - form_class = CreateVolumeType + form_class = project_forms.CreateVolumeType template_name = 'admin/volumes/create_volume_type.html' success_url = 'horizon:admin:volumes:index' diff --git a/openstack_dashboard/dashboards/project/access_and_security/api_access/tables.py b/openstack_dashboard/dashboards/project/access_and_security/api_access/tables.py index 88f171a7a1..ebbe989687 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/api_access/tables.py +++ b/openstack_dashboard/dashboards/project/access_and_security/api_access/tables.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.template.defaultfilters import title -from django.utils.translation import ugettext_lazy as _ +from django.template.defaultfilters import title # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables diff --git a/openstack_dashboard/dashboards/project/access_and_security/api_access/tests.py b/openstack_dashboard/dashboards/project/access_and_security/api_access/tests.py index a01a077541..79415a90ab 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/api_access/tests.py +++ b/openstack_dashboard/dashboards/project/access_and_security/api_access/tests.py @@ -14,10 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse -from django.http import HttpRequest +from django.core.urlresolvers import reverse # noqa +from django.http import HttpRequest # noqa -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/project/access_and_security/api_access/urls.py b/openstack_dashboard/dashboards/project/access_and_security/api_access/urls.py index dad12e96a0..bcfb7a2250 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/api_access/urls.py +++ b/openstack_dashboard/dashboards/project/access_and_security/api_access/urls.py @@ -18,16 +18,14 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa from openstack_dashboard.dashboards.project.access_and_security.\ - api_access.views import download_ec2_bundle -from openstack_dashboard.dashboards.project.access_and_security.\ - api_access.views import download_rc_file + api_access import views urlpatterns = patterns('', - url(r'^ec2/$', download_ec2_bundle, name='ec2'), - url(r'^openrc/$', download_rc_file, name='openrc'), + url(r'^ec2/$', views.download_ec2_bundle, name='ec2'), + url(r'^openrc/$', views.download_rc_file, name='openrc'), ) diff --git a/openstack_dashboard/dashboards/project/access_and_security/api_access/views.py b/openstack_dashboard/dashboards/project/access_and_security/api_access/views.py index cd9b068c3d..3343441125 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/api_access/views.py +++ b/openstack_dashboard/dashboards/project/access_and_security/api_access/views.py @@ -14,15 +14,15 @@ # License for the specific language governing permissions and limitations # under the License. -from contextlib import closing +from contextlib import closing # noqa import logging import tempfile import zipfile from django import http from django import shortcuts -from django.template.loader import render_to_string -from django.utils.translation import ugettext_lazy as _ +from django.template.loader import render_to_string # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import messages diff --git a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/forms.py b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/forms.py index b34c155c26..ae2789faa6 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/forms.py +++ b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/forms.py @@ -19,7 +19,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tables.py b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tables.py index 9d4685db3d..d943999e3b 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tables.py +++ b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tables.py @@ -19,9 +19,9 @@ import logging from django.core import urlresolvers from django import shortcuts -from django.utils.http import urlencode -from django.utils.translation import string_concat -from django.utils.translation import ugettext_lazy as _ +from django.utils.http import urlencode # noqa +from django.utils.translation import string_concat # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import messages @@ -29,7 +29,7 @@ from horizon import tables from openstack_dashboard import api from openstack_dashboard.usage import quotas -from openstack_dashboard.utils.filters import get_int_or_uuid +from openstack_dashboard.utils import filters LOG = logging.getLogger(__name__) @@ -99,7 +99,7 @@ class DisassociateIP(tables.Action): def single(self, table, request, obj_id): try: - fip = table.get_object_by_id(get_int_or_uuid(obj_id)) + fip = table.get_object_by_id(filters.get_int_or_uuid(obj_id)) api.network.floating_ip_disassociate(request, fip.id, fip.port_id) LOG.info('Disassociating Floating IP "%s".' % obj_id) @@ -137,7 +137,7 @@ class FloatingIPsTable(tables.DataTable): empty_value="-") def sanitize_id(self, obj_id): - return get_int_or_uuid(obj_id) + return filters.get_int_or_uuid(obj_id) def get_object_display(self, datum): return datum.ip diff --git a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tests.py b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tests.py index 2b2036e9ac..af79fed440 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tests.py +++ b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/tests.py @@ -19,15 +19,15 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test -from horizon.workflows.views import WorkflowView +from horizon.workflows import views INDEX_URL = reverse('horizon:project:access_and_security:index') @@ -46,7 +46,7 @@ class FloatingIpViewTests(test.TestCase): url = reverse('%s:associate' % NAMESPACE) res = self.client.get(url) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) workflow = res.context['workflow'] choices = dict(workflow.steps[0].action.fields['ip_id'].choices) # Verify that our "associated" floating IP isn't in the choices list. diff --git a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/urls.py b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/urls.py index 57ecf507a7..9c5b1c7b12 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/urls.py +++ b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/urls.py @@ -18,16 +18,14 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa from openstack_dashboard.dashboards.project.access_and_security.\ - floating_ips.views import AllocateView -from openstack_dashboard.dashboards.project.access_and_security.\ - floating_ips.views import AssociateView + floating_ips import views urlpatterns = patterns('', - url(r'^associate/$', AssociateView.as_view(), name='associate'), - url(r'^allocate/$', AllocateView.as_view(), name='allocate') + url(r'^associate/$', views.AssociateView.as_view(), name='associate'), + url(r'^allocate/$', views.AllocateView.as_view(), name='allocate') ) diff --git a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/views.py b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/views.py index aa30c60904..0bf117ade9 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/views.py +++ b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/views.py @@ -23,8 +23,8 @@ Views for managing floating IPs. """ -from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -34,17 +34,17 @@ from openstack_dashboard import api from openstack_dashboard.usage import quotas from openstack_dashboard.dashboards.project.access_and_security.\ - floating_ips.forms import FloatingIpAllocate + floating_ips import forms as project_forms from openstack_dashboard.dashboards.project.access_and_security.\ - floating_ips.workflows import IPAssociationWorkflow + floating_ips import workflows as project_workflows class AssociateView(workflows.WorkflowView): - workflow_class = IPAssociationWorkflow + workflow_class = project_workflows.IPAssociationWorkflow class AllocateView(forms.ModalFormView): - form_class = FloatingIpAllocate + form_class = project_forms.FloatingIpAllocate template_name = 'project/access_and_security/floating_ips/allocate.html' success_url = reverse_lazy('horizon:project:access_and_security:index') diff --git a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/workflows.py b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/workflows.py index f7198a94d5..9e60b7a991 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/floating_ips/workflows.py +++ b/openstack_dashboard/dashboards/project/access_and_security/floating_ips/workflows.py @@ -15,15 +15,15 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms from horizon import workflows from openstack_dashboard import api -from openstack_dashboard.utils.filters import get_int_or_uuid +from openstack_dashboard.utils import filters ALLOCATE_URL = "horizon:project:access_and_security:floating_ips:allocate" @@ -31,7 +31,7 @@ ALLOCATE_URL = "horizon:project:access_and_security:floating_ips:allocate" class AssociateIPAction(workflows.Action): ip_id = forms.DynamicTypedChoiceField(label=_("IP Address"), - coerce=get_int_or_uuid, + coerce=filters.get_int_or_uuid, empty_value=None, add_item_link=ALLOCATE_URL) instance_id = forms.ChoiceField(label=_("Instance")) diff --git a/openstack_dashboard/dashboards/project/access_and_security/keypairs/forms.py b/openstack_dashboard/dashboards/project/access_and_security/keypairs/forms.py index 3177406b56..4284898e52 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/keypairs/forms.py +++ b/openstack_dashboard/dashboards/project/access_and_security/keypairs/forms.py @@ -21,7 +21,7 @@ import re from django.core import validators -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/access_and_security/keypairs/tables.py b/openstack_dashboard/dashboards/project/access_and_security/keypairs/tables.py index fdec467d3e..9714be371d 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/keypairs/tables.py +++ b/openstack_dashboard/dashboards/project/access_and_security/keypairs/tables.py @@ -16,7 +16,7 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables diff --git a/openstack_dashboard/dashboards/project/access_and_security/keypairs/tests.py b/openstack_dashboard/dashboards/project/access_and_security/keypairs/tests.py index bdb12452d2..58a2d5eab5 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/keypairs/tests.py +++ b/openstack_dashboard/dashboards/project/access_and_security/keypairs/tests.py @@ -18,10 +18,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/project/access_and_security/keypairs/urls.py b/openstack_dashboard/dashboards/project/access_and_security/keypairs/urls.py index 429df16aa3..50cced7ae3 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/keypairs/urls.py +++ b/openstack_dashboard/dashboards/project/access_and_security/keypairs/urls.py @@ -18,24 +18,18 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.access_and_security.\ - keypairs.views import CreateView -from openstack_dashboard.dashboards.project.access_and_security.\ - keypairs.views import DownloadView -from openstack_dashboard.dashboards.project.access_and_security.\ - keypairs.views import GenerateView -from openstack_dashboard.dashboards.project.access_and_security.\ - keypairs.views import ImportView +from openstack_dashboard.dashboards.project.access_and_security.keypairs \ + import views urlpatterns = patterns('', - url(r'^create/$', CreateView.as_view(), name='create'), - url(r'^import/$', ImportView.as_view(), name='import'), - url(r'^(?P[^/]+)/download/$', DownloadView.as_view(), + url(r'^create/$', views.CreateView.as_view(), name='create'), + url(r'^import/$', views.ImportView.as_view(), name='import'), + url(r'^(?P[^/]+)/download/$', views.DownloadView.as_view(), name='download'), - url(r'^(?P[^/]+)/generate/$', GenerateView.as_view(), + url(r'^(?P[^/]+)/generate/$', views.GenerateView.as_view(), name='generate'), ) diff --git a/openstack_dashboard/dashboards/project/access_and_security/keypairs/views.py b/openstack_dashboard/dashboards/project/access_and_security/keypairs/views.py index f519752c5b..6c60aa89cd 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/keypairs/views.py +++ b/openstack_dashboard/dashboards/project/access_and_security/keypairs/views.py @@ -23,30 +23,28 @@ Views for managing keypairs. """ import logging -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy +from django.core.urlresolvers import reverse # noqa +from django.core.urlresolvers import reverse_lazy # noqa from django import http -from django.template.defaultfilters import slugify -from django.utils.translation import ugettext_lazy as _ -from django.views.generic import TemplateView -from django.views.generic import View +from django.template.defaultfilters import slugify # noqa +from django.utils.translation import ugettext_lazy as _ # noqa +from django.views.generic import TemplateView # noqa +from django.views.generic import View # noqa from horizon import exceptions from horizon import forms from openstack_dashboard import api -from openstack_dashboard.dashboards.project.access_and_security.\ - keypairs.forms import CreateKeypair -from openstack_dashboard.dashboards.project.access_and_security.\ - keypairs.forms import ImportKeypair +from openstack_dashboard.dashboards.project.access_and_security.keypairs \ + import forms as project_forms LOG = logging.getLogger(__name__) class CreateView(forms.ModalFormView): - form_class = CreateKeypair + form_class = project_forms.CreateKeypair template_name = 'project/access_and_security/keypairs/create.html' success_url = 'horizon:project:access_and_security:keypairs:download' @@ -56,7 +54,7 @@ class CreateView(forms.ModalFormView): class ImportView(forms.ModalFormView): - form_class = ImportKeypair + form_class = project_forms.ImportKeypair template_name = 'project/access_and_security/keypairs/import.html' success_url = reverse_lazy('horizon:project:access_and_security:index') diff --git a/openstack_dashboard/dashboards/project/access_and_security/panel.py b/openstack_dashboard/dashboards/project/access_and_security/panel.py index 4083162997..499837c17c 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/panel.py +++ b/openstack_dashboard/dashboards/project/access_and_security/panel.py @@ -15,7 +15,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py b/openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py index cd00ee9c29..1bdaba7d27 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py +++ b/openstack_dashboard/dashboards/project/access_and_security/security_groups/forms.py @@ -22,21 +22,21 @@ import logging import netaddr -from django.conf import settings -from django.core.urlresolvers import reverse +from django.conf import settings # noqa +from django.core.urlresolvers import reverse # noqa from django.core import validators -from django.forms import ValidationError -from django.utils.translation import ugettext_lazy as _ +from django.forms import ValidationError # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms from horizon import messages from horizon.utils import fields -from horizon.utils.validators import validate_ip_protocol -from horizon.utils.validators import validate_port_range +from horizon.utils.validators import validate_ip_protocol # noqa +from horizon.utils.validators import validate_port_range # noqa from openstack_dashboard import api -from openstack_dashboard.utils.filters import get_int_or_uuid +from openstack_dashboard.utils import filters LOG = logging.getLogger(__name__) @@ -335,7 +335,7 @@ class AddRule(forms.SelfHandlingForm): try: rule = api.network.security_group_rule_create( request, - get_int_or_uuid(data['id']), + filters.get_int_or_uuid(data['id']), data['direction'], data['ethertype'], data['ip_protocol'], diff --git a/openstack_dashboard/dashboards/project/access_and_security/security_groups/tables.py b/openstack_dashboard/dashboards/project/access_and_security/security_groups/tables.py index 3391027746..6295504592 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/security_groups/tables.py +++ b/openstack_dashboard/dashboards/project/access_and_security/security_groups/tables.py @@ -16,14 +16,14 @@ import logging -from django.conf import settings -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables from openstack_dashboard import api -from openstack_dashboard.utils.filters import get_int_or_uuid +from openstack_dashboard.utils import filters LOG = logging.getLogger(__name__) @@ -61,7 +61,7 @@ class SecurityGroupsTable(tables.DataTable): description = tables.Column("description", verbose_name=_("Description")) def sanitize_id(self, obj_id): - return get_int_or_uuid(obj_id) + return filters.get_int_or_uuid(obj_id) class Meta: name = "security_groups" @@ -156,7 +156,7 @@ class RulesTable(tables.DataTable): remote = tables.Column(get_remote, verbose_name=_("Remote")) def sanitize_id(self, obj_id): - return get_int_or_uuid(obj_id) + return filters.get_int_or_uuid(obj_id) def get_object_display(self, rule): return unicode(rule) diff --git a/openstack_dashboard/dashboards/project/access_and_security/security_groups/tests.py b/openstack_dashboard/dashboards/project/access_and_security/security_groups/tests.py index eb54079b15..d57178e353 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/security_groups/tests.py +++ b/openstack_dashboard/dashboards/project/access_and_security/security_groups/tests.py @@ -20,19 +20,20 @@ import cgi -from django.conf import settings -from django.core.urlresolvers import reverse +from django.conf import settings # noqa +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test from openstack_dashboard.dashboards.project.access_and_security.\ - security_groups.tables import RulesTable -from openstack_dashboard.dashboards.project.access_and_security.\ - security_groups.tables import SecurityGroupsTable + security_groups import tables +# import RulesTable +#from openstack_dashboard.dashboards.project.access_and_security.\ +# security_groups.tables import SecurityGroupsTable INDEX_URL = reverse('horizon:project:access_and_security:index') @@ -452,7 +453,7 @@ class SecurityGroupsViewTests(test.TestCase): form_data = {"action": "rules__delete__%s" % rule.id} req = self.factory.post(self.edit_url, form_data) kwargs = {'security_group_id': sec_group.id} - table = RulesTable(req, sec_group.rules, **kwargs) + table = tables.RulesTable(req, sec_group.rules, **kwargs) handled = table.maybe_handle() self.assertEqual(strip_absolute_base(handled['location']), self.detail_url) @@ -470,7 +471,8 @@ class SecurityGroupsViewTests(test.TestCase): form_data = {"action": "rules__delete__%s" % rule.id} req = self.factory.post(self.edit_url, form_data) kwargs = {'security_group_id': sec_group.id} - table = RulesTable(req, self.security_group_rules.list(), **kwargs) + table = tables.RulesTable( + req, self.security_group_rules.list(), **kwargs) handled = table.maybe_handle() self.assertEqual(strip_absolute_base(handled['location']), self.detail_url) @@ -484,7 +486,7 @@ class SecurityGroupsViewTests(test.TestCase): form_data = {"action": "security_groups__delete__%s" % sec_group.id} req = self.factory.post(INDEX_URL, form_data) - table = SecurityGroupsTable(req, self.security_groups.list()) + table = tables.SecurityGroupsTable(req, self.security_groups.list()) handled = table.maybe_handle() self.assertEqual(strip_absolute_base(handled['location']), INDEX_URL) @@ -501,7 +503,7 @@ class SecurityGroupsViewTests(test.TestCase): form_data = {"action": "security_groups__delete__%s" % sec_group.id} req = self.factory.post(INDEX_URL, form_data) - table = SecurityGroupsTable(req, self.security_groups.list()) + table = tables.SecurityGroupsTable(req, self.security_groups.list()) handled = table.maybe_handle() self.assertEqual(strip_absolute_base(handled['location']), diff --git a/openstack_dashboard/dashboards/project/access_and_security/security_groups/urls.py b/openstack_dashboard/dashboards/project/access_and_security/security_groups/urls.py index e1af21fb82..091be07e5e 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/security_groups/urls.py +++ b/openstack_dashboard/dashboards/project/access_and_security/security_groups/urls.py @@ -18,23 +18,19 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa from openstack_dashboard.dashboards.project.access_and_security.\ - security_groups.views import AddRuleView -from openstack_dashboard.dashboards.project.access_and_security.\ - security_groups.views import CreateView -from openstack_dashboard.dashboards.project.access_and_security.\ - security_groups.views import DetailView + security_groups import views urlpatterns = patterns('', - url(r'^create/$', CreateView.as_view(), name='create'), + url(r'^create/$', views.CreateView.as_view(), name='create'), url(r'^(?P[^/]+)/$', - DetailView.as_view(), + views.DetailView.as_view(), name='detail'), url(r'^(?P[^/]+)/add_rule/$', - AddRuleView.as_view(), + views.AddRuleView.as_view(), name='add_rule') ) diff --git a/openstack_dashboard/dashboards/project/access_and_security/security_groups/views.py b/openstack_dashboard/dashboards/project/access_and_security/security_groups/views.py index c14d724508..1cb74f282f 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/security_groups/views.py +++ b/openstack_dashboard/dashboards/project/access_and_security/security_groups/views.py @@ -23,35 +23,33 @@ Views for managing instances. """ import logging -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms from horizon import tables from openstack_dashboard import api -from openstack_dashboard.utils.filters import get_int_or_uuid +from openstack_dashboard.utils import filters from openstack_dashboard.dashboards.project.access_and_security.\ - security_groups.forms import AddRule + security_groups import forms as project_forms from openstack_dashboard.dashboards.project.access_and_security.\ - security_groups.forms import CreateGroup -from openstack_dashboard.dashboards.project.access_and_security.\ - security_groups.tables import RulesTable + security_groups import tables as project_tables LOG = logging.getLogger(__name__) class DetailView(tables.DataTableView): - table_class = RulesTable + table_class = project_tables.RulesTable template_name = 'project/access_and_security/security_groups/detail.html' def _get_data(self): if not hasattr(self, '_sg'): - sg_id = get_int_or_uuid(self.kwargs['security_group_id']) + sg_id = filters.get_int_or_uuid(self.kwargs['security_group_id']) try: self._sg = api.network.security_group_get(self.request, sg_id) except Exception: @@ -71,7 +69,7 @@ class DetailView(tables.DataTableView): class AddRuleView(forms.ModalFormView): - form_class = AddRule + form_class = project_forms.AddRule template_name = 'project/access_and_security/security_groups/add_rule.html' def get_success_url(self): @@ -99,7 +97,8 @@ class AddRuleView(forms.ModalFormView): security_groups = [] for group in groups: - if group.id == get_int_or_uuid(self.kwargs['security_group_id']): + if group.id == filters.get_int_or_uuid( + self.kwargs['security_group_id']): security_groups.append((group.id, _("%s (current)") % group.name)) else: @@ -109,6 +108,6 @@ class AddRuleView(forms.ModalFormView): class CreateView(forms.ModalFormView): - form_class = CreateGroup + form_class = project_forms.CreateGroup template_name = 'project/access_and_security/security_groups/create.html' success_url = reverse_lazy('horizon:project:access_and_security:index') diff --git a/openstack_dashboard/dashboards/project/access_and_security/tabs.py b/openstack_dashboard/dashboards/project/access_and_security/tabs.py index 25ce80e9bb..cb87b38cd5 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/tabs.py +++ b/openstack_dashboard/dashboards/project/access_and_security/tabs.py @@ -19,7 +19,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import messages diff --git a/openstack_dashboard/dashboards/project/access_and_security/tests.py b/openstack_dashboard/dashboards/project/access_and_security/tests.py index 3f6e7bbb70..eb289c86c7 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/tests.py +++ b/openstack_dashboard/dashboards/project/access_and_security/tests.py @@ -18,14 +18,14 @@ # License for the specific language governing permissions and limitations # under the License. -from copy import deepcopy +from copy import deepcopy # noqa -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa -from horizon.workflows.views import WorkflowView +from horizon.workflows import views from openstack_dashboard import api from openstack_dashboard.test import helpers as test @@ -92,7 +92,7 @@ class AccessAndSecurityTests(test.TestCase): res = self.client.get(reverse("horizon:project:access_and_security:" "floating_ips:associate")) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) self.assertContains(res, '') diff --git a/openstack_dashboard/dashboards/project/access_and_security/urls.py b/openstack_dashboard/dashboards/project/access_and_security/urls.py index 9da63fb351..41a43bf1b6 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/urls.py +++ b/openstack_dashboard/dashboards/project/access_and_security/urls.py @@ -18,9 +18,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import include -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import include # noqa +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa from openstack_dashboard.dashboards.project.access_and_security.\ api_access import urls as api_access_urls @@ -30,12 +30,11 @@ from openstack_dashboard.dashboards.project.access_and_security.\ keypairs import urls as keypair_urls from openstack_dashboard.dashboards.project.access_and_security.\ security_groups import urls as sec_group_urls -from openstack_dashboard.dashboards.project.access_and_security.views \ - import IndexView +from openstack_dashboard.dashboards.project.access_and_security import views urlpatterns = patterns('', - url(r'^$', IndexView.as_view(), name='index'), + url(r'^$', views.IndexView.as_view(), name='index'), url(r'api_access/', include(api_access_urls, namespace='api_access')), url(r'keypairs/', include(keypair_urls, namespace='keypairs')), url(r'floating_ips/', include(fip_urls, namespace='floating_ips')), diff --git a/openstack_dashboard/dashboards/project/access_and_security/views.py b/openstack_dashboard/dashboards/project/access_and_security/views.py index ed4974d458..7dd2e720a3 100644 --- a/openstack_dashboard/dashboards/project/access_and_security/views.py +++ b/openstack_dashboard/dashboards/project/access_and_security/views.py @@ -25,10 +25,10 @@ Views for Instances and Volumes. from horizon import tabs -from openstack_dashboard.dashboards.project.access_and_security.tabs \ - import AccessAndSecurityTabs +from openstack_dashboard.dashboards.project.access_and_security \ + import tabs as project_tabs class IndexView(tabs.TabbedTableView): - tab_group_class = AccessAndSecurityTabs + tab_group_class = project_tabs.AccessAndSecurityTabs template_name = 'project/access_and_security/index.html' diff --git a/openstack_dashboard/dashboards/project/containers/browsers.py b/openstack_dashboard/dashboards/project/containers/browsers.py index 8a5174c55b..2c449507cb 100644 --- a/openstack_dashboard/dashboards/project/containers/browsers.py +++ b/openstack_dashboard/dashboards/project/containers/browsers.py @@ -14,21 +14,18 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import browsers -from openstack_dashboard.dashboards.project.containers.tables import \ - ContainersTable -from openstack_dashboard.dashboards.project.containers.tables import \ - ObjectsTable +from openstack_dashboard.dashboards.project.containers import tables class ContainerBrowser(browsers.ResourceBrowser): name = "swift" verbose_name = _("Swift") - navigation_table_class = ContainersTable - content_table_class = ObjectsTable + navigation_table_class = tables.ContainersTable + content_table_class = tables.ObjectsTable navigable_item_name = _("Container") navigation_kwarg_name = "container_name" content_kwarg_name = "subfolder_path" diff --git a/openstack_dashboard/dashboards/project/containers/forms.py b/openstack_dashboard/dashboards/project/containers/forms.py index 1a63783537..4bc0208921 100644 --- a/openstack_dashboard/dashboards/project/containers/forms.py +++ b/openstack_dashboard/dashboards/project/containers/forms.py @@ -20,17 +20,16 @@ import logging -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django.core import validators -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms from horizon import messages from openstack_dashboard import api -from openstack_dashboard.dashboards.project.containers.tables import \ - wrap_delimiter +from openstack_dashboard.dashboards.project.containers import tables LOG = logging.getLogger(__name__) @@ -145,9 +144,10 @@ class CopyObject(forms.SelfHandlingForm): except exceptions.HorizonException as exc: messages.error(request, exc) raise exceptions.Http302(reverse(index, - args=[wrap_delimiter(orig_container)])) + args=[tables.wrap_delimiter(orig_container)])) except Exception: - redirect = reverse(index, args=[wrap_delimiter(orig_container)]) + redirect = reverse(index, + args=[tables.wrap_delimiter(orig_container)]) exceptions.handle(request, _("Unable to copy object."), redirect=redirect) diff --git a/openstack_dashboard/dashboards/project/containers/panel.py b/openstack_dashboard/dashboards/project/containers/panel.py index 1f726d499c..d0673c3ea6 100644 --- a/openstack_dashboard/dashboards/project/containers/panel.py +++ b/openstack_dashboard/dashboards/project/containers/panel.py @@ -18,7 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/project/containers/tables.py b/openstack_dashboard/dashboards/project/containers/tables.py index 9757a7746a..db66de9849 100644 --- a/openstack_dashboard/dashboards/project/containers/tables.py +++ b/openstack_dashboard/dashboards/project/containers/tables.py @@ -16,23 +16,23 @@ import logging -from django.core.urlresolvers import reverse -from django.template.defaultfilters import filesizeformat +from django.core.urlresolvers import reverse # noqa +from django.template.defaultfilters import filesizeformat # noqa from django.utils import http -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables from openstack_dashboard import api -from openstack_dashboard.api.swift import FOLDER_DELIMITER +from openstack_dashboard.api import swift LOG = logging.getLogger(__name__) def wrap_delimiter(name): - if name and not name.endswith(FOLDER_DELIMITER): - return name + FOLDER_DELIMITER + if name and not name.endswith(swift.FOLDER_DELIMITER): + return name + swift.FOLDER_DELIMITER return name @@ -225,7 +225,7 @@ class ObjectFilterAction(tables.FilterAction): def sanitize_name(name): - return name.split(FOLDER_DELIMITER)[-1] + return name.split(swift.FOLDER_DELIMITER)[-1] def get_size(obj): diff --git a/openstack_dashboard/dashboards/project/containers/tests.py b/openstack_dashboard/dashboards/project/containers/tests.py index 36ea84ad34..b5a575270a 100644 --- a/openstack_dashboard/dashboards/project/containers/tests.py +++ b/openstack_dashboard/dashboards/project/containers/tests.py @@ -20,20 +20,15 @@ import tempfile -from django.core.files.uploadedfile import InMemoryUploadedFile -from django.core.urlresolvers import reverse +from django.core.files.uploadedfile import InMemoryUploadedFile # noqa +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.dashboards.project.containers import forms -from openstack_dashboard.dashboards.project.containers.tables import \ - ContainersTable -from openstack_dashboard.dashboards.project.containers.tables import \ - ObjectsTable -from openstack_dashboard.dashboards.project.containers.tables import \ - wrap_delimiter +from openstack_dashboard.dashboards.project.containers import tables from openstack_dashboard.test import helpers as test @@ -64,7 +59,7 @@ class SwiftTests(test.TestCase): action_string = u"containers__delete__%s" % container.name form_data = {"action": action_string} req = self.factory.post(CONTAINER_INDEX_URL, form_data) - table = ContainersTable(req, self.containers.list()) + table = tables.ContainersTable(req, self.containers.list()) handled = table.maybe_handle() self.assertEqual(handled['location'], CONTAINER_INDEX_URL) @@ -79,7 +74,7 @@ class SwiftTests(test.TestCase): action_string = u"containers__delete__%s" % container.name form_data = {"action": action_string} req = self.factory.post(CONTAINER_INDEX_URL, form_data) - table = ContainersTable(req, self.containers.list()) + table = tables.ContainersTable(req, self.containers.list()) handled = table.maybe_handle() self.assertEqual(handled['location'], CONTAINER_INDEX_URL) self.assertEqual(unicode(list(req._messages)[0].message), @@ -101,7 +96,7 @@ class SwiftTests(test.TestCase): res = self.client.post(reverse('horizon:project:containers:create'), formData) url = reverse('horizon:project:containers:index', - args=[wrap_delimiter(self.containers.first().name)]) + args=[tables.wrap_delimiter(self.containers.first().name)]) self.assertRedirectsNoFollow(res, url) @test.create_stubs({api.swift: ('swift_get_containers', @@ -118,9 +113,7 @@ class SwiftTests(test.TestCase): self.mox.ReplayAll() res = self.client.get(reverse('horizon:project:containers:index', - args=[wrap_delimiter(self.containers - .first() - .name)])) + args=[tables.wrap_delimiter(self.containers.first().name)])) self.assertTemplateUsed(res, 'project/containers/index.html') # UTF8 encoding here to ensure there aren't problems with Nose output. expected = [obj.name.encode('utf8') for obj in self.objects.list()] @@ -161,7 +154,7 @@ class SwiftTests(test.TestCase): res = self.client.post(upload_url, formData) index_url = reverse('horizon:project:containers:index', - args=[wrap_delimiter(container.name)]) + args=[tables.wrap_delimiter(container.name)]) self.assertRedirectsNoFollow(res, index_url) @test.create_stubs({api.swift: ('swift_delete_object',)}) @@ -169,7 +162,7 @@ class SwiftTests(test.TestCase): container = self.containers.first() obj = self.objects.first() index_url = reverse('horizon:project:containers:index', - args=[wrap_delimiter(container.name)]) + args=[tables.wrap_delimiter(container.name)]) api.swift.swift_delete_object(IsA(http.HttpRequest), container.name, obj.name) @@ -179,7 +172,7 @@ class SwiftTests(test.TestCase): form_data = {"action": action_string} req = self.factory.post(index_url, form_data) kwargs = {"container_name": container.name} - table = ObjectsTable(req, self.objects.list(), **kwargs) + table = tables.ObjectsTable(req, self.objects.list(), **kwargs) handled = table.maybe_handle() self.assertEqual(handled['location'], index_url) @@ -235,7 +228,7 @@ class SwiftTests(test.TestCase): args=[container_1.name, obj.name]) res = self.client.post(copy_url, formData) index_url = reverse('horizon:project:containers:index', - args=[wrap_delimiter(container_2.name)]) + args=[tables.wrap_delimiter(container_2.name)]) self.assertRedirectsNoFollow(res, index_url) @test.create_stubs({api.swift: ('swift_get_container', )}) diff --git a/openstack_dashboard/dashboards/project/containers/urls.py b/openstack_dashboard/dashboards/project/containers/urls.py index dc93a212d5..08f694a4c3 100644 --- a/openstack_dashboard/dashboards/project/containers/urls.py +++ b/openstack_dashboard/dashboards/project/containers/urls.py @@ -18,18 +18,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.containers.views import \ - ContainerDetailView -from openstack_dashboard.dashboards.project.containers.views import \ - ContainerView -from openstack_dashboard.dashboards.project.containers.views import CopyView -from openstack_dashboard.dashboards.project.containers.views import CreateView -from openstack_dashboard.dashboards.project.containers.views import \ - ObjectDetailView -from openstack_dashboard.dashboards.project.containers.views import UploadView +from openstack_dashboard.dashboards.project.containers import views VIEW_MOD = 'openstack_dashboard.dashboards.project.containers.views' @@ -37,29 +29,29 @@ VIEW_MOD = 'openstack_dashboard.dashboards.project.containers.views' # Swift containers and objects. urlpatterns = patterns(VIEW_MOD, url(r'^((?P.+?)/)?(?P(.+/)+)?$', - ContainerView.as_view(), name='index'), + views.ContainerView.as_view(), name='index'), url(r'^(?P(.+/)+)?create$', - CreateView.as_view(), + views.CreateView.as_view(), name='create'), url(r'^(?P.+?)/(?P(.+/)+)' '?container_detail$', - ContainerDetailView.as_view(), + views.ContainerDetailView.as_view(), name='container_detail'), url(r'^(?P[^/]+)/(?P.+)/object_detail$', - ObjectDetailView.as_view(), + views.ObjectDetailView.as_view(), name='object_detail'), url(r'^(?P.+?)/(?P(.+/)+)?upload$', - UploadView.as_view(), + views.UploadView.as_view(), name='object_upload'), url(r'^(?P[^/]+)/' r'(?P(.+/)+)?' r'(?P.+)/copy$', - CopyView.as_view(), + views.CopyView.as_view(), name='object_copy'), url(r'^(?P[^/]+)/(?P.+)/download$', diff --git a/openstack_dashboard/dashboards/project/containers/views.py b/openstack_dashboard/dashboards/project/containers/views.py index a27e64164c..df7e2150fb 100644 --- a/openstack_dashboard/dashboards/project/containers/views.py +++ b/openstack_dashboard/dashboards/project/containers/views.py @@ -22,9 +22,9 @@ Views for managing Swift containers. """ -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from django.views import generic from horizon import browsers @@ -32,22 +32,18 @@ from horizon import exceptions from horizon import forms from openstack_dashboard import api -from openstack_dashboard.api.swift import FOLDER_DELIMITER -from openstack_dashboard.dashboards.project.containers.browsers \ - import ContainerBrowser -from openstack_dashboard.dashboards.project.containers.forms import CopyObject -from openstack_dashboard.dashboards.project.containers.forms \ - import CreateContainer -from openstack_dashboard.dashboards.project.containers.forms \ - import UploadObject -from openstack_dashboard.dashboards.project.containers.tables \ - import wrap_delimiter +from openstack_dashboard.api import swift +from openstack_dashboard.dashboards.project.containers \ + import browsers as project_browsers +from openstack_dashboard.dashboards.project.containers \ + import forms as project_forms +from openstack_dashboard.dashboards.project.containers import tables import os class ContainerView(browsers.ResourceBrowserView): - browser_class = ContainerBrowser + browser_class = project_browsers.ContainerBrowser template_name = "project/containers/index.html" def get_containers_data(self): @@ -124,21 +120,22 @@ class ContainerView(browsers.ResourceBrowserView): class CreateView(forms.ModalFormView): - form_class = CreateContainer + form_class = project_forms.CreateContainer template_name = 'project/containers/create.html' success_url = "horizon:project:containers:index" def get_success_url(self): parent = self.request.POST.get('parent', None) if parent: - container, slash, remainder = parent.partition(FOLDER_DELIMITER) - container += FOLDER_DELIMITER - if remainder and not remainder.endswith(FOLDER_DELIMITER): - remainder = "".join([remainder, FOLDER_DELIMITER]) + container, slash, remainder = parent.partition( + swift.FOLDER_DELIMITER) + container += swift.FOLDER_DELIMITER + if remainder and not remainder.endswith(swift.FOLDER_DELIMITER): + remainder = "".join([remainder, swift.FOLDER_DELIMITER]) return reverse(self.success_url, args=(container, remainder)) else: return reverse(self.success_url, args=[self.request.POST['name'] + - FOLDER_DELIMITER]) + swift.FOLDER_DELIMITER]) def get_initial(self): initial = super(CreateView, self).get_initial() @@ -147,14 +144,14 @@ class CreateView(forms.ModalFormView): class UploadView(forms.ModalFormView): - form_class = UploadObject + form_class = project_forms.UploadObject template_name = 'project/containers/upload.html' success_url = "horizon:project:containers:index" def get_success_url(self): container_name = self.request.POST['container_name'] return reverse(self.success_url, - args=(wrap_delimiter(container_name), + args=(tables.wrap_delimiter(container_name), self.request.POST.get('path', ''))) def get_initial(self): @@ -177,7 +174,7 @@ def object_download(request, container_name, object_path): redirect=redirect) # Add the original file extension back on if it wasn't preserved in the # name given to the object. - filename = object_path.rsplit(FOLDER_DELIMITER)[-1] + filename = object_path.rsplit(swift.FOLDER_DELIMITER)[-1] if not os.path.splitext(obj.name)[1] and obj.orig_name: name, ext = os.path.splitext(obj.orig_name) filename = "%s%s" % (filename, ext) @@ -190,16 +187,16 @@ def object_download(request, container_name, object_path): class CopyView(forms.ModalFormView): - form_class = CopyObject + form_class = project_forms.CopyObject template_name = 'project/containers/copy.html' success_url = "horizon:project:containers:index" def get_success_url(self): new_container_name = self.request.POST['new_container_name'] return reverse(self.success_url, - args=(wrap_delimiter(new_container_name), - wrap_delimiter(self.request.POST.get('path', - '')))) + args=(tables.wrap_delimiter(new_container_name), + tables.wrap_delimiter( + self.request.POST.get('path', '')))) def get_form_kwargs(self): kwargs = super(CopyView, self).get_form_kwargs() diff --git a/openstack_dashboard/dashboards/project/dashboard.py b/openstack_dashboard/dashboards/project/dashboard.py index 673acdd3c1..a18fea439a 100644 --- a/openstack_dashboard/dashboards/project/dashboard.py +++ b/openstack_dashboard/dashboards/project/dashboard.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/images/forms.py b/openstack_dashboard/dashboards/project/images_and_snapshots/images/forms.py index 1f64982db7..d4ecf761b9 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/images/forms.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/images/forms.py @@ -24,10 +24,10 @@ Views for managing images. import logging -from django.conf import settings -from django.forms import ValidationError -from django.forms.widgets import HiddenInput -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.forms import ValidationError # noqa +from django.forms.widgets import HiddenInput # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/images/tables.py b/openstack_dashboard/dashboards/project/images_and_snapshots/images/tables.py index d2871f561b..10d4594892 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/images/tables.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/images/tables.py @@ -14,17 +14,17 @@ # License for the specific language governing permissions and limitations # under the License. -from collections import defaultdict +from collections import defaultdict # noqa import logging -from django.conf import settings -from django.core.urlresolvers import reverse +from django.conf import settings # noqa +from django.core.urlresolvers import reverse # noqa from django.template import defaultfilters as filters -from django.utils.http import urlencode -from django.utils.translation import ugettext_lazy as _ +from django.utils.http import urlencode # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables -from horizon.utils.memoized import memoized +from horizon.utils.memoized import memoized # noqa from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/images/tabs.py b/openstack_dashboard/dashboards/project/images_and_snapshots/images/tabs.py index 2355ebdad3..3a195b8313 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/images/tabs.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/images/tabs.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/images/tests.py b/openstack_dashboard/dashboards/project/images_and_snapshots/images/tests.py index 585804cb84..f5024e86e8 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/images/tests.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/images/tests.py @@ -20,21 +20,21 @@ import tempfile -from django.conf import settings -from django.core.files.uploadedfile import InMemoryUploadedFile -from django.core.urlresolvers import reverse -from django.forms.widgets import HiddenInput +from django.conf import settings # noqa +from django.core.files.uploadedfile import InMemoryUploadedFile # noqa +from django.core.urlresolvers import reverse # noqa +from django.forms.widgets import HiddenInput # noqa from django import http -from django.test.utils import override_settings +from django.test.utils import override_settings # noqa -from mox import IsA +from mox import IsA # noqa from horizon import tables as horizon_tables from openstack_dashboard import api from openstack_dashboard.test import helpers as test -from openstack_dashboard.dashboards.project.images_and_snapshots.images.forms \ - import CreateImageForm +from openstack_dashboard.dashboards.project.images_and_snapshots.images \ + import forms from openstack_dashboard.dashboards.project.images_and_snapshots.images \ import tables @@ -57,7 +57,7 @@ class CreateImageFormTests(test.TestCase): 'minimum_ram': 512, 'is_public': 1} files = {} - form = CreateImageForm(post, files) + form = forms.CreateImageForm(post, files) self.assertEqual(form.is_valid(), False) @override_settings(HORIZON_IMAGES_ALLOW_UPLOAD=False) @@ -66,7 +66,7 @@ class CreateImageFormTests(test.TestCase): If HORIZON_IMAGES_ALLOW_UPLOAD is false, the image_file field widget will be a HiddenInput widget instead of a FileInput widget. """ - form = CreateImageForm({}) + form = forms.CreateImageForm({}) self.assertEqual( isinstance(form.fields['image_file'].widget, HiddenInput), True) diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/images/urls.py b/openstack_dashboard/dashboards/project/images_and_snapshots/images/urls.py index 7ba26d8900..a4b97871e4 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/images/urls.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/images/urls.py @@ -18,15 +18,11 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.images_and_snapshots.images.views \ - import CreateView -from openstack_dashboard.dashboards.project.images_and_snapshots.images.views \ - import DetailView -from openstack_dashboard.dashboards.project.images_and_snapshots.images.views \ - import UpdateView +from openstack_dashboard.dashboards.project.images_and_snapshots.images \ + import views VIEWS_MOD = ('openstack_dashboard.dashboards.project' @@ -34,7 +30,8 @@ VIEWS_MOD = ('openstack_dashboard.dashboards.project' urlpatterns = patterns(VIEWS_MOD, - url(r'^create/$', CreateView.as_view(), name='create'), - url(r'^(?P[^/]+)/update/$', UpdateView.as_view(), name='update'), - url(r'^(?P[^/]+)/$', DetailView.as_view(), name='detail'), + url(r'^create/$', views.CreateView.as_view(), name='create'), + url(r'^(?P[^/]+)/update/$', + views.UpdateView.as_view(), name='update'), + url(r'^(?P[^/]+)/$', views.DetailView.as_view(), name='detail'), ) diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/images/views.py b/openstack_dashboard/dashboards/project/images_and_snapshots/images/views.py index 066c5751c1..9c2c174db9 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/images/views.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/images/views.py @@ -24,9 +24,9 @@ Views for managing images. import logging -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -34,26 +34,24 @@ from horizon import tabs from openstack_dashboard import api -from openstack_dashboard.dashboards.project.images_and_snapshots.images.forms \ - import CreateImageForm -from openstack_dashboard.dashboards.project.images_and_snapshots.images.forms \ - import UpdateImageForm -from openstack_dashboard.dashboards.project.images_and_snapshots.images.tabs \ - import ImageDetailTabs +from openstack_dashboard.dashboards.project.images_and_snapshots.images \ + import forms as project_forms +from openstack_dashboard.dashboards.project.images_and_snapshots.images \ + import tabs as project_tabs LOG = logging.getLogger(__name__) class CreateView(forms.ModalFormView): - form_class = CreateImageForm + form_class = project_forms.CreateImageForm template_name = 'project/images_and_snapshots/images/create.html' context_object_name = 'image' success_url = reverse_lazy("horizon:project:images_and_snapshots:index") class UpdateView(forms.ModalFormView): - form_class = UpdateImageForm + form_class = project_forms.UpdateImageForm template_name = 'project/images_and_snapshots/images/update.html' success_url = reverse_lazy("horizon:project:images_and_snapshots:index") @@ -87,5 +85,5 @@ class UpdateView(forms.ModalFormView): class DetailView(tabs.TabView): - tab_group_class = ImageDetailTabs + tab_group_class = project_tabs.ImageDetailTabs template_name = 'project/images_and_snapshots/images/detail.html' diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/panel.py b/openstack_dashboard/dashboards/project/images_and_snapshots/panel.py index 9746bb82f9..95cd195092 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/panel.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/panel.py @@ -15,7 +15,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/forms.py b/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/forms.py index bab32a5d7b..b6694ed487 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/forms.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/forms.py @@ -20,8 +20,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/tests.py b/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/tests.py index 55982dd580..d2cbd86518 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/tests.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/tests.py @@ -18,10 +18,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/urls.py b/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/urls.py index b7bf675d7c..4bbd302c28 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/urls.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/urls.py @@ -18,15 +18,15 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.images_and_snapshots.\ - snapshots.views import CreateView +from openstack_dashboard.dashboards.project.images_and_snapshots.snapshots \ + import views urlpatterns = patterns('', url(r'^(?P[^/]+)/create', - CreateView.as_view(), + views.CreateView.as_view(), name='create') ) diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/views.py b/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/views.py index 464f8eb05e..a5daf67c7d 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/views.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/snapshots/views.py @@ -24,24 +24,24 @@ Views for managing instance snapshots. import logging -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms from openstack_dashboard import api -from openstack_dashboard.dashboards.project.images_and_snapshots.\ - snapshots.forms import CreateSnapshot +from openstack_dashboard.dashboards.project.images_and_snapshots.snapshots \ + import forms as project_forms LOG = logging.getLogger(__name__) class CreateView(forms.ModalFormView): - form_class = CreateSnapshot + form_class = project_forms.CreateSnapshot template_name = 'project/images_and_snapshots/snapshots/create.html' success_url = reverse_lazy("horizon:project:images_and_snapshots:index") diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/tests.py b/openstack_dashboard/dashboards/project/images_and_snapshots/tests.py index ed10d44de8..3575c9dd79 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/tests.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/tests.py @@ -19,10 +19,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/urls.py b/openstack_dashboard/dashboards/project/images_and_snapshots/urls.py index 2e2b4cd655..b8900021e7 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/urls.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/urls.py @@ -18,25 +18,22 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import include -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import include # noqa +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa from openstack_dashboard.dashboards.project.images_and_snapshots.images \ import urls as image_urls from openstack_dashboard.dashboards.project.images_and_snapshots.snapshots \ import urls as snapshot_urls -from openstack_dashboard.dashboards.project.images_and_snapshots.views \ - import DetailView -from openstack_dashboard.dashboards.project.images_and_snapshots.views \ - import IndexView +from openstack_dashboard.dashboards.project.images_and_snapshots import views urlpatterns = patterns('', - url(r'^$', IndexView.as_view(), name='index'), + url(r'^$', views.IndexView.as_view(), name='index'), url(r'', include(image_urls, namespace='images')), url(r'', include(snapshot_urls, namespace='snapshots')), url(r'^snapshots/(?P[^/]+)/$', - DetailView.as_view(), + views.DetailView.as_view(), name='detail'), ) diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/utils.py b/openstack_dashboard/dashboards/project/images_and_snapshots/utils.py index 4e476917a9..8f1716a80a 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/utils.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/utils.py @@ -1,4 +1,4 @@ -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/views.py b/openstack_dashboard/dashboards/project/images_and_snapshots/views.py index 22d18b08d9..da1fea9f43 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/views.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/views.py @@ -25,34 +25,36 @@ Views for managing Images and Snapshots. import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables from horizon import tabs from openstack_dashboard import api -from openstack_dashboard.api.base import is_service_enabled +from openstack_dashboard.api import base +from openstack_dashboard.dashboards.project.images_and_snapshots.images \ + import tables as images_tables from openstack_dashboard.dashboards.project.images_and_snapshots.\ - images.tables import ImagesTable + volume_snapshots import tables as vol_snsh_tables from openstack_dashboard.dashboards.project.images_and_snapshots.\ - volume_snapshots.tables import VolumeSnapshotsTable -from openstack_dashboard.dashboards.project.images_and_snapshots.\ - volume_snapshots.tabs import SnapshotDetailTabs + volume_snapshots import tabs as vol_snsh_tabs LOG = logging.getLogger(__name__) class IndexView(tables.MultiTableView): - table_classes = (ImagesTable, VolumeSnapshotsTable) + table_classes = (images_tables.ImagesTable, + vol_snsh_tables.VolumeSnapshotsTable) template_name = 'project/images_and_snapshots/index.html' def has_more_data(self, table): return getattr(self, "_more_%s" % table.name, False) def get_images_data(self): - marker = self.request.GET.get(ImagesTable._meta.pagination_param, None) + marker = self.request.GET.get( + images_tables.ImagesTable._meta.pagination_param, None) try: # FIXME(gabriel): The paging is going to be strange here due to # our filtering after the fact. @@ -67,7 +69,7 @@ class IndexView(tables.MultiTableView): return images def get_volume_snapshots_data(self): - if is_service_enabled(self.request, 'volume'): + if base.is_service_enabled(self.request, 'volume'): try: snapshots = api.cinder.volume_snapshot_list(self.request) except Exception: @@ -80,5 +82,5 @@ class IndexView(tables.MultiTableView): class DetailView(tabs.TabView): - tab_group_class = SnapshotDetailTabs + tab_group_class = vol_snsh_tabs.SnapshotDetailTabs template_name = 'project/images_and_snapshots/snapshots/detail.html' diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tables.py b/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tables.py index a3816d4925..27f9a8e0c3 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tables.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tables.py @@ -16,10 +16,10 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.http import urlencode +from django.core.urlresolvers import reverse # noqa +from django.utils.http import urlencode # noqa from django.utils import safestring -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tabs.py b/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tabs.py index 41967bc019..a5cb1cc358 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tabs.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tabs.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs diff --git a/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tests.py b/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tests.py index 74b7a18078..76b00f26d0 100644 --- a/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tests.py +++ b/openstack_dashboard/dashboards/project/images_and_snapshots/volume_snapshots/tests.py @@ -18,9 +18,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.api import cinder diff --git a/openstack_dashboard/dashboards/project/instances/forms.py b/openstack_dashboard/dashboards/project/instances/forms.py index ec24024f55..3575d682a0 100644 --- a/openstack_dashboard/dashboards/project/instances/forms.py +++ b/openstack_dashboard/dashboards/project/instances/forms.py @@ -15,20 +15,19 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse -from django.template.defaultfilters import filesizeformat -from django.utils.translation import ugettext_lazy as _ -from django.views.decorators.debug import sensitive_variables +from django.core.urlresolvers import reverse # noqa +from django.template.defaultfilters import filesizeformat # noqa +from django.utils.translation import ugettext_lazy as _ # noqa +from django.views.decorators.debug import sensitive_variables # noqa from horizon import exceptions from horizon import forms from horizon import messages -from horizon.utils.fields import SelectWidget +from horizon.utils.fields import SelectWidget # noqa from horizon.utils import validators from openstack_dashboard import api -from openstack_dashboard.dashboards.project.images_and_snapshots.utils \ - import get_available_images +from openstack_dashboard.dashboards.project.images_and_snapshots import utils def _image_choice_title(img): @@ -56,7 +55,7 @@ class RebuildInstanceForm(forms.SelfHandlingForm): instance_id = kwargs.get('initial', {}).get('instance_id') self.fields['instance_id'].initial = instance_id - images = get_available_images(request, request.user.tenant_id) + images = utils.get_available_images(request, request.user.tenant_id) choices = [(image.id, image.name) for image in images] if choices: choices.insert(0, ("", _("Select Image"))) diff --git a/openstack_dashboard/dashboards/project/instances/panel.py b/openstack_dashboard/dashboards/project/instances/panel.py index c204973ed4..86430ffa01 100644 --- a/openstack_dashboard/dashboards/project/instances/panel.py +++ b/openstack_dashboard/dashboards/project/instances/panel.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/project/instances/tables.py b/openstack_dashboard/dashboards/project/instances/tables.py index c61300fe1a..c1757ef6f0 100644 --- a/openstack_dashboard/dashboards/project/instances/tables.py +++ b/openstack_dashboard/dashboards/project/instances/tables.py @@ -20,27 +20,24 @@ import logging from django.core import urlresolvers from django import shortcuts from django import template -from django.template.defaultfilters import timesince -from django.template.defaultfilters import title -from django.utils.http import urlencode -from django.utils.translation import string_concat -from django.utils.translation import ugettext_lazy as _ +from django.template.defaultfilters import timesince # noqa +from django.template.defaultfilters import title # noqa +from django.utils.http import urlencode # noqa +from django.utils.translation import string_concat # noqa +from django.utils.translation import ugettext_lazy as _ # noqa -from horizon.conf import HORIZON_CONFIG +from horizon.conf import HORIZON_CONFIG # noqa from horizon import exceptions from horizon import messages from horizon import tables from horizon.templatetags import sizeformat -from horizon.utils.filters import parse_isotime -from horizon.utils.filters import replace_underscores +from horizon.utils.filters import parse_isotime # noqa +from horizon.utils.filters import replace_underscores # noqa from openstack_dashboard import api -from openstack_dashboard.dashboards.project.access_and_security \ - .floating_ips.workflows import IPAssociationWorkflow -from openstack_dashboard.dashboards.project.instances.tabs import ConsoleTab -from openstack_dashboard.dashboards.project.instances.tabs import \ - InstanceDetailTabs -from openstack_dashboard.dashboards.project.instances.tabs import LogTab +from openstack_dashboard.dashboards.project.access_and_security.floating_ips \ + import workflows +from openstack_dashboard.dashboards.project.instances import tabs LOG = logging.getLogger(__name__) @@ -269,7 +266,8 @@ class ConsoleLink(tables.LinkAction): def get_link_url(self, datum): base_url = super(ConsoleLink, self).get_link_url(datum) - tab_query_string = ConsoleTab(InstanceDetailTabs).get_query_string() + tab_query_string = tabs.ConsoleTab( + tabs.InstanceDetailTabs).get_query_string() return "?".join([base_url, tab_query_string]) @@ -284,7 +282,8 @@ class LogLink(tables.LinkAction): def get_link_url(self, datum): base_url = super(LogLink, self).get_link_url(datum) - tab_query_string = LogTab(InstanceDetailTabs).get_query_string() + tab_query_string = tabs.LogTab( + tabs.InstanceDetailTabs).get_query_string() return "?".join([base_url, tab_query_string]) @@ -364,7 +363,7 @@ class AssociateIP(tables.LinkAction): base_url = urlresolvers.reverse(self.url) next = urlresolvers.reverse("horizon:project:instances:index") params = {"instance_id": self.table.get_object_id(datum), - IPAssociationWorkflow.redirect_param_name: next} + workflows.IPAssociationWorkflow.redirect_param_name: next} params = urlencode(params) return "?".join([base_url, params]) diff --git a/openstack_dashboard/dashboards/project/instances/tabs.py b/openstack_dashboard/dashboards/project/instances/tabs.py index 4caa7d4be3..362cbd86f6 100644 --- a/openstack_dashboard/dashboards/project/instances/tabs.py +++ b/openstack_dashboard/dashboards/project/instances/tabs.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf import settings -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs diff --git a/openstack_dashboard/dashboards/project/instances/tests.py b/openstack_dashboard/dashboards/project/instances/tests.py index 8b7cb97983..0f43096861 100644 --- a/openstack_dashboard/dashboards/project/instances/tests.py +++ b/openstack_dashboard/dashboards/project/instances/tests.py @@ -20,32 +20,29 @@ import uuid -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from django.utils.datastructures import SortedDict -from django.utils.http import urlencode +from django.utils.datastructures import SortedDict # noqa +from django.utils.http import urlencode # noqa -from mox import IgnoreArg -from mox import IsA +from mox import IgnoreArg # noqa +from mox import IsA # noqa -from horizon.workflows.views import WorkflowView +from horizon.workflows import views from openstack_dashboard import api from openstack_dashboard.api import cinder from openstack_dashboard.test import helpers as test from openstack_dashboard.usage import quotas -from openstack_dashboard.dashboards.project.instances.tables import LaunchLink -from openstack_dashboard.dashboards.project.instances.tabs \ - import InstanceDetailTabs -from openstack_dashboard.dashboards.project.instances.workflows \ - import LaunchInstance -from openstack_dashboard.dashboards.project.instances.workflows \ - import update_instance +from openstack_dashboard.dashboards.project.instances import tables +from openstack_dashboard.dashboards.project.instances import tabs +from openstack_dashboard.dashboards.project.instances import workflows INDEX_URL = reverse('horizon:project:instances:index') -SEC_GROUP_ROLE_PREFIX = update_instance.INSTANCE_SEC_GROUP_SLUG + "_role_" +SEC_GROUP_ROLE_PREFIX = \ + workflows.update_instance.INSTANCE_SEC_GROUP_SLUG + "_role_" class InstanceTests(test.TestCase): @@ -533,7 +530,7 @@ class InstanceTests(test.TestCase): url = reverse('horizon:project:instances:detail', args=[server.id]) - tg = InstanceDetailTabs(self.request, instance=server) + tg = tabs.InstanceDetailTabs(self.request, instance=server) qs = "?%s=%s" % (tg.param_name, tg.get_tab("overview").get_id()) res = self.client.get(url + qs) @@ -559,7 +556,7 @@ class InstanceTests(test.TestCase): url = reverse('horizon:project:instances:console', args=[server.id]) - tg = InstanceDetailTabs(self.request, instance=server) + tg = tabs.InstanceDetailTabs(self.request, instance=server) qs = "?%s=%s" % (tg.param_name, tg.get_tab("log").get_id()) res = self.client.get(url + qs) @@ -579,7 +576,7 @@ class InstanceTests(test.TestCase): url = reverse('horizon:project:instances:console', args=[server.id]) - tg = InstanceDetailTabs(self.request, instance=server) + tg = tabs.InstanceDetailTabs(self.request, instance=server) qs = "?%s=%s" % (tg.param_name, tg.get_tab("log").get_id()) res = self.client.get(url + qs) @@ -707,7 +704,7 @@ class InstanceTests(test.TestCase): url = reverse('horizon:project:instances:update', args=[server.id]) res = self.client.get(url) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) @test.create_stubs(instance_update_get_stubs) def test_instance_update_get_server_get_exception(self): @@ -726,7 +723,7 @@ class InstanceTests(test.TestCase): def _instance_update_post(self, server_id, server_name, secgroups): default_role_field_name = 'default_' + \ - update_instance.INSTANCE_SEC_GROUP_SLUG + '_role' + workflows.update_instance.INSTANCE_SEC_GROUP_SLUG + '_role' formData = {'name': server_name, default_role_field_name: 'member', SEC_GROUP_ROLE_PREFIX + 'member': secgroups} @@ -861,8 +858,9 @@ class InstanceTests(test.TestCase): res = self.client.get("%s?%s" % (url, params)) workflow = res.context['workflow'] - self.assertTemplateUsed(res, WorkflowView.template_name) - self.assertEqual(res.context['workflow'].name, LaunchInstance.name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) + self.assertEqual(res.context['workflow'].name, + workflows.LaunchInstance.name) step = workflow.get_step("setinstancedetailsaction") self.assertEqual(step.action.initial['image_id'], image.id) self.assertQuerysetEqual(workflow.steps, @@ -1033,7 +1031,7 @@ class InstanceTests(test.TestCase): "Volume. The Volume is your " "source and should contain " "the operating system.") - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) @test.create_stubs({api.glance: ('image_list_detailed',), api.neutron: ('network_list',), @@ -1281,7 +1279,7 @@ class InstanceTests(test.TestCase): "create an image before " "attemtping to launch an " "instance.") - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) @test.create_stubs({api.glance: ('image_list_detailed',), api.neutron: ('network_list',), @@ -1330,7 +1328,7 @@ class InstanceTests(test.TestCase): url = reverse('horizon:project:instances:launch') res = self.client.get(url) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) @test.create_stubs({api.glance: ('image_list_detailed',), api.neutron: ('network_list',), @@ -1509,7 +1507,7 @@ class InstanceTests(test.TestCase): self.mox.ReplayAll() - launch = LaunchLink() + launch = tables.LaunchLink() url = launch.get_link_url() classes = list(launch.get_default_classes()) + list(launch.classes) link_name = "%s (%s)" % (unicode(launch.verbose_name), @@ -1677,7 +1675,7 @@ class InstanceTests(test.TestCase): url = reverse('horizon:project:instances:resize', args=[server.id]) res = self.client.get(url) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) @test.create_stubs({api.nova: ('server_get', 'flavor_list',)}) diff --git a/openstack_dashboard/dashboards/project/instances/urls.py b/openstack_dashboard/dashboards/project/instances/urls.py index 0558340350..b2eec83b07 100644 --- a/openstack_dashboard/dashboards/project/instances/urls.py +++ b/openstack_dashboard/dashboards/project/instances/urls.py @@ -18,16 +18,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.instances.views import DetailView -from openstack_dashboard.dashboards.project.instances.views import IndexView -from openstack_dashboard.dashboards.project.instances.views import \ - LaunchInstanceView -from openstack_dashboard.dashboards.project.instances.views import RebuildView -from openstack_dashboard.dashboards.project.instances.views import ResizeView -from openstack_dashboard.dashboards.project.instances.views import UpdateView +from openstack_dashboard.dashboards.project.instances import views INSTANCES = r'^(?P[^/]+)/%s$' @@ -35,13 +29,14 @@ VIEW_MOD = 'openstack_dashboard.dashboards.project.instances.views' urlpatterns = patterns(VIEW_MOD, - url(r'^$', IndexView.as_view(), name='index'), - url(r'^launch$', LaunchInstanceView.as_view(), name='launch'), - url(r'^(?P[^/]+)/$', DetailView.as_view(), name='detail'), - url(INSTANCES % 'update', UpdateView.as_view(), name='update'), - url(INSTANCES % 'rebuild', RebuildView.as_view(), name='rebuild'), + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^launch$', views.LaunchInstanceView.as_view(), name='launch'), + url(r'^(?P[^/]+)/$', + views.DetailView.as_view(), name='detail'), + url(INSTANCES % 'update', views.UpdateView.as_view(), name='update'), + url(INSTANCES % 'rebuild', views.RebuildView.as_view(), name='rebuild'), url(INSTANCES % 'console', 'console', name='console'), url(INSTANCES % 'vnc', 'vnc', name='vnc'), url(INSTANCES % 'spice', 'spice', name='spice'), - url(INSTANCES % 'resize', ResizeView.as_view(), name='resize'), + url(INSTANCES % 'resize', views.ResizeView.as_view(), name='resize'), ) diff --git a/openstack_dashboard/dashboards/project/instances/views.py b/openstack_dashboard/dashboards/project/instances/views.py index 3403548ab2..3a96aba435 100644 --- a/openstack_dashboard/dashboards/project/instances/views.py +++ b/openstack_dashboard/dashboards/project/instances/views.py @@ -23,12 +23,12 @@ Views for managing instances. """ import logging -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy +from django.core.urlresolvers import reverse # noqa +from django.core.urlresolvers import reverse_lazy # noqa from django import http from django import shortcuts -from django.utils.datastructures import SortedDict -from django.utils.translation import ugettext_lazy as _ +from django.utils.datastructures import SortedDict # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -37,25 +37,21 @@ from horizon import tabs from horizon import workflows from openstack_dashboard import api -from openstack_dashboard.dashboards.project.instances.forms import \ - RebuildInstanceForm -from openstack_dashboard.dashboards.project.instances.tables import \ - InstancesTable -from openstack_dashboard.dashboards.project.instances.tabs import \ - InstanceDetailTabs -from openstack_dashboard.dashboards.project.instances.workflows import \ - LaunchInstance -from openstack_dashboard.dashboards.project.instances.workflows import \ - ResizeInstance -from openstack_dashboard.dashboards.project.instances.workflows import \ - UpdateInstance +from openstack_dashboard.dashboards.project.instances \ + import forms as project_forms +from openstack_dashboard.dashboards.project.instances \ + import tables as project_tables +from openstack_dashboard.dashboards.project.instances \ + import tabs as project_tabs +from openstack_dashboard.dashboards.project.instances \ + import workflows as project_workflows LOG = logging.getLogger(__name__) class IndexView(tables.DataTableView): - table_class = InstancesTable + table_class = project_tables.InstancesTable template_name = 'project/instances/index.html' def has_more_data(self, table): @@ -63,7 +59,7 @@ class IndexView(tables.DataTableView): def get_data(self): marker = self.request.GET.get( - InstancesTable._meta.pagination_param, None) + project_tables.InstancesTable._meta.pagination_param, None) # Gather our instances try: instances, self._more = api.nova.server_list( @@ -103,7 +99,7 @@ class IndexView(tables.DataTableView): class LaunchInstanceView(workflows.WorkflowView): - workflow_class = LaunchInstance + workflow_class = project_workflows.LaunchInstance def get_initial(self): initial = super(LaunchInstanceView, self).get_initial() @@ -153,7 +149,7 @@ def spice(request, instance_id): class UpdateView(workflows.WorkflowView): - workflow_class = UpdateInstance + workflow_class = project_workflows.UpdateInstance success_url = reverse_lazy("horizon:project:instances:index") def get_context_data(self, **kwargs): @@ -180,7 +176,7 @@ class UpdateView(workflows.WorkflowView): class RebuildView(forms.ModalFormView): - form_class = RebuildInstanceForm + form_class = project_forms.RebuildInstanceForm template_name = 'project/instances/rebuild.html' success_url = reverse_lazy('horizon:project:instances:index') @@ -194,7 +190,7 @@ class RebuildView(forms.ModalFormView): class DetailView(tabs.TabView): - tab_group_class = InstanceDetailTabs + tab_group_class = project_tabs.InstanceDetailTabs template_name = 'project/instances/detail.html' def get_context_data(self, **kwargs): @@ -230,7 +226,7 @@ class DetailView(tabs.TabView): class ResizeView(workflows.WorkflowView): - workflow_class = ResizeInstance + workflow_class = project_workflows.ResizeInstance success_url = reverse_lazy("horizon:project:instances:index") def get_context_data(self, **kwargs): diff --git a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py index d5a14f9662..e45a951ced 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/create_instance.py @@ -21,12 +21,12 @@ import json import logging -from django.conf import settings -from django.utils.text import normalize_newlines -from django.utils.translation import ugettext_lazy as _ -from django.utils.translation import ungettext_lazy +from django.conf import settings # noqa +from django.utils.text import normalize_newlines # noqa +from django.utils.translation import ugettext_lazy as _ # noqa +from django.utils.translation import ungettext_lazy # noqa -from django.views.decorators.debug import sensitive_variables +from django.views.decorators.debug import sensitive_variables # noqa from horizon import exceptions from horizon import forms @@ -37,8 +37,7 @@ from openstack_dashboard import api from openstack_dashboard.api import cinder from openstack_dashboard.usage import quotas -from openstack_dashboard.dashboards.project.images_and_snapshots.utils \ - import get_available_images +from openstack_dashboard.dashboards.project.images_and_snapshots import utils LOG = logging.getLogger(__name__) @@ -258,7 +257,7 @@ class SetInstanceDetailsAction(workflows.Action): def populate_image_id_choices(self, request, context): self._init_images_cache() - images = get_available_images(request, context.get('project_id'), + images = utils.get_available_images(request, context.get('project_id'), self._images_cache) choices = [(image.id, image.name) for image in images @@ -271,7 +270,7 @@ class SetInstanceDetailsAction(workflows.Action): def populate_instance_snapshot_id_choices(self, request, context): self._init_images_cache() - images = get_available_images(request, context.get('project_id'), + images = utils.get_available_images(request, context.get('project_id'), self._images_cache) choices = [(image.id, image.name) for image in images diff --git a/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py index 31362c92cc..9dd00ac1f7 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py @@ -18,8 +18,8 @@ import json import logging -from django.utils.translation import ugettext_lazy as _ -from django.views.decorators.debug import sensitive_variables +from django.utils.translation import ugettext_lazy as _ # noqa +from django.views.decorators.debug import sensitive_variables # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/instances/workflows/update_instance.py b/openstack_dashboard/dashboards/project/instances/workflows/update_instance.py index fbb6420c82..8d90c86c3a 100644 --- a/openstack_dashboard/dashboards/project/instances/workflows/update_instance.py +++ b/openstack_dashboard/dashboards/project/instances/workflows/update_instance.py @@ -19,14 +19,14 @@ # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms from horizon import workflows from openstack_dashboard import api -from openstack_dashboard.utils.filters import get_int_or_uuid +from openstack_dashboard.utils import filters INDEX_URL = "horizon:projects:instances:index" ADD_USER_URL = "horizon:projects:instances:create_user" @@ -69,7 +69,7 @@ class UpdateInstanceSecurityGroupsAction(workflows.MembershipAction): def handle(self, request, data): instance_id = data['instance_id'] - wanted_groups = map(get_int_or_uuid, data['wanted_groups']) + wanted_groups = map(filters.get_int_or_uuid, data['wanted_groups']) try: api.network.server_update_security_groups(request, instance_id, wanted_groups) diff --git a/openstack_dashboard/dashboards/project/loadbalancers/forms.py b/openstack_dashboard/dashboards/project/loadbalancers/forms.py index 5f9d5ffb5b..90c665c384 100644 --- a/openstack_dashboard/dashboards/project/loadbalancers/forms.py +++ b/openstack_dashboard/dashboards/project/loadbalancers/forms.py @@ -18,8 +18,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/loadbalancers/panel.py b/openstack_dashboard/dashboards/project/loadbalancers/panel.py index 30773224e0..28f7ce960f 100644 --- a/openstack_dashboard/dashboards/project/loadbalancers/panel.py +++ b/openstack_dashboard/dashboards/project/loadbalancers/panel.py @@ -1,5 +1,5 @@ -from django.conf import settings -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/project/loadbalancers/tables.py b/openstack_dashboard/dashboards/project/loadbalancers/tables.py index d9a3c61267..13011f4d02 100644 --- a/openstack_dashboard/dashboards/project/loadbalancers/tables.py +++ b/openstack_dashboard/dashboards/project/loadbalancers/tables.py @@ -15,9 +15,9 @@ # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django.utils import http -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables diff --git a/openstack_dashboard/dashboards/project/loadbalancers/tabs.py b/openstack_dashboard/dashboards/project/loadbalancers/tabs.py index 0abf27e7ba..200cd141cc 100644 --- a/openstack_dashboard/dashboards/project/loadbalancers/tabs.py +++ b/openstack_dashboard/dashboards/project/loadbalancers/tabs.py @@ -15,23 +15,18 @@ # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs from openstack_dashboard import api -from openstack_dashboard.dashboards.project.loadbalancers.tables \ - import MembersTable -from openstack_dashboard.dashboards.project.loadbalancers.tables \ - import MonitorsTable -from openstack_dashboard.dashboards.project.loadbalancers.tables \ - import PoolsTable +from openstack_dashboard.dashboards.project.loadbalancers import tables class PoolsTab(tabs.TableTab): - table_classes = (PoolsTable,) + table_classes = (tables.PoolsTable,) name = _("Pools") slug = "pools" template_name = "horizon/common/_detail_table.html" @@ -49,7 +44,7 @@ class PoolsTab(tabs.TableTab): class MembersTab(tabs.TableTab): - table_classes = (MembersTable,) + table_classes = (tables.MembersTable,) name = _("Members") slug = "members" template_name = "horizon/common/_detail_table.html" @@ -67,7 +62,7 @@ class MembersTab(tabs.TableTab): class MonitorsTab(tabs.TableTab): - table_classes = (MonitorsTable,) + table_classes = (tables.MonitorsTable,) name = _("Monitors") slug = "monitors" template_name = "horizon/common/_detail_table.html" diff --git a/openstack_dashboard/dashboards/project/loadbalancers/tests.py b/openstack_dashboard/dashboards/project/loadbalancers/tests.py index 872fe0c0a0..9cb68f4145 100644 --- a/openstack_dashboard/dashboards/project/loadbalancers/tests.py +++ b/openstack_dashboard/dashboards/project/loadbalancers/tests.py @@ -1,32 +1,18 @@ # vim: tabstop=4 shiftwidth=4 softtabstop=4 -from mox import IsA +from mox import IsA # noqa -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy +from django.core.urlresolvers import reverse # noqa +from django.core.urlresolvers import reverse_lazy # noqa from django import http -from horizon.workflows.views import WorkflowView +from horizon.workflows import views from openstack_dashboard import api -from openstack_dashboard.api.lbaas import Member -from openstack_dashboard.api.lbaas import Pool -from openstack_dashboard.api.lbaas import PoolMonitor -from openstack_dashboard.api.lbaas import Vip +from openstack_dashboard.api import lbaas from openstack_dashboard.test import helpers as test -from openstack_dashboard.dashboards.project.loadbalancers.workflows \ - import AddMember -from openstack_dashboard.dashboards.project.loadbalancers.workflows \ - import AddMonitor -from openstack_dashboard.dashboards.project.loadbalancers.workflows \ - import AddPMAssociation -from openstack_dashboard.dashboards.project.loadbalancers.workflows \ - import AddPool -from openstack_dashboard.dashboards.project.loadbalancers.workflows \ - import AddVip -from openstack_dashboard.dashboards.project.loadbalancers.workflows \ - import DeletePMAssociation +from openstack_dashboard.dashboards.project.loadbalancers import workflows class LoadBalancerTests(test.TestCase): @@ -212,7 +198,7 @@ class LoadBalancerTests(test.TestCase): subnet_id=pool.subnet_id, protocol=pool.protocol, lb_method=pool.lb_method, - admin_state_up=pool.admin_state_up).AndReturn(Pool(pool)) + admin_state_up=pool.admin_state_up).AndReturn(lbaas.Pool(pool)) self.mox.ReplayAll() @@ -242,8 +228,8 @@ class LoadBalancerTests(test.TestCase): res = self.client.get(reverse(self.ADDPOOL_PATH)) workflow = res.context['workflow'] - self.assertTemplateUsed(res, WorkflowView.template_name) - self.assertEqual(workflow.name, AddPool.name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) + self.assertEqual(workflow.name, workflows.AddPool.name) expected_objs = ['', ] self.assertQuerysetEqual(workflow.steps, expected_objs) @@ -277,7 +263,7 @@ class LoadBalancerTests(test.TestCase): session_persistence=vip.session_persistence['type'], cookie_name=vip.session_persistence['cookie_name'], connection_limit=vip.connection_limit, - admin_state_up=vip.admin_state_up).AndReturn(Vip(vip)) + admin_state_up=vip.admin_state_up).AndReturn(lbaas.Vip(vip)) self.mox.ReplayAll() @@ -348,8 +334,8 @@ class LoadBalancerTests(test.TestCase): res = self.client.get(reverse(self.ADDVIP_PATH, args=(pool.id,))) workflow = res.context['workflow'] - self.assertTemplateUsed(res, WorkflowView.template_name) - self.assertEqual(workflow.name, AddVip.name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) + self.assertEqual(workflow.name, workflows.AddVip.name) expected_objs = ['', ] self.assertQuerysetEqual(workflow.steps, expected_objs) @@ -368,7 +354,7 @@ class LoadBalancerTests(test.TestCase): url_path=monitor.url_path, expected_codes=monitor.expected_codes, admin_state_up=monitor.admin_state_up).AndReturn( - PoolMonitor(monitor)) + lbaas.PoolMonitor(monitor)) self.mox.ReplayAll() @@ -422,8 +408,8 @@ class LoadBalancerTests(test.TestCase): res = self.client.get(reverse(self.ADDMONITOR_PATH)) workflow = res.context['workflow'] - self.assertTemplateUsed(res, WorkflowView.template_name) - self.assertEqual(workflow.name, AddMonitor.name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) + self.assertEqual(workflow.name, workflows.AddMonitor.name) expected_objs = ['', ] self.assertQuerysetEqual(workflow.steps, expected_objs) @@ -459,7 +445,8 @@ class LoadBalancerTests(test.TestCase): protocol_port=member.protocol_port, weight=member.weight, members=[server1.id], - admin_state_up=member.admin_state_up).AndReturn(Member(member)) + admin_state_up=member.admin_state_up).AndReturn( + lbaas.Member(member)) self.mox.ReplayAll() @@ -526,8 +513,8 @@ class LoadBalancerTests(test.TestCase): res = self.client.get(reverse(self.ADDMEMBER_PATH)) workflow = res.context['workflow'] - self.assertTemplateUsed(res, WorkflowView.template_name) - self.assertEqual(workflow.name, AddMember.name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) + self.assertEqual(workflow.name, workflows.AddMember.name) expected_objs = ['', ] self.assertQuerysetEqual(workflow.steps, expected_objs) @@ -740,8 +727,8 @@ class LoadBalancerTests(test.TestCase): res = self.client.get(reverse(self.ADDASSOC_PATH, args=(pool.id,))) workflow = res.context['workflow'] - self.assertTemplateUsed(res, WorkflowView.template_name) - self.assertEqual(workflow.name, AddPMAssociation.name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) + self.assertEqual(workflow.name, workflows.AddPMAssociation.name) expected_objs = ['', ] self.assertQuerysetEqual(workflow.steps, expected_objs) @@ -786,8 +773,8 @@ class LoadBalancerTests(test.TestCase): reverse(self.DELETEASSOC_PATH, args=(pool.id,))) workflow = res.context['workflow'] - self.assertTemplateUsed(res, WorkflowView.template_name) - self.assertEqual(workflow.name, DeletePMAssociation.name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) + self.assertEqual(workflow.name, workflows.DeletePMAssociation.name) expected_objs = [ '', ] diff --git a/openstack_dashboard/dashboards/project/loadbalancers/urls.py b/openstack_dashboard/dashboards/project/loadbalancers/urls.py index ab1cfba10d..6bfd04c0e9 100644 --- a/openstack_dashboard/dashboards/project/loadbalancers/urls.py +++ b/openstack_dashboard/dashboards/project/loadbalancers/urls.py @@ -14,64 +14,37 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa + +from openstack_dashboard.dashboards.project.loadbalancers import views -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - AddMemberView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - AddMonitorView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - AddPMAssociationView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - AddPoolView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - AddVipView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - DeletePMAssociationView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - IndexView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - MemberDetailsView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - MonitorDetailsView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - PoolDetailsView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - UpdateMemberView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - UpdateMonitorView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - UpdatePoolView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - UpdateVipView -from openstack_dashboard.dashboards.project.loadbalancers.views import \ - VipDetailsView urlpatterns = patterns( 'openstack_dashboard.dashboards.project.loadbalancers.views', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^addpool$', AddPoolView.as_view(), name='addpool'), + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^addpool$', views.AddPoolView.as_view(), name='addpool'), url(r'^updatepool/(?P[^/]+)/$', - UpdatePoolView.as_view(), name='updatepool'), - url(r'^addvip/(?P[^/]+)/$', AddVipView.as_view(), name='addvip'), + views.UpdatePoolView.as_view(), name='updatepool'), + url(r'^addvip/(?P[^/]+)/$', + views.AddVipView.as_view(), name='addvip'), url(r'^updatevip/(?P[^/]+)/$', - UpdateVipView.as_view(), name='updatevip'), - url(r'^addmember$', AddMemberView.as_view(), name='addmember'), + views.UpdateVipView.as_view(), name='updatevip'), + url(r'^addmember$', views.AddMemberView.as_view(), name='addmember'), url(r'^updatemember/(?P[^/]+)/$', - UpdateMemberView.as_view(), name='updatemember'), - url(r'^addmonitor$', AddMonitorView.as_view(), name='addmonitor'), + views.UpdateMemberView.as_view(), name='updatemember'), + url(r'^addmonitor$', views.AddMonitorView.as_view(), name='addmonitor'), url(r'^updatemonitor/(?P[^/]+)/$', - UpdateMonitorView.as_view(), name='updatemonitor'), + views.UpdateMonitorView.as_view(), name='updatemonitor'), url(r'^association/add/(?P[^/]+)/$', - AddPMAssociationView.as_view(), name='addassociation'), + views.AddPMAssociationView.as_view(), name='addassociation'), url(r'^association/delete/(?P[^/]+)/$', - DeletePMAssociationView.as_view(), name='deleteassociation'), + views.DeletePMAssociationView.as_view(), name='deleteassociation'), url(r'^pool/(?P[^/]+)/$', - PoolDetailsView.as_view(), name='pooldetails'), + views.PoolDetailsView.as_view(), name='pooldetails'), url(r'^vip/(?P[^/]+)/$', - VipDetailsView.as_view(), name='vipdetails'), + views.VipDetailsView.as_view(), name='vipdetails'), url(r'^member/(?P[^/]+)/$', - MemberDetailsView.as_view(), name='memberdetails'), + views.MemberDetailsView.as_view(), name='memberdetails'), url(r'^monitor/(?P[^/]+)/$', - MonitorDetailsView.as_view(), name='monitordetails')) + views.MonitorDetailsView.as_view(), name='monitordetails')) diff --git a/openstack_dashboard/dashboards/project/loadbalancers/views.py b/openstack_dashboard/dashboards/project/loadbalancers/views.py index a0ef149c76..37749ed90f 100644 --- a/openstack_dashboard/dashboards/project/loadbalancers/views.py +++ b/openstack_dashboard/dashboards/project/loadbalancers/views.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -25,36 +25,12 @@ from horizon import workflows import logging from openstack_dashboard import api -from openstack_dashboard.dashboards.project.loadbalancers.forms import \ - UpdateMember -from openstack_dashboard.dashboards.project.loadbalancers.forms import \ - UpdateMonitor -from openstack_dashboard.dashboards.project.loadbalancers.forms import \ - UpdatePool -from openstack_dashboard.dashboards.project.loadbalancers.forms import \ - UpdateVip -from openstack_dashboard.dashboards.project.loadbalancers.tabs import \ - LoadBalancerTabs -from openstack_dashboard.dashboards.project.loadbalancers.tabs import \ - MemberDetailsTabs -from openstack_dashboard.dashboards.project.loadbalancers.tabs import \ - MonitorDetailsTabs -from openstack_dashboard.dashboards.project.loadbalancers.tabs import \ - PoolDetailsTabs -from openstack_dashboard.dashboards.project.loadbalancers.tabs import \ - VipDetailsTabs -from openstack_dashboard.dashboards.project.loadbalancers.workflows import \ - AddMember -from openstack_dashboard.dashboards.project.loadbalancers.workflows import \ - AddMonitor -from openstack_dashboard.dashboards.project.loadbalancers.workflows import \ - AddPMAssociation -from openstack_dashboard.dashboards.project.loadbalancers.workflows import \ - AddPool -from openstack_dashboard.dashboards.project.loadbalancers.workflows import \ - AddVip -from openstack_dashboard.dashboards.project.loadbalancers.workflows import \ - DeletePMAssociation +from openstack_dashboard.dashboards.project.loadbalancers \ + import forms as project_forms +from openstack_dashboard.dashboards.project.loadbalancers \ + import tabs as project_tabs +from openstack_dashboard.dashboards.project.loadbalancers \ + import workflows as project_workflows import re @@ -62,7 +38,7 @@ LOG = logging.getLogger(__name__) class IndexView(tabs.TabView): - tab_group_class = (LoadBalancerTabs) + tab_group_class = (project_tabs.LoadBalancerTabs) template_name = 'project/loadbalancers/details_tabs.html' def post(self, request, *args, **kwargs): @@ -109,7 +85,7 @@ class IndexView(tabs.TabView): class AddPoolView(workflows.WorkflowView): - workflow_class = AddPool + workflow_class = project_workflows.AddPool def get_initial(self): initial = super(AddPoolView, self).get_initial() @@ -117,7 +93,7 @@ class AddPoolView(workflows.WorkflowView): class AddVipView(workflows.WorkflowView): - workflow_class = AddVip + workflow_class = project_workflows.AddVip def get_context_data(self, **kwargs): context = super(AddVipView, self).get_context_data(**kwargs) @@ -138,7 +114,7 @@ class AddVipView(workflows.WorkflowView): class AddMemberView(workflows.WorkflowView): - workflow_class = AddMember + workflow_class = project_workflows.AddMember def get_initial(self): initial = super(AddMemberView, self).get_initial() @@ -146,7 +122,7 @@ class AddMemberView(workflows.WorkflowView): class AddMonitorView(workflows.WorkflowView): - workflow_class = AddMonitor + workflow_class = project_workflows.AddMonitor def get_initial(self): initial = super(AddMonitorView, self).get_initial() @@ -154,27 +130,27 @@ class AddMonitorView(workflows.WorkflowView): class PoolDetailsView(tabs.TabView): - tab_group_class = (PoolDetailsTabs) + tab_group_class = (project_tabs.PoolDetailsTabs) template_name = 'project/loadbalancers/details_tabs.html' class VipDetailsView(tabs.TabView): - tab_group_class = (VipDetailsTabs) + tab_group_class = (project_tabs.VipDetailsTabs) template_name = 'project/loadbalancers/details_tabs.html' class MemberDetailsView(tabs.TabView): - tab_group_class = (MemberDetailsTabs) + tab_group_class = (project_tabs.MemberDetailsTabs) template_name = 'project/loadbalancers/details_tabs.html' class MonitorDetailsView(tabs.TabView): - tab_group_class = (MonitorDetailsTabs) + tab_group_class = (project_tabs.MonitorDetailsTabs) template_name = 'project/loadbalancers/details_tabs.html' class UpdatePoolView(forms.ModalFormView): - form_class = UpdatePool + form_class = project_forms.UpdatePool template_name = "project/loadbalancers/updatepool.html" context_object_name = 'pool' success_url = reverse_lazy("horizon:project:loadbalancers:index") @@ -205,7 +181,7 @@ class UpdatePoolView(forms.ModalFormView): class UpdateVipView(forms.ModalFormView): - form_class = UpdateVip + form_class = project_forms.UpdateVip template_name = "project/loadbalancers/updatevip.html" context_object_name = 'vip' success_url = reverse_lazy("horizon:project:loadbalancers:index") @@ -245,7 +221,7 @@ class UpdateVipView(forms.ModalFormView): class UpdateMemberView(forms.ModalFormView): - form_class = UpdateMember + form_class = project_forms.UpdateMember template_name = "project/loadbalancers/updatemember.html" context_object_name = 'member' success_url = reverse_lazy("horizon:project:loadbalancers:index") @@ -275,7 +251,7 @@ class UpdateMemberView(forms.ModalFormView): class UpdateMonitorView(forms.ModalFormView): - form_class = UpdateMonitor + form_class = project_forms.UpdateMonitor template_name = "project/loadbalancers/updatemonitor.html" context_object_name = 'monitor' success_url = reverse_lazy("horizon:project:loadbalancers:index") @@ -307,7 +283,7 @@ class UpdateMonitorView(forms.ModalFormView): class AddPMAssociationView(workflows.WorkflowView): - workflow_class = AddPMAssociation + workflow_class = project_workflows.AddPMAssociation def get_initial(self): initial = super(AddPMAssociationView, self).get_initial() @@ -323,7 +299,7 @@ class AddPMAssociationView(workflows.WorkflowView): class DeletePMAssociationView(workflows.WorkflowView): - workflow_class = DeletePMAssociation + workflow_class = project_workflows.DeletePMAssociation def get_initial(self): initial = super(DeletePMAssociationView, self).get_initial() diff --git a/openstack_dashboard/dashboards/project/loadbalancers/workflows.py b/openstack_dashboard/dashboards/project/loadbalancers/workflows.py index db95b2df06..159bc9f025 100644 --- a/openstack_dashboard/dashboards/project/loadbalancers/workflows.py +++ b/openstack_dashboard/dashboards/project/loadbalancers/workflows.py @@ -16,12 +16,12 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms from horizon.utils import fields -from horizon.utils.validators import validate_port_range +from horizon.utils.validators import validate_port_range # noqa from horizon import workflows from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/project/network_topology/panel.py b/openstack_dashboard/dashboards/project/network_topology/panel.py index 4277da735d..33163a324e 100644 --- a/openstack_dashboard/dashboards/project/network_topology/panel.py +++ b/openstack_dashboard/dashboards/project/network_topology/panel.py @@ -18,7 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/project/network_topology/urls.py b/openstack_dashboard/dashboards/project/network_topology/urls.py index 8b3f8fe8e5..0f51a1a318 100644 --- a/openstack_dashboard/dashboards/project/network_topology/urls.py +++ b/openstack_dashboard/dashboards/project/network_topology/urls.py @@ -19,17 +19,14 @@ # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.network_topology.views \ - import JSONView -from openstack_dashboard.dashboards.project.network_topology.views \ - import NetworkTopology +from openstack_dashboard.dashboards.project.network_topology import views urlpatterns = patterns( 'openstack_dashboard.dashboards.project.network_topology.views', - url(r'^$', NetworkTopology.as_view(), name='index'), - url(r'^json$', JSONView.as_view(), name='json'), + url(r'^$', views.NetworkTopology.as_view(), name='index'), + url(r'^json$', views.JSONView.as_view(), name='json'), ) diff --git a/openstack_dashboard/dashboards/project/network_topology/views.py b/openstack_dashboard/dashboards/project/network_topology/views.py index 377c1a283d..4d1c305b1a 100644 --- a/openstack_dashboard/dashboards/project/network_topology/views.py +++ b/openstack_dashboard/dashboards/project/network_topology/views.py @@ -20,10 +20,10 @@ import json -from django.core.urlresolvers import reverse -from django.http import HttpResponse -from django.views.generic import TemplateView -from django.views.generic import View +from django.core.urlresolvers import reverse # noqa +from django.http import HttpResponse # noqa +from django.views.generic import TemplateView # noqa +from django.views.generic import View # noqa from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/project/networks/forms.py b/openstack_dashboard/dashboards/project/networks/forms.py index f46f593fca..e026a9a5e5 100644 --- a/openstack_dashboard/dashboards/project/networks/forms.py +++ b/openstack_dashboard/dashboards/project/networks/forms.py @@ -20,8 +20,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/networks/panel.py b/openstack_dashboard/dashboards/project/networks/panel.py index 96b472eff5..ea4b90a344 100644 --- a/openstack_dashboard/dashboards/project/networks/panel.py +++ b/openstack_dashboard/dashboards/project/networks/panel.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/project/networks/ports/forms.py b/openstack_dashboard/dashboards/project/networks/ports/forms.py index fa20870a6f..9f09a87a20 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/forms.py +++ b/openstack_dashboard/dashboards/project/networks/ports/forms.py @@ -16,8 +16,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/networks/ports/tables.py b/openstack_dashboard/dashboards/project/networks/ports/tables.py index 0397bbd409..e28b0c8c98 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/tables.py +++ b/openstack_dashboard/dashboards/project/networks/ports/tables.py @@ -16,9 +16,9 @@ import logging -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import template -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables diff --git a/openstack_dashboard/dashboards/project/networks/ports/tabs.py b/openstack_dashboard/dashboards/project/networks/ports/tabs.py index f5ff3e90ab..bf63c1216b 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/tabs.py +++ b/openstack_dashboard/dashboards/project/networks/ports/tabs.py @@ -16,8 +16,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs diff --git a/openstack_dashboard/dashboards/project/networks/ports/urls.py b/openstack_dashboard/dashboards/project/networks/ports/urls.py index be839b52d8..170d296eb2 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/urls.py +++ b/openstack_dashboard/dashboards/project/networks/ports/urls.py @@ -14,11 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.networks.ports.views \ - import DetailView +from openstack_dashboard.dashboards.project.networks.ports import views PORTS = r'^(?P[^/]+)/%s$' @@ -26,5 +25,5 @@ VIEW_MOD = 'openstack_dashboard.dashboards.project.networks.ports.views' urlpatterns = patterns(VIEW_MOD, - url(PORTS % 'detail', DetailView.as_view(), name='detail') + url(PORTS % 'detail', views.DetailView.as_view(), name='detail') ) diff --git a/openstack_dashboard/dashboards/project/networks/ports/views.py b/openstack_dashboard/dashboards/project/networks/ports/views.py index e3fba4cb72..bdc23ed2ab 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/views.py +++ b/openstack_dashboard/dashboards/project/networks/ports/views.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -23,19 +23,19 @@ from horizon import tabs from openstack_dashboard import api -from openstack_dashboard.dashboards.project.networks.ports.forms \ - import UpdatePort -from openstack_dashboard.dashboards.project.networks.ports.tabs \ - import PortDetailTabs +from openstack_dashboard.dashboards.project.networks.ports \ + import forms as project_forms +from openstack_dashboard.dashboards.project.networks.ports \ + import tabs as project_tabs class DetailView(tabs.TabView): - tab_group_class = PortDetailTabs + tab_group_class = project_tabs.PortDetailTabs template_name = 'project/networks/ports/detail.html' class UpdateView(forms.ModalFormView): - form_class = UpdatePort + form_class = project_forms.UpdatePort template_name = 'project/networks/ports/update.html' context_object_name = 'port' success_url = 'horizon:project:networks:detail' diff --git a/openstack_dashboard/dashboards/project/networks/subnets/tables.py b/openstack_dashboard/dashboards/project/networks/subnets/tables.py index 72141ef82b..dfe044ef2c 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/tables.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/tables.py @@ -16,9 +16,9 @@ import logging -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables diff --git a/openstack_dashboard/dashboards/project/networks/subnets/tabs.py b/openstack_dashboard/dashboards/project/networks/subnets/tabs.py index 3a745bcbd5..450006c0fa 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/tabs.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/tabs.py @@ -16,8 +16,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs diff --git a/openstack_dashboard/dashboards/project/networks/subnets/urls.py b/openstack_dashboard/dashboards/project/networks/subnets/urls.py index f3aeb2e67d..0ed607af8b 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/urls.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/urls.py @@ -14,11 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.networks.subnets.views \ - import DetailView +from openstack_dashboard.dashboards.project.networks.subnets import views SUBNETS = r'^(?P[^/]+)/%s$' @@ -26,5 +25,5 @@ VIEW_MOD = 'openstack_dashboard.dashboards.project.networks.subnets.views' urlpatterns = patterns(VIEW_MOD, - url(SUBNETS % 'detail', DetailView.as_view(), name='detail') + url(SUBNETS % 'detail', views.DetailView.as_view(), name='detail') ) diff --git a/openstack_dashboard/dashboards/project/networks/subnets/views.py b/openstack_dashboard/dashboards/project/networks/subnets/views.py index 5ee487b7a5..55c87286b7 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/views.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/views.py @@ -19,8 +19,8 @@ Views for managing Neutron Subnets. """ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs @@ -28,19 +28,17 @@ from horizon import workflows from openstack_dashboard import api -from openstack_dashboard.dashboards.project.networks.subnets.tabs \ - import SubnetDetailTabs -from openstack_dashboard.dashboards.project.networks.subnets.workflows \ - import CreateSubnet -from openstack_dashboard.dashboards.project.networks.subnets.workflows \ - import UpdateSubnet +from openstack_dashboard.dashboards.project.networks.subnets \ + import tabs as project_tabs +from openstack_dashboard.dashboards.project.networks.subnets \ + import workflows as project_workflows LOG = logging.getLogger(__name__) class CreateView(workflows.WorkflowView): - workflow_class = CreateSubnet + workflow_class = project_workflows.CreateSubnet def get_object(self): if not hasattr(self, "_object"): @@ -62,7 +60,7 @@ class CreateView(workflows.WorkflowView): class UpdateView(workflows.WorkflowView): - workflow_class = UpdateSubnet + workflow_class = project_workflows.UpdateSubnet def _get_object(self, *args, **kwargs): if not hasattr(self, "_object"): @@ -102,5 +100,5 @@ class UpdateView(workflows.WorkflowView): class DetailView(tabs.TabView): - tab_group_class = SubnetDetailTabs + tab_group_class = project_tabs.SubnetDetailTabs template_name = 'project/networks/subnets/detail.html' diff --git a/openstack_dashboard/dashboards/project/networks/subnets/workflows.py b/openstack_dashboard/dashboards/project/networks/subnets/workflows.py index c033b707cc..b491a356bf 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/workflows.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/workflows.py @@ -16,8 +16,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/networks/tables.py b/openstack_dashboard/dashboards/project/networks/tables.py index 880906588e..13f328253f 100644 --- a/openstack_dashboard/dashboards/project/networks/tables.py +++ b/openstack_dashboard/dashboards/project/networks/tables.py @@ -15,10 +15,10 @@ # under the License. import logging -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import template from django.template import defaultfilters as filters -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables diff --git a/openstack_dashboard/dashboards/project/networks/tests.py b/openstack_dashboard/dashboards/project/networks/tests.py index 1a0bc6ac23..9be134ad28 100644 --- a/openstack_dashboard/dashboards/project/networks/tests.py +++ b/openstack_dashboard/dashboards/project/networks/tests.py @@ -14,19 +14,18 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from django.utils.html import escape +from django.utils.html import escape # noqa -from horizon.workflows.views import WorkflowView +from horizon.workflows import views -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test -from openstack_dashboard.dashboards.project.networks.workflows \ - import CreateNetwork +from openstack_dashboard.dashboards.project.networks import workflows INDEX_URL = reverse('horizon:project:networks:index') @@ -228,8 +227,8 @@ class NetworkTests(test.TestCase): res = self.client.get(url) workflow = res.context['workflow'] - self.assertTemplateUsed(res, WorkflowView.template_name) - self.assertEqual(workflow.name, CreateNetwork.name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) + self.assertEqual(workflow.name, workflows.CreateNetwork.name) expected_objs = ['', '', ''] @@ -605,7 +604,7 @@ class NetworkSubnetTests(test.TestCase): args=[network.id]) res = self.client.get(url) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) @test.create_stubs({api.neutron: ('network_get', 'subnet_create',)}) @@ -762,7 +761,7 @@ class NetworkSubnetTests(test.TestCase): expected_msg = 'Network Address and IP version are inconsistent.' self.assertFormErrors(res, 1, expected_msg) - self.assertTemplateUsed(res, WorkflowView.template_name) + self.assertTemplateUsed(res, views.WorkflowView.template_name) @test.create_stubs({api.neutron: ('network_get',)}) def test_subnet_create_post_gw_inconsistent(self): diff --git a/openstack_dashboard/dashboards/project/networks/urls.py b/openstack_dashboard/dashboards/project/networks/urls.py index 5b61e25879..2c4420b9c5 100644 --- a/openstack_dashboard/dashboards/project/networks/urls.py +++ b/openstack_dashboard/dashboards/project/networks/urls.py @@ -14,39 +14,34 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import include -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import include # noqa +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa from openstack_dashboard.dashboards.project.networks.ports \ import urls as port_urls -from openstack_dashboard.dashboards.project.networks.ports.views \ - import UpdateView as EditPortView +from openstack_dashboard.dashboards.project.networks.ports \ + import views as port_views from openstack_dashboard.dashboards.project.networks.subnets \ import urls as subnet_urls -from openstack_dashboard.dashboards.project.networks.subnets.views \ - import CreateView as AddSubnetView -from openstack_dashboard.dashboards.project.networks.subnets.views \ - import UpdateView as EditSubnetView -from openstack_dashboard.dashboards.project.networks.views import CreateView -from openstack_dashboard.dashboards.project.networks.views import DetailView -from openstack_dashboard.dashboards.project.networks.views import IndexView -from openstack_dashboard.dashboards.project.networks.views import UpdateView +from openstack_dashboard.dashboards.project.networks.subnets \ + import views as subnet_views +from openstack_dashboard.dashboards.project.networks import views NETWORKS = r'^(?P[^/]+)/%s$' urlpatterns = patterns('', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^create$', CreateView.as_view(), name='create'), - url(NETWORKS % 'detail', DetailView.as_view(), name='detail'), - url(NETWORKS % 'update', UpdateView.as_view(), name='update'), - url(NETWORKS % 'subnets/create', AddSubnetView.as_view(), + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^create$', views.CreateView.as_view(), name='create'), + url(NETWORKS % 'detail', views.DetailView.as_view(), name='detail'), + url(NETWORKS % 'update', views.UpdateView.as_view(), name='update'), + url(NETWORKS % 'subnets/create', subnet_views.CreateView.as_view(), name='addsubnet'), url(r'^(?P[^/]+)/subnets/(?P[^/]+)/update$', - EditSubnetView.as_view(), name='editsubnet'), + subnet_views.UpdateView.as_view(), name='editsubnet'), url(r'^(?P[^/]+)/ports/(?P[^/]+)/update$', - EditPortView.as_view(), name='editport'), + port_views.UpdateView.as_view(), name='editport'), url(r'^subnets/', include(subnet_urls, namespace='subnets')), url(r'^ports/', include(port_urls, namespace='ports'))) diff --git a/openstack_dashboard/dashboards/project/networks/views.py b/openstack_dashboard/dashboards/project/networks/views.py index bd3a72b850..cc2b176d3f 100644 --- a/openstack_dashboard/dashboards/project/networks/views.py +++ b/openstack_dashboard/dashboards/project/networks/views.py @@ -19,8 +19,8 @@ Views for managing Neutron Networks. """ import logging -from django.core.urlresolvers import reverse_lazy -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -29,22 +29,23 @@ from horizon import workflows from openstack_dashboard import api -from openstack_dashboard.dashboards.project.networks.forms import UpdateNetwork -from openstack_dashboard.dashboards.project.networks.ports.tables \ - import PortsTable -from openstack_dashboard.dashboards.project.networks.subnets.tables \ - import SubnetsTable -from openstack_dashboard.dashboards.project.networks.tables \ - import NetworksTable -from openstack_dashboard.dashboards.project.networks.workflows \ - import CreateNetwork +from openstack_dashboard.dashboards.project.networks \ + import forms as project_forms +from openstack_dashboard.dashboards.project.networks.ports \ + import tables as port_tables +from openstack_dashboard.dashboards.project.networks.subnets \ + import tables as subnet_tables +from openstack_dashboard.dashboards.project.networks \ + import tables as project_tables +from openstack_dashboard.dashboards.project.networks \ + import workflows as project_workflows LOG = logging.getLogger(__name__) class IndexView(tables.DataTableView): - table_class = NetworksTable + table_class = project_tables.NetworksTable template_name = 'project/networks/index.html' def get_data(self): @@ -62,14 +63,14 @@ class IndexView(tables.DataTableView): class CreateView(workflows.WorkflowView): - workflow_class = CreateNetwork + workflow_class = project_workflows.CreateNetwork def get_initial(self): pass class UpdateView(forms.ModalFormView): - form_class = UpdateNetwork + form_class = project_forms.UpdateNetwork template_name = 'project/networks/update.html' context_object_name = 'network' success_url = reverse_lazy("horizon:project:networks:index") @@ -100,7 +101,7 @@ class UpdateView(forms.ModalFormView): class DetailView(tables.MultiTableView): - table_classes = (SubnetsTable, PortsTable) + table_classes = (subnet_tables.SubnetsTable, port_tables.PortsTable) template_name = 'project/networks/detail.html' failure_url = reverse_lazy('horizon:project:networks:index') diff --git a/openstack_dashboard/dashboards/project/networks/workflows.py b/openstack_dashboard/dashboards/project/networks/workflows.py index 8dfeed6ff7..6e038ae382 100644 --- a/openstack_dashboard/dashboards/project/networks/workflows.py +++ b/openstack_dashboard/dashboards/project/networks/workflows.py @@ -18,8 +18,8 @@ import logging import netaddr -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/overview/panel.py b/openstack_dashboard/dashboards/project/overview/panel.py index 7ec447b4fd..d3354315b5 100644 --- a/openstack_dashboard/dashboards/project/overview/panel.py +++ b/openstack_dashboard/dashboards/project/overview/panel.py @@ -18,7 +18,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/project/overview/tests.py b/openstack_dashboard/dashboards/project/overview/tests.py index 47da3e50fe..cc4dde8471 100644 --- a/openstack_dashboard/dashboards/project/overview/tests.py +++ b/openstack_dashboard/dashboards/project/overview/tests.py @@ -20,11 +20,11 @@ import datetime -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http from django.utils import timezone -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/project/overview/urls.py b/openstack_dashboard/dashboards/project/overview/urls.py index abd7f25be9..fa1a2698c6 100644 --- a/openstack_dashboard/dashboards/project/overview/urls.py +++ b/openstack_dashboard/dashboards/project/overview/urls.py @@ -19,15 +19,13 @@ # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.overview.views \ - import ProjectOverview -from openstack_dashboard.dashboards.project.overview.views import WarningView +from openstack_dashboard.dashboards.project.overview import views urlpatterns = patterns('openstack_dashboard.dashboards.project.overview.views', - url(r'^$', ProjectOverview.as_view(), name='index'), - url(r'^warning$', WarningView.as_view(), name='warning'), + url(r'^$', views.ProjectOverview.as_view(), name='index'), + url(r'^warning$', views.WarningView.as_view(), name='warning'), ) diff --git a/openstack_dashboard/dashboards/project/overview/views.py b/openstack_dashboard/dashboards/project/overview/views.py index 1b427b3cfd..28cd535f6e 100644 --- a/openstack_dashboard/dashboards/project/overview/views.py +++ b/openstack_dashboard/dashboards/project/overview/views.py @@ -19,16 +19,16 @@ # under the License. -from django.template.defaultfilters import capfirst -from django.template.defaultfilters import floatformat -from django.utils.translation import ugettext as _ -from django.views.generic import TemplateView +from django.template.defaultfilters import capfirst # noqa +from django.template.defaultfilters import floatformat # noqa +from django.utils.translation import ugettext as _ # noqa +from django.views.generic import TemplateView # noqa from openstack_dashboard import usage -from openstack_dashboard.usage.base import BaseCsvResponse +from openstack_dashboard.usage import base -class ProjectUsageCsvRenderer(BaseCsvResponse): +class ProjectUsageCsvRenderer(base.BaseCsvResponse): columns = [_("Instance Name"), _("VCPUs"), _("Ram (MB)"), _("Disk (GB)"), _("Usage (Hours)"), diff --git a/openstack_dashboard/dashboards/project/routers/forms.py b/openstack_dashboard/dashboards/project/routers/forms.py index 36830017e0..fe6e18770a 100644 --- a/openstack_dashboard/dashboards/project/routers/forms.py +++ b/openstack_dashboard/dashboards/project/routers/forms.py @@ -8,8 +8,8 @@ Views for managing Neutron Routers. """ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/routers/panel.py b/openstack_dashboard/dashboards/project/routers/panel.py index fbaf831eda..3bca87dd70 100644 --- a/openstack_dashboard/dashboards/project/routers/panel.py +++ b/openstack_dashboard/dashboards/project/routers/panel.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/project/routers/ports/forms.py b/openstack_dashboard/dashboards/project/routers/ports/forms.py index 545dbba1f6..c529b2b14c 100644 --- a/openstack_dashboard/dashboards/project/routers/ports/forms.py +++ b/openstack_dashboard/dashboards/project/routers/ports/forms.py @@ -16,8 +16,8 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/routers/ports/tables.py b/openstack_dashboard/dashboards/project/routers/ports/tables.py index 0b8d9df12f..02d20501f3 100644 --- a/openstack_dashboard/dashboards/project/routers/ports/tables.py +++ b/openstack_dashboard/dashboards/project/routers/ports/tables.py @@ -16,14 +16,14 @@ import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.project.networks.ports.tables import\ - get_fixed_ips +from openstack_dashboard.dashboards.project.networks.ports \ + import tables as project_tables LOG = logging.getLogger(__name__) @@ -81,7 +81,8 @@ class PortsTable(tables.DataTable): name = tables.Column("name", verbose_name=_("Name"), link="horizon:project:networks:ports:detail") - fixed_ips = tables.Column(get_fixed_ips, verbose_name=_("Fixed IPs")) + fixed_ips = tables.Column(project_tables.get_fixed_ips, + verbose_name=_("Fixed IPs")) status = tables.Column("status", verbose_name=_("Status")) device_owner = tables.Column(get_device_owner, verbose_name=_("Type")) diff --git a/openstack_dashboard/dashboards/project/routers/ports/tabs.py b/openstack_dashboard/dashboards/project/routers/ports/tabs.py index f3ef2c908f..6d134d8da5 100644 --- a/openstack_dashboard/dashboards/project/routers/ports/tabs.py +++ b/openstack_dashboard/dashboards/project/routers/ports/tabs.py @@ -15,8 +15,8 @@ # under the License. import logging -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs diff --git a/openstack_dashboard/dashboards/project/routers/ports/urls.py b/openstack_dashboard/dashboards/project/routers/ports/urls.py index 06a2c83971..3764e7852f 100644 --- a/openstack_dashboard/dashboards/project/routers/ports/urls.py +++ b/openstack_dashboard/dashboards/project/routers/ports/urls.py @@ -14,13 +14,12 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.routers.ports.views \ - import DetailView +from openstack_dashboard.dashboards.project.routers.ports import views PORTS = r'^(?P[^/]+)/%s$' urlpatterns = patterns('horizon.dashboards.project.networks.ports.views', - url(PORTS % 'detail', DetailView.as_view(), name='detail')) + url(PORTS % 'detail', views.DetailView.as_view(), name='detail')) diff --git a/openstack_dashboard/dashboards/project/routers/ports/views.py b/openstack_dashboard/dashboards/project/routers/ports/views.py index d64b43e4af..91559601eb 100644 --- a/openstack_dashboard/dashboards/project/routers/ports/views.py +++ b/openstack_dashboard/dashboards/project/routers/ports/views.py @@ -16,7 +16,7 @@ import logging -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from horizon import exceptions from horizon import forms @@ -24,19 +24,17 @@ from horizon import tabs from openstack_dashboard import api -from openstack_dashboard.dashboards.project.routers.ports.forms \ - import AddInterface -from openstack_dashboard.dashboards.project.routers.ports.forms \ - import SetGatewayForm -from openstack_dashboard.dashboards.project.routers.ports.tabs \ - import PortDetailTabs +from openstack_dashboard.dashboards.project.routers.ports \ + import forms as project_forms +from openstack_dashboard.dashboards.project.routers.ports \ + import tabs as project_tabs LOG = logging.getLogger(__name__) class AddInterfaceView(forms.ModalFormView): - form_class = AddInterface + form_class = project_forms.AddInterface template_name = 'project/routers/ports/create.html' success_url = 'horizon:project:routers:detail' failure_url = 'horizon:project:routers:detail' @@ -69,7 +67,7 @@ class AddInterfaceView(forms.ModalFormView): class SetGatewayView(forms.ModalFormView): - form_class = SetGatewayForm + form_class = project_forms.SetGatewayForm template_name = 'project/routers/ports/setgateway.html' success_url = 'horizon:project:routers:index' failure_url = 'horizon:project:routers:index' @@ -101,5 +99,5 @@ class SetGatewayView(forms.ModalFormView): class DetailView(tabs.TabView): - tab_group_class = PortDetailTabs + tab_group_class = project_tabs.PortDetailTabs template_name = 'project/networks/ports/detail.html' diff --git a/openstack_dashboard/dashboards/project/routers/tables.py b/openstack_dashboard/dashboards/project/routers/tables.py index c86680e0b6..8cb67a18df 100644 --- a/openstack_dashboard/dashboards/project/routers/tables.py +++ b/openstack_dashboard/dashboards/project/routers/tables.py @@ -16,9 +16,9 @@ import logging -from django.core.urlresolvers import reverse -from django.template.defaultfilters import title -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.template.defaultfilters import title # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import messages diff --git a/openstack_dashboard/dashboards/project/routers/tabs.py b/openstack_dashboard/dashboards/project/routers/tabs.py index b390b6c59e..3338b79f03 100644 --- a/openstack_dashboard/dashboards/project/routers/tabs.py +++ b/openstack_dashboard/dashboards/project/routers/tabs.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs diff --git a/openstack_dashboard/dashboards/project/routers/tests.py b/openstack_dashboard/dashboards/project/routers/tests.py index 9509d8b056..7c9dbc47dc 100644 --- a/openstack_dashboard/dashboards/project/routers/tests.py +++ b/openstack_dashboard/dashboards/project/routers/tests.py @@ -13,9 +13,9 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/project/routers/urls.py b/openstack_dashboard/dashboards/project/routers/urls.py index f7ed2f2f5b..2ca6a24cd8 100644 --- a/openstack_dashboard/dashboards/project/routers/urls.py +++ b/openstack_dashboard/dashboards/project/routers/urls.py @@ -14,27 +14,24 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.routers.ports.views \ - import AddInterfaceView -from openstack_dashboard.dashboards.project.routers.ports.views \ - import SetGatewayView -from openstack_dashboard.dashboards.project.routers.views import CreateView -from openstack_dashboard.dashboards.project.routers.views import DetailView -from openstack_dashboard.dashboards.project.routers.views import IndexView +from openstack_dashboard.dashboards.project.routers.ports \ + import views as port_views +from openstack_dashboard.dashboards.project.routers import views urlpatterns = patterns('horizon.dashboards.project.routers.views', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^create/$', CreateView.as_view(), name='create'), + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^create/$', views.CreateView.as_view(), name='create'), url(r'^(?P[^/]+)/$', - DetailView.as_view(), + views.DetailView.as_view(), name='detail'), - url(r'^(?P[^/]+)/addinterface', AddInterfaceView.as_view(), + url(r'^(?P[^/]+)/addinterface', + port_views.AddInterfaceView.as_view(), name='addinterface'), url(r'^(?P[^/]+)/setgateway', - SetGatewayView.as_view(), + port_views.SetGatewayView.as_view(), name='setgateway'), ) diff --git a/openstack_dashboard/dashboards/project/routers/views.py b/openstack_dashboard/dashboards/project/routers/views.py index 26936d42d1..77052ddafe 100644 --- a/openstack_dashboard/dashboards/project/routers/views.py +++ b/openstack_dashboard/dashboards/project/routers/views.py @@ -20,26 +20,28 @@ Views for managing Neutron Routers. import logging -from django.core.urlresolvers import reverse_lazy -from django.utils.datastructures import SortedDict -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.datastructures import SortedDict # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms from horizon import tables from openstack_dashboard import api -from openstack_dashboard.dashboards.project.routers.forms import CreateForm -from openstack_dashboard.dashboards.project.routers.ports.tables \ - import PortsTable -from openstack_dashboard.dashboards.project.routers.tables import RoutersTable +from openstack_dashboard.dashboards.project.routers \ + import forms as project_forms +from openstack_dashboard.dashboards.project.routers.ports \ + import tables as port_tables +from openstack_dashboard.dashboards.project.routers \ + import tables as project_tables LOG = logging.getLogger(__name__) class IndexView(tables.DataTableView): - table_class = RoutersTable + table_class = project_tables.RoutersTable template_name = 'project/routers/index.html' def _get_routers(self, search_opts=None): @@ -90,7 +92,7 @@ class IndexView(tables.DataTableView): class DetailView(tables.MultiTableView): - table_classes = (PortsTable, ) + table_classes = (port_tables.PortsTable, ) template_name = 'project/routers/detail.html' failure_url = reverse_lazy('horizon:project:routers:index') @@ -141,6 +143,6 @@ class DetailView(tables.MultiTableView): class CreateView(forms.ModalFormView): - form_class = CreateForm + form_class = project_forms.CreateForm template_name = 'project/routers/create.html' success_url = reverse_lazy("horizon:project:routers:index") diff --git a/openstack_dashboard/dashboards/project/stacks/api.py b/openstack_dashboard/dashboards/project/stacks/api.py index 00c10bac8b..fbbfe86b40 100644 --- a/openstack_dashboard/dashboards/project/stacks/api.py +++ b/openstack_dashboard/dashboards/project/stacks/api.py @@ -1,15 +1,10 @@ import json import logging -from openstack_dashboard.api.heat import resources_list -from openstack_dashboard.api.heat import stack_get +from openstack_dashboard.api import heat -from openstack_dashboard.dashboards.project.stacks.mappings \ - import get_resource_image -from openstack_dashboard.dashboards.project.stacks.mappings \ - import get_resource_status -from openstack_dashboard.dashboards.project.stacks.sro import resource_info -from openstack_dashboard.dashboards.project.stacks.sro import stack_info +from openstack_dashboard.dashboards.project.stacks import mappings +from openstack_dashboard.dashboards.project.stacks import sro LOG = logging.getLogger(__name__) @@ -21,7 +16,7 @@ class Stack(object): def d3_data(request, stack_id=''): try: - stack = stack_get(request, stack_id) + stack = heat.stack_get(request, stack_id) except Exception: stack = Stack() stack.id = stack_id @@ -30,13 +25,13 @@ def d3_data(request, stack_id=''): stack.stack_status_reason = 'DELETE_COMPLETE' try: - resources = resources_list(request, stack.stack_name) + resources = heat.resources_list(request, stack.stack_name) except Exception: resources = [] d3_data = {"nodes": [], "stack": {}} if stack: - stack_image = get_resource_image(stack.stack_status, 'stack') + stack_image = mappings.get_resource_image(stack.stack_status, 'stack') stack_node = { 'stack_id': stack.id, 'name': stack.stack_name, @@ -47,17 +42,20 @@ def d3_data(request, stack_id=''): 'image_y': -30, 'text_x': 40, 'text_y': ".35em", - 'in_progress': True if (get_resource_status(stack.stack_status) == + 'in_progress': True if (mappings.get_resource_status( + stack.stack_status) == 'IN_PROGRESS') else False, - 'info_box': stack_info(stack, stack_image) + 'info_box': sro.stack_info(stack, stack_image) } d3_data['stack'] = stack_node if resources: for resource in resources: - resource_image = get_resource_image(resource.resource_status, + resource_image = mappings.get_resource_image( + resource.resource_status, resource.resource_type) - resource_status = get_resource_status(resource.resource_status) + resource_status = mappings.get_resource_status( + resource.resource_status) if resource_status in ('IN_PROGRESS', 'INIT'): in_progress = True else: @@ -73,7 +71,7 @@ def d3_data(request, stack_id=''): 'text_x': 35, 'text_y': ".35em", 'in_progress': in_progress, - 'info_box': resource_info(resource) + 'info_box': sro.resource_info(resource) } d3_data['nodes'].append(resource_node) return json.dumps(d3_data) diff --git a/openstack_dashboard/dashboards/project/stacks/forms.py b/openstack_dashboard/dashboards/project/stacks/forms.py index d7b093558c..7f4c8ea3f2 100644 --- a/openstack_dashboard/dashboards/project/stacks/forms.py +++ b/openstack_dashboard/dashboards/project/stacks/forms.py @@ -16,8 +16,8 @@ import json import logging import re -from django.utils.translation import ugettext_lazy as _ -from django.views.decorators.debug import sensitive_variables +from django.utils.translation import ugettext_lazy as _ # noqa +from django.views.decorators.debug import sensitive_variables # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/project/stacks/mappings.py b/openstack_dashboard/dashboards/project/stacks/mappings.py index 648f682c66..490cc1f3db 100644 --- a/openstack_dashboard/dashboards/project/stacks/mappings.py +++ b/openstack_dashboard/dashboards/project/stacks/mappings.py @@ -17,10 +17,10 @@ import logging import re import urlparse -from django.core.urlresolvers import reverse -from django.template.defaultfilters import register +from django.core.urlresolvers import reverse # noqa +from django.template.defaultfilters import register # noqa -from openstack_dashboard.api.swift import FOLDER_DELIMITER +from openstack_dashboard.api.swift import FOLDER_DELIMITER # noqa LOG = logging.getLogger(__name__) diff --git a/openstack_dashboard/dashboards/project/stacks/panel.py b/openstack_dashboard/dashboards/project/stacks/panel.py index 7d9765732d..cf0b4be84f 100644 --- a/openstack_dashboard/dashboards/project/stacks/panel.py +++ b/openstack_dashboard/dashboards/project/stacks/panel.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/project/stacks/sro.py b/openstack_dashboard/dashboards/project/stacks/sro.py index f385ee556d..0399ceca9f 100644 --- a/openstack_dashboard/dashboards/project/stacks/sro.py +++ b/openstack_dashboard/dashboards/project/stacks/sro.py @@ -1,7 +1,7 @@ -from django.template.defaultfilters import title -from django.template.loader import render_to_string +from django.template.defaultfilters import title # noqa +from django.template.loader import render_to_string # noqa -from horizon.utils.filters import replace_underscores +from horizon.utils.filters import replace_underscores # noqa def stack_info(stack, stack_image): diff --git a/openstack_dashboard/dashboards/project/stacks/tables.py b/openstack_dashboard/dashboards/project/stacks/tables.py index 669f0cc79c..bb199221f2 100644 --- a/openstack_dashboard/dashboards/project/stacks/tables.py +++ b/openstack_dashboard/dashboards/project/stacks/tables.py @@ -14,15 +14,15 @@ import logging -from django.http import Http404 -from django.template.defaultfilters import timesince -from django.template.defaultfilters import title -from django.utils.translation import ugettext_lazy as _ +from django.http import Http404 # noqa +from django.template.defaultfilters import timesince # noqa +from django.template.defaultfilters import title # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import messages from horizon import tables -from horizon.utils.filters import parse_isotime -from horizon.utils.filters import replace_underscores +from horizon.utils.filters import parse_isotime # noqa +from horizon.utils.filters import replace_underscores # noqa from heatclient import exc diff --git a/openstack_dashboard/dashboards/project/stacks/tabs.py b/openstack_dashboard/dashboards/project/stacks/tabs.py index ac667c9a44..15ef833880 100644 --- a/openstack_dashboard/dashboards/project/stacks/tabs.py +++ b/openstack_dashboard/dashboards/project/stacks/tabs.py @@ -14,15 +14,16 @@ import logging -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import messages from horizon import tabs from openstack_dashboard import api -from openstack_dashboard.dashboards.project.stacks.api import d3_data -from openstack_dashboard.dashboards.project.stacks.tables import EventsTable -from openstack_dashboard.dashboards.project.stacks.tables import ResourcesTable +from openstack_dashboard.dashboards.project.stacks \ + import api as project_api +from openstack_dashboard.dashboards.project.stacks \ + import tables as project_tables LOG = logging.getLogger(__name__) @@ -38,7 +39,7 @@ class StackTopologyTab(tabs.Tab): context = {} stack = self.tab_group.kwargs['stack'] context['stack_id'] = stack.id - context['d3_data'] = d3_data(request, stack_id=stack.id) + context['d3_data'] = project_api.d3_data(request, stack_id=stack.id) return context @@ -79,7 +80,7 @@ class StackEventsTab(tabs.Tab): messages.error(request, _( 'Unable to get events for stack "%s".') % stack.stack_name) return {"stack": stack, - "table": EventsTable(request, data=events), } + "table": project_tables.EventsTable(request, data=events), } class StackResourcesTab(tabs.Tab): @@ -99,7 +100,7 @@ class StackResourcesTab(tabs.Tab): messages.error(request, _( 'Unable to get resources for stack "%s".') % stack.stack_name) return {"stack": stack, - "table": ResourcesTable( + "table": project_tables.ResourcesTable( request, data=resources, stack=stack), } diff --git a/openstack_dashboard/dashboards/project/stacks/tests.py b/openstack_dashboard/dashboards/project/stacks/tests.py index c02c781466..4312067051 100644 --- a/openstack_dashboard/dashboards/project/stacks/tests.py +++ b/openstack_dashboard/dashboards/project/stacks/tests.py @@ -14,10 +14,10 @@ import json -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/project/stacks/urls.py b/openstack_dashboard/dashboards/project/stacks/urls.py index 82e0bcf3f5..44e11a9750 100644 --- a/openstack_dashboard/dashboards/project/stacks/urls.py +++ b/openstack_dashboard/dashboards/project/stacks/urls.py @@ -12,27 +12,22 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.stacks.views import CreateStackView -from openstack_dashboard.dashboards.project.stacks.views import DetailView -from openstack_dashboard.dashboards.project.stacks.views import IndexView -from openstack_dashboard.dashboards.project.stacks.views import JSONView -from openstack_dashboard.dashboards.project.stacks.views import ResourceView -from openstack_dashboard.dashboards.project.stacks.views \ - import SelectTemplateView +from openstack_dashboard.dashboards.project.stacks import views urlpatterns = patterns( '', - url(r'^$', IndexView.as_view(), name='index'), + url(r'^$', views.IndexView.as_view(), name='index'), url(r'^select_template$', - SelectTemplateView.as_view(), + views.SelectTemplateView.as_view(), name='select_template'), - url(r'^launch$', CreateStackView.as_view(), name='launch'), - url(r'^stack/(?P[^/]+)/$', DetailView.as_view(), name='detail'), + url(r'^launch$', views.CreateStackView.as_view(), name='launch'), + url(r'^stack/(?P[^/]+)/$', + views.DetailView.as_view(), name='detail'), url(r'^stack/(?P[^/]+)/(?P[^/]+)/$', - ResourceView.as_view(), name='resource'), + views.ResourceView.as_view(), name='resource'), url(r'^get_d3_data/(?P[^/]+)/$', - JSONView.as_view(), name='d3_data'), + views.JSONView.as_view(), name='d3_data'), ) diff --git a/openstack_dashboard/dashboards/project/stacks/views.py b/openstack_dashboard/dashboards/project/stacks/views.py index aef8d1e404..5595cb0a68 100644 --- a/openstack_dashboard/dashboards/project/stacks/views.py +++ b/openstack_dashboard/dashboards/project/stacks/views.py @@ -20,28 +20,29 @@ from horizon import forms from horizon import tables from horizon import tabs -from django.core.urlresolvers import reverse -from django.core.urlresolvers import reverse_lazy -from django.http import HttpResponse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.core.urlresolvers import reverse_lazy # noqa +from django.http import HttpResponse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from django.views import generic from openstack_dashboard import api -from openstack_dashboard.dashboards.project.stacks.api import d3_data -from openstack_dashboard.dashboards.project.stacks.forms import StackCreateForm -from openstack_dashboard.dashboards.project.stacks.forms import TemplateForm -from openstack_dashboard.dashboards.project.stacks.tables import StacksTable -from openstack_dashboard.dashboards.project.stacks.tabs \ - import ResourceDetailTabs -from openstack_dashboard.dashboards.project.stacks.tabs import StackDetailTabs +from openstack_dashboard.dashboards.project.stacks \ + import api as project_api +from openstack_dashboard.dashboards.project.stacks \ + import forms as project_forms +from openstack_dashboard.dashboards.project.stacks \ + import tables as project_tables +from openstack_dashboard.dashboards.project.stacks \ + import tabs as project_tabs LOG = logging.getLogger(__name__) class IndexView(tables.DataTableView): - table_class = StacksTable + table_class = project_tables.StacksTable template_name = 'project/stacks/index.html' def get_data(self): @@ -55,7 +56,7 @@ class IndexView(tables.DataTableView): class SelectTemplateView(forms.ModalFormView): - form_class = TemplateForm + form_class = project_forms.TemplateForm template_name = 'project/stacks/select_template.html' success_url = reverse_lazy('horizon:project:stacks:launch') @@ -66,7 +67,7 @@ class SelectTemplateView(forms.ModalFormView): class CreateStackView(forms.ModalFormView): - form_class = StackCreateForm + form_class = project_forms.StackCreateForm template_name = 'project/stacks/create.html' success_url = reverse_lazy('horizon:project:stacks:index') @@ -91,7 +92,7 @@ class CreateStackView(forms.ModalFormView): class DetailView(tabs.TabView): - tab_group_class = StackDetailTabs + tab_group_class = project_tabs.StackDetailTabs template_name = 'project/stacks/detail.html' def get_context_data(self, **kwargs): @@ -119,7 +120,7 @@ class DetailView(tabs.TabView): class ResourceView(tabs.TabView): - tab_group_class = ResourceDetailTabs + tab_group_class = project_tabs.ResourceDetailTabs template_name = 'project/stacks/resource.html' def get_context_data(self, **kwargs): @@ -165,5 +166,5 @@ class ResourceView(tabs.TabView): class JSONView(generic.View): def get(self, request, stack_id=''): - return HttpResponse(d3_data(request, stack_id=stack_id), + return HttpResponse(project_api.d3_data(request, stack_id=stack_id), content_type="application/json") diff --git a/openstack_dashboard/dashboards/project/volumes/forms.py b/openstack_dashboard/dashboards/project/volumes/forms.py index 8ba0748933..6fd480c1ee 100644 --- a/openstack_dashboard/dashboards/project/volumes/forms.py +++ b/openstack_dashboard/dashboards/project/volumes/forms.py @@ -7,26 +7,24 @@ Views for managing volumes. """ -from django.conf import settings -from django.core.urlresolvers import reverse -from django.forms import ValidationError -from django.template.defaultfilters import filesizeformat -from django.utils.translation import ugettext_lazy as _ +from django.conf import settings # noqa +from django.core.urlresolvers import reverse # noqa +from django.forms import ValidationError # noqa +from django.template.defaultfilters import filesizeformat # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms from horizon import messages -from horizon.utils.fields import SelectWidget -from horizon.utils.functions import bytes_to_gigabytes -from horizon.utils.memoized import memoized +from horizon.utils.fields import SelectWidget # noqa +from horizon.utils.functions import bytes_to_gigabytes # noqa +from horizon.utils.memoized import memoized # noqa from openstack_dashboard import api from openstack_dashboard.api import cinder from openstack_dashboard.api import glance -from openstack_dashboard.dashboards.project.images_and_snapshots.utils \ - import get_available_images -from openstack_dashboard.dashboards.project.instances.tables \ - import ACTIVE_STATES +from openstack_dashboard.dashboards.project.images_and_snapshots import utils +from openstack_dashboard.dashboards.project.instances import tables class CreateForm(forms.SelfHandlingForm): @@ -138,7 +136,7 @@ class CreateForm(forms.SelfHandlingForm): exceptions.handle(request, _("Unable to retrieve " "volume snapshots.")) - images = get_available_images(request, + images = utils.get_available_images(request, request.user.tenant_id) if images: source_type_choices.append(("image_source", _("Image"))) @@ -278,7 +276,7 @@ class AttachForm(forms.SelfHandlingForm): instance_list = kwargs.get('initial', {}).get('instances', []) instances = [] for instance in instance_list: - if instance.status in ACTIVE_STATES and \ + if instance.status in tables.ACTIVE_STATES and \ not any(instance.id == att["server_id"] for att in volume.attachments): instances.append((instance.id, '%s (%s)' % (instance.name, diff --git a/openstack_dashboard/dashboards/project/volumes/panel.py b/openstack_dashboard/dashboards/project/volumes/panel.py index 351e63cf6e..5684f1976b 100644 --- a/openstack_dashboard/dashboards/project/volumes/panel.py +++ b/openstack_dashboard/dashboards/project/volumes/panel.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/project/volumes/tables.py b/openstack_dashboard/dashboards/project/volumes/tables.py index 87cf165021..ddb80ac4ff 100644 --- a/openstack_dashboard/dashboards/project/volumes/tables.py +++ b/openstack_dashboard/dashboards/project/volumes/tables.py @@ -16,13 +16,13 @@ import logging -from django.core.urlresolvers import NoReverseMatch -from django.core.urlresolvers import reverse -from django.template.defaultfilters import title -from django.utils.html import strip_tags +from django.core.urlresolvers import NoReverseMatch # noqa +from django.core.urlresolvers import reverse # noqa +from django.template.defaultfilters import title # noqa +from django.utils.html import strip_tags # noqa from django.utils import safestring -from django.utils.translation import string_concat -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import string_concat # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions diff --git a/openstack_dashboard/dashboards/project/volumes/tabs.py b/openstack_dashboard/dashboards/project/volumes/tabs.py index 77cd778ee4..e81ae31685 100644 --- a/openstack_dashboard/dashboards/project/volumes/tabs.py +++ b/openstack_dashboard/dashboards/project/volumes/tabs.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse -from django.utils.translation import ugettext_lazy as _ +from django.core.urlresolvers import reverse # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import tabs diff --git a/openstack_dashboard/dashboards/project/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/tests.py index 1fc51b424d..9110fc6289 100644 --- a/openstack_dashboard/dashboards/project/volumes/tests.py +++ b/openstack_dashboard/dashboards/project/volumes/tests.py @@ -18,16 +18,16 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf import settings -from django.core.urlresolvers import reverse +from django.conf import settings # noqa +from django.core.urlresolvers import reverse # noqa from django.forms import widgets from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.api import cinder -from openstack_dashboard.dashboards.project.volumes.tables import CreateVolume +from openstack_dashboard.dashboards.project.volumes import tables from openstack_dashboard.test import helpers as test from openstack_dashboard.usage import quotas @@ -761,7 +761,7 @@ class VolumeViewTests(test.TestCase): volumes = res.context['volumes_table'].data self.assertItemsEqual(volumes, self.volumes.list()) - create_link = CreateVolume() + create_link = tables.CreateVolume() url = create_link.get_link_url() classes = list(create_link.get_default_classes())\ + list(create_link.classes) diff --git a/openstack_dashboard/dashboards/project/volumes/urls.py b/openstack_dashboard/dashboards/project/volumes/urls.py index 0d77d0a292..bb7117ce0a 100644 --- a/openstack_dashboard/dashboards/project/volumes/urls.py +++ b/openstack_dashboard/dashboards/project/volumes/urls.py @@ -14,28 +14,22 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.project.volumes.views \ - import CreateSnapshotView -from openstack_dashboard.dashboards.project.volumes.views import CreateView -from openstack_dashboard.dashboards.project.volumes.views import DetailView -from openstack_dashboard.dashboards.project.volumes.views \ - import EditAttachmentsView -from openstack_dashboard.dashboards.project.volumes.views import IndexView +from openstack_dashboard.dashboards.project.volumes import views urlpatterns = patterns('openstack_dashboard.dashboards.project.volumes.views', - url(r'^$', IndexView.as_view(), name='index'), - url(r'^create/$', CreateView.as_view(), name='create'), + url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^create/$', views.CreateView.as_view(), name='create'), url(r'^(?P[^/]+)/attach/$', - EditAttachmentsView.as_view(), + views.EditAttachmentsView.as_view(), name='attach'), url(r'^(?P[^/]+)/create_snapshot/$', - CreateSnapshotView.as_view(), + views.CreateSnapshotView.as_view(), name='create_snapshot'), url(r'^(?P[^/]+)/$', - DetailView.as_view(), + views.DetailView.as_view(), name='detail'), ) diff --git a/openstack_dashboard/dashboards/project/volumes/views.py b/openstack_dashboard/dashboards/project/volumes/views.py index a98b8d6c13..8f74c4fdf9 100644 --- a/openstack_dashboard/dashboards/project/volumes/views.py +++ b/openstack_dashboard/dashboards/project/volumes/views.py @@ -18,14 +18,9 @@ Views for managing volumes. """ -from django.core.urlresolvers import reverse_lazy -from django.utils.datastructures import SortedDict -from django.utils.translation import ugettext_lazy as _ - -from openstack_dashboard.dashboards.project.volumes.forms import AttachForm -from openstack_dashboard.dashboards.project.volumes.forms import CreateForm -from openstack_dashboard.dashboards.project.volumes.forms \ - import CreateSnapshotForm +from django.core.urlresolvers import reverse_lazy # noqa +from django.utils.datastructures import SortedDict # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import exceptions from horizon import forms @@ -38,11 +33,13 @@ from openstack_dashboard import api from openstack_dashboard.api import cinder from openstack_dashboard.usage import quotas -from openstack_dashboard.dashboards.project.volumes.tables \ - import AttachmentsTable -from openstack_dashboard.dashboards.project.volumes.tables import VolumesTable -from openstack_dashboard.dashboards.project.volumes.tabs \ - import VolumeDetailTabs +from openstack_dashboard.dashboards.project.volumes \ + import forms as project_forms + +from openstack_dashboard.dashboards.project.volumes \ + import tables as project_tables +from openstack_dashboard.dashboards.project.volumes \ + import tabs as project_tabs LOG = logging.getLogger(__name__) @@ -84,7 +81,7 @@ class VolumeTableMixIn(object): class IndexView(tables.DataTableView, VolumeTableMixIn): - table_class = VolumesTable + table_class = project_tables.VolumesTable template_name = 'project/volumes/index.html' def get_data(self): @@ -96,12 +93,12 @@ class IndexView(tables.DataTableView, VolumeTableMixIn): class DetailView(tabs.TabView): - tab_group_class = VolumeDetailTabs + tab_group_class = project_tabs.VolumeDetailTabs template_name = 'project/volumes/detail.html' class CreateView(forms.ModalFormView): - form_class = CreateForm + form_class = project_forms.CreateForm template_name = 'project/volumes/create.html' success_url = reverse_lazy("horizon:project:volumes:index") @@ -121,7 +118,7 @@ class CreateView(forms.ModalFormView): class CreateSnapshotView(forms.ModalFormView): - form_class = CreateSnapshotForm + form_class = project_forms.CreateSnapshotForm template_name = 'project/volumes/create_snapshot.html' success_url = reverse_lazy("horizon:project:images_and_snapshots:index") @@ -139,8 +136,8 @@ class CreateSnapshotView(forms.ModalFormView): class EditAttachmentsView(tables.DataTableView, forms.ModalFormView): - table_class = AttachmentsTable - form_class = AttachForm + table_class = project_tables.AttachmentsTable + form_class = project_forms.AttachForm template_name = 'project/volumes/attach.html' success_url = reverse_lazy("horizon:project:volumes:index") diff --git a/openstack_dashboard/dashboards/settings/dashboard.py b/openstack_dashboard/dashboards/settings/dashboard.py index 15116f201e..6763c5923f 100644 --- a/openstack_dashboard/dashboards/settings/dashboard.py +++ b/openstack_dashboard/dashboards/settings/dashboard.py @@ -15,7 +15,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/settings/password/forms.py b/openstack_dashboard/dashboards/settings/password/forms.py index 7428df03c8..59bbbdf49f 100644 --- a/openstack_dashboard/dashboards/settings/password/forms.py +++ b/openstack_dashboard/dashboards/settings/password/forms.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.forms import ValidationError -from django.utils.translation import ugettext_lazy as _ -from django.views.decorators.debug import sensitive_variables +from django.forms import ValidationError # noqa +from django.utils.translation import ugettext_lazy as _ # noqa +from django.views.decorators.debug import sensitive_variables # noqa from horizon import exceptions from horizon import forms diff --git a/openstack_dashboard/dashboards/settings/password/panel.py b/openstack_dashboard/dashboards/settings/password/panel.py index c9aba34512..b7a1e690b6 100644 --- a/openstack_dashboard/dashboards/settings/password/panel.py +++ b/openstack_dashboard/dashboards/settings/password/panel.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/settings/password/tests.py b/openstack_dashboard/dashboards/settings/password/tests.py index 409b1ef875..6a553d9bb9 100644 --- a/openstack_dashboard/dashboards/settings/password/tests.py +++ b/openstack_dashboard/dashboards/settings/password/tests.py @@ -14,10 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/settings/password/urls.py b/openstack_dashboard/dashboards/settings/password/urls.py index cd3cf9b97c..5001a2df16 100644 --- a/openstack_dashboard/dashboards/settings/password/urls.py +++ b/openstack_dashboard/dashboards/settings/password/urls.py @@ -14,10 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.settings.password.views import PasswordView +from openstack_dashboard.dashboards.settings.password.views import PasswordView # noqa urlpatterns = patterns('', diff --git a/openstack_dashboard/dashboards/settings/password/views.py b/openstack_dashboard/dashboards/settings/password/views.py index 01114af08a..5017617f5a 100644 --- a/openstack_dashboard/dashboards/settings/password/views.py +++ b/openstack_dashboard/dashboards/settings/password/views.py @@ -16,8 +16,8 @@ from horizon import forms -from django.core.urlresolvers import reverse_lazy -from openstack_dashboard.dashboards.settings.password.forms import PasswordForm +from django.core.urlresolvers import reverse_lazy # noqa +from openstack_dashboard.dashboards.settings.password.forms import PasswordForm # noqa class PasswordView(forms.ModalFormView): diff --git a/openstack_dashboard/dashboards/settings/user/forms.py b/openstack_dashboard/dashboards/settings/user/forms.py index f2c3c230bd..634e0d185f 100644 --- a/openstack_dashboard/dashboards/settings/user/forms.py +++ b/openstack_dashboard/dashboards/settings/user/forms.py @@ -14,13 +14,13 @@ # License for the specific language governing permissions and limitations # under the License. -from datetime import datetime +from datetime import datetime # noqa import pytz -from django.conf import settings +from django.conf import settings # noqa from django import shortcuts from django.utils import translation -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import forms from horizon import messages diff --git a/openstack_dashboard/dashboards/settings/user/panel.py b/openstack_dashboard/dashboards/settings/user/panel.py index 635fe321b7..1d0e5f4f02 100644 --- a/openstack_dashboard/dashboards/settings/user/panel.py +++ b/openstack_dashboard/dashboards/settings/user/panel.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa import horizon diff --git a/openstack_dashboard/dashboards/settings/user/tests.py b/openstack_dashboard/dashboards/settings/user/tests.py index c049a04006..bfa6f36ad2 100644 --- a/openstack_dashboard/dashboards/settings/user/tests.py +++ b/openstack_dashboard/dashboards/settings/user/tests.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -from django.core.urlresolvers import reverse +from django.core.urlresolvers import reverse # noqa from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/settings/user/urls.py b/openstack_dashboard/dashboards/settings/user/urls.py index 16cc7d9441..98cdf8b13a 100644 --- a/openstack_dashboard/dashboards/settings/user/urls.py +++ b/openstack_dashboard/dashboards/settings/user/urls.py @@ -14,10 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa -from openstack_dashboard.dashboards.settings.user.views import UserSettingsView +from openstack_dashboard.dashboards.settings.user.views import UserSettingsView # noqa urlpatterns = patterns('', diff --git a/openstack_dashboard/dashboards/settings/user/views.py b/openstack_dashboard/dashboards/settings/user/views.py index e57ba67e0e..a58b0dd76f 100644 --- a/openstack_dashboard/dashboards/settings/user/views.py +++ b/openstack_dashboard/dashboards/settings/user/views.py @@ -14,10 +14,10 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf import settings +from django.conf import settings # noqa from horizon import forms -from openstack_dashboard.dashboards.settings.user.forms import UserSettingsForm +from openstack_dashboard.dashboards.settings.user.forms import UserSettingsForm # noqa class UserSettingsView(forms.ModalFormView): diff --git a/openstack_dashboard/test/api_tests/glance_tests.py b/openstack_dashboard/test/api_tests/glance_tests.py index 1ba5230319..ef8a765465 100644 --- a/openstack_dashboard/test/api_tests/glance_tests.py +++ b/openstack_dashboard/test/api_tests/glance_tests.py @@ -18,8 +18,8 @@ # License for the specific language governing permissions and limitations # under the License. -from django.conf import settings -from django.test.utils import override_settings +from django.conf import settings # noqa +from django.test.utils import override_settings # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/test/api_tests/lbaas_tests.py b/openstack_dashboard/test/api_tests/lbaas_tests.py index 2877321328..e768ba77da 100644 --- a/openstack_dashboard/test/api_tests/lbaas_tests.py +++ b/openstack_dashboard/test/api_tests/lbaas_tests.py @@ -18,7 +18,7 @@ from openstack_dashboard import api from openstack_dashboard.test import helpers as test -from neutronclient.v2_0.client import Client as neutronclient +from neutronclient.v2_0.client import Client as neutronclient # noqa class LbaasApiTests(test.APITestCase): diff --git a/openstack_dashboard/test/api_tests/network_tests.py b/openstack_dashboard/test/api_tests/network_tests.py index c29f59b8a3..930f1bbaaf 100644 --- a/openstack_dashboard/test/api_tests/network_tests.py +++ b/openstack_dashboard/test/api_tests/network_tests.py @@ -19,9 +19,9 @@ import itertools import uuid from django import http -from mox import IsA +from mox import IsA # noqa -from novaclient.v1_1.floating_ip_pools import FloatingIPPool +from novaclient.v1_1.floating_ip_pools import FloatingIPPool # noqa from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/test/api_tests/nova_tests.py b/openstack_dashboard/test/api_tests/nova_tests.py index dc0d3a1bb8..2e8305d018 100644 --- a/openstack_dashboard/test/api_tests/nova_tests.py +++ b/openstack_dashboard/test/api_tests/nova_tests.py @@ -21,11 +21,11 @@ from __future__ import absolute_import -from django.conf import settings +from django.conf import settings # noqa from django import http -from django.test.utils import override_settings +from django.test.utils import override_settings # noqa -from mox import IsA +from mox import IsA # noqa from novaclient.v1_1 import servers from openstack_dashboard import api diff --git a/openstack_dashboard/test/api_tests/swift_tests.py b/openstack_dashboard/test/api_tests/swift_tests.py index 0e2c6e59d4..18b7f23fca 100644 --- a/openstack_dashboard/test/api_tests/swift_tests.py +++ b/openstack_dashboard/test/api_tests/swift_tests.py @@ -20,7 +20,7 @@ from __future__ import absolute_import -from mox import IsA +from mox import IsA # noqa from horizon import exceptions diff --git a/openstack_dashboard/test/error_pages_urls.py b/openstack_dashboard/test/error_pages_urls.py index c9f18178a0..963cab3f4d 100644 --- a/openstack_dashboard/test/error_pages_urls.py +++ b/openstack_dashboard/test/error_pages_urls.py @@ -1,6 +1,6 @@ -from django.conf.urls import patterns +from django.conf.urls import patterns # noqa -from openstack_dashboard.urls import urlpatterns +from openstack_dashboard.urls import urlpatterns # noqa urlpatterns += patterns('', (r'^500/$', 'django.views.defaults.server_error') diff --git a/openstack_dashboard/test/helpers.py b/openstack_dashboard/test/helpers.py index 4a1bd115d0..dbd80664b1 100644 --- a/openstack_dashboard/test/helpers.py +++ b/openstack_dashboard/test/helpers.py @@ -18,16 +18,16 @@ # License for the specific language governing permissions and limitations # under the License. -from functools import wraps +from functools import wraps # noqa import os -from django.conf import settings -from django.contrib.auth.middleware import AuthenticationMiddleware -from django.contrib.messages.storage import default_storage +from django.conf import settings # noqa +from django.contrib.auth.middleware import AuthenticationMiddleware # noqa +from django.contrib.messages.storage import default_storage # noqa from django.core.handlers import wsgi from django import http -from django.test.client import RequestFactory -from django.utils.importlib import import_module +from django.test.client import RequestFactory # noqa +from django.utils.importlib import import_module # noqa from django.utils import unittest from cinderclient import client as cinder_client @@ -49,7 +49,7 @@ from horizon.test import helpers as horizon_helpers from openstack_dashboard import api from openstack_dashboard import context_processors -from openstack_dashboard.test.test_data.utils import load_test_data +from openstack_dashboard.test.test_data.utils import load_test_data # noqa # Makes output of failing mox tests much easier to read. diff --git a/openstack_dashboard/test/settings.py b/openstack_dashboard/test/settings.py index dfcaa22c7d..3944e765ff 100644 --- a/openstack_dashboard/test/settings.py +++ b/openstack_dashboard/test/settings.py @@ -1,13 +1,11 @@ import os -from django.utils.translation import ugettext_lazy as _ +from django.utils.translation import ugettext_lazy as _ # noqa from horizon.test.settings import * # noqa -from horizon.utils.secret_key import generate_or_read_from_file +from horizon.utils.secret_key import generate_or_read_from_file # noqa -from openstack_dashboard.exceptions import NOT_FOUND -from openstack_dashboard.exceptions import RECOVERABLE -from openstack_dashboard.exceptions import UNAUTHORIZED +from openstack_dashboard import exceptions TEST_DIR = os.path.dirname(os.path.abspath(__file__)) @@ -54,9 +52,9 @@ HORIZON_CONFIG = { }, 'user_home': None, 'help_url': "http://docs.openstack.org", - 'exceptions': {'recoverable': RECOVERABLE, - 'not_found': NOT_FOUND, - 'unauthorized': UNAUTHORIZED}, + 'exceptions': {'recoverable': exceptions.RECOVERABLE, + 'not_found': exceptions.NOT_FOUND, + 'unauthorized': exceptions.UNAUTHORIZED}, } # Set to True to allow users to upload images to glance via Horizon server. diff --git a/openstack_dashboard/test/test_data/cinder_data.py b/openstack_dashboard/test/test_data/cinder_data.py index e70a204466..a1c8f4e5d0 100644 --- a/openstack_dashboard/test/test_data/cinder_data.py +++ b/openstack_dashboard/test/test_data/cinder_data.py @@ -13,11 +13,10 @@ # under the License. from cinderclient.v1 import quotas -from openstack_dashboard.api.base import Quota -from openstack_dashboard.api.base import QuotaSet as QuotaSetWrapper -from openstack_dashboard.usage.quotas import QuotaUsage +from openstack_dashboard.api import base +from openstack_dashboard.usage import quotas as usage_quotas -from openstack_dashboard.test.test_data.utils import TestDataContainer +from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa def data(TEST): @@ -30,7 +29,7 @@ def data(TEST): gigabytes='1000') quota = quotas.QuotaSet(quotas.QuotaSetManager(None), quota_data) #TEST.quotas.cinder = QuotaSetWrapper(quota) - TEST.cinder_quotas.add(QuotaSetWrapper(quota)) + TEST.cinder_quotas.add(base.QuotaSet(quota)) # Quota Usages quota_usage_data = {'gigabytes': {'used': 0, @@ -39,9 +38,9 @@ def data(TEST): 'quota': 10}, 'snapshots': {'used': 0, 'quota': 10}} - quota_usage = QuotaUsage() + quota_usage = usage_quotas.QuotaUsage() for k, v in quota_usage_data.items(): - quota_usage.add_quota(Quota(k, v['quota'])) + quota_usage.add_quota(base.Quota(k, v['quota'])) quota_usage.tally(k, v['used']) TEST.cinder_quota_usages.add(quota_usage) diff --git a/openstack_dashboard/test/test_data/exceptions.py b/openstack_dashboard/test/test_data/exceptions.py index 4dc358667f..ffa0165d7a 100644 --- a/openstack_dashboard/test/test_data/exceptions.py +++ b/openstack_dashboard/test/test_data/exceptions.py @@ -19,7 +19,7 @@ from neutronclient.common import exceptions as neutron_exceptions from novaclient import exceptions as nova_exceptions from swiftclient import client as swift_exceptions -from openstack_dashboard.test.test_data.utils import TestDataContainer +from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa def create_stubbed_exception(cls, status_code=500): diff --git a/openstack_dashboard/test/test_data/glance_data.py b/openstack_dashboard/test/test_data/glance_data.py index 1cd97e5106..439b380c4c 100644 --- a/openstack_dashboard/test/test_data/glance_data.py +++ b/openstack_dashboard/test/test_data/glance_data.py @@ -12,10 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -from glanceclient.v1.images import Image -from glanceclient.v1.images import ImageManager +from glanceclient.v1.images import Image # noqa +from glanceclient.v1.images import ImageManager # noqa -from openstack_dashboard.test.test_data.utils import TestDataContainer +from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa def data(TEST): diff --git a/openstack_dashboard/test/test_data/heat_data.py b/openstack_dashboard/test/test_data/heat_data.py index b05f3ff548..7ad575ba03 100644 --- a/openstack_dashboard/test/test_data/heat_data.py +++ b/openstack_dashboard/test/test_data/heat_data.py @@ -12,10 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -from heatclient.v1.stacks import Stack -from heatclient.v1.stacks import StackManager +from heatclient.v1.stacks import Stack # noqa +from heatclient.v1.stacks import StackManager # noqa -from openstack_dashboard.test.test_data.utils import TestDataContainer +from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa # A slightly hacked up copy of a sample cloudformation template for testing. diff --git a/openstack_dashboard/test/test_data/keystone_data.py b/openstack_dashboard/test/test_data/keystone_data.py index b891aca415..b737833540 100644 --- a/openstack_dashboard/test/test_data/keystone_data.py +++ b/openstack_dashboard/test/test_data/keystone_data.py @@ -12,12 +12,12 @@ # License for the specific language governing permissions and limitations # under the License. -from datetime import timedelta +from datetime import timedelta # noqa -from django.conf import settings +from django.conf import settings # noqa from django.utils import datetime_safe -from keystoneclient.access import AccessInfo +from keystoneclient.access import AccessInfo # noqa from keystoneclient.v2_0 import ec2 from keystoneclient.v2_0 import roles from keystoneclient.v2_0 import tenants @@ -25,9 +25,9 @@ from keystoneclient.v2_0 import users from keystoneclient.v3 import domains from keystoneclient.v3 import groups -from openstack_auth.user import Token +from openstack_auth.user import Token # noqa -from openstack_dashboard.test.test_data.utils import TestDataContainer +from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa # Dummy service catalog with all service. diff --git a/openstack_dashboard/test/test_data/neutron_data.py b/openstack_dashboard/test/test_data/neutron_data.py index cabf6b3fc4..654c389b04 100644 --- a/openstack_dashboard/test/test_data/neutron_data.py +++ b/openstack_dashboard/test/test_data/neutron_data.py @@ -15,20 +15,11 @@ import copy import uuid -from openstack_dashboard.api.lbaas import Member -from openstack_dashboard.api.lbaas import Pool -from openstack_dashboard.api.lbaas import PoolMonitor -from openstack_dashboard.api.lbaas import Vip +from openstack_dashboard.api import lbaas -from openstack_dashboard.api.neutron import FloatingIp -from openstack_dashboard.api.neutron import Network -from openstack_dashboard.api.neutron import Port -from openstack_dashboard.api.neutron import Router -from openstack_dashboard.api.neutron import SecurityGroup -from openstack_dashboard.api.neutron import SecurityGroupRule -from openstack_dashboard.api.neutron import Subnet +from openstack_dashboard.api import neutron -from openstack_dashboard.test.test_data.utils import TestDataContainer +from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa def data(TEST): @@ -85,9 +76,9 @@ def data(TEST): TEST.api_subnets.add(subnet_dict) network = copy.deepcopy(network_dict) - subnet = Subnet(subnet_dict) + subnet = neutron.Subnet(subnet_dict) network['subnets'] = [subnet] - TEST.networks.add(Network(network)) + TEST.networks.add(neutron.Network(network)) TEST.subnets.add(subnet) # ports on 1st network @@ -103,7 +94,7 @@ def data(TEST): 'status': 'ACTIVE', 'tenant_id': network_dict['tenant_id']} TEST.api_ports.add(port_dict) - TEST.ports.add(Port(port_dict)) + TEST.ports.add(neutron.Port(port_dict)) port_dict = {'admin_state_up': True, 'device_id': '1', @@ -117,7 +108,7 @@ def data(TEST): 'status': 'ACTIVE', 'tenant_id': network_dict['tenant_id']} TEST.api_ports.add(port_dict) - TEST.ports.add(Port(port_dict)) + TEST.ports.add(neutron.Port(port_dict)) assoc_port = port_dict #------------------------------------------------------------ @@ -150,9 +141,9 @@ def data(TEST): TEST.api_subnets.add(subnet_dict) network = copy.deepcopy(network_dict) - subnet = Subnet(subnet_dict) + subnet = neutron.Subnet(subnet_dict) network['subnets'] = [subnet] - TEST.networks.add(Network(network)) + TEST.networks.add(neutron.Network(network)) TEST.subnets.add(subnet) port_dict = {'admin_state_up': True, @@ -168,7 +159,7 @@ def data(TEST): 'tenant_id': network_dict['tenant_id']} TEST.api_ports.add(port_dict) - TEST.ports.add(Port(port_dict)) + TEST.ports.add(neutron.Port(port_dict)) #------------------------------------------------------------ # external network @@ -198,9 +189,9 @@ def data(TEST): TEST.api_subnets.add(subnet_dict) network = copy.deepcopy(network_dict) - subnet = Subnet(subnet_dict) + subnet = neutron.Subnet(subnet_dict) network['subnets'] = [subnet] - TEST.networks.add(Network(network)) + TEST.networks.add(neutron.Network(network)) TEST.subnets.add(subnet) #------------------------------------------------------------ @@ -217,7 +208,7 @@ def data(TEST): 'status': 'ACTIVE', 'tenant_id': '1'} TEST.api_ports.add(port_dict) - TEST.ports.add(Port(port_dict)) + TEST.ports.add(neutron.Port(port_dict)) router_dict = {'id': '279989f7-54bb-41d9-ba42-0d61f12fda61', 'name': 'router1', @@ -225,14 +216,14 @@ def data(TEST): {'network_id': ext_net['id']}, 'tenant_id': '1'} TEST.api_routers.add(router_dict) - TEST.routers.add(Router(router_dict)) + TEST.routers.add(neutron.Router(router_dict)) router_dict = {'id': '10e3dc42-1ce1-4d48-87cf-7fc333055d6c', 'name': 'router2', 'external_gateway_info': {'network_id': ext_net['id']}, 'tenant_id': '1'} TEST.api_routers.add(router_dict) - TEST.routers.add(Router(router_dict)) + TEST.routers.add(neutron.Router(router_dict)) #------------------------------------------------------------ # floating IP @@ -245,7 +236,7 @@ def data(TEST): 'port_id': None, 'router_id': None} TEST.api_q_floating_ips.add(fip_dict) - TEST.q_floating_ips.add(FloatingIp(fip_dict)) + TEST.q_floating_ips.add(neutron.FloatingIp(fip_dict)) # associated (with compute port on 1st network) fip_dict = {'tenant_id': '1', @@ -256,7 +247,7 @@ def data(TEST): 'port_id': assoc_port['id'], 'router_id': router_dict['id']} TEST.api_q_floating_ips.add(fip_dict) - TEST.q_floating_ips.add(FloatingIp(fip_dict)) + TEST.q_floating_ips.add(neutron.FloatingIp(fip_dict)) #------------------------------------------------------------ # security group @@ -335,10 +326,11 @@ def data(TEST): for rule in sg['security_group_rules']: TEST.api_q_secgroup_rules.add(copy.copy(rule)) # OpenStack Dashboard internaly API - TEST.q_secgroups.add(SecurityGroup(copy.deepcopy(sg), sg_name_dict)) + TEST.q_secgroups.add( + neutron.SecurityGroup(copy.deepcopy(sg), sg_name_dict)) for rule in sg['security_group_rules']: TEST.q_secgroup_rules.add( - SecurityGroupRule(copy.copy(rule), sg_name_dict)) + neutron.SecurityGroupRule(copy.copy(rule), sg_name_dict)) #------------------------------------------------------------ # LBaaS @@ -355,7 +347,7 @@ def data(TEST): 'health_monitors': ['d4a0500f-db2b-4cc4-afcf-ec026febff96'], 'admin_state_up': True} TEST.api_pools.add(pool_dict) - TEST.pools.add(Pool(pool_dict)) + TEST.pools.add(lbaas.Pool(pool_dict)) # 1st vip vip_dict = {'id': 'abcdef-c3eb-4fee-9763-12de3338041e', @@ -374,7 +366,7 @@ def data(TEST): 'connection_limit': 10, 'admin_state_up': True} TEST.api_vips.add(vip_dict) - TEST.vips.add(Vip(vip_dict)) + TEST.vips.add(lbaas.Vip(vip_dict)) # 2nd vip vip_dict = {'id': 'f0881d38-c3eb-4fee-9763-12de3338041d', @@ -393,7 +385,7 @@ def data(TEST): 'connection_limit': 10, 'admin_state_up': True} TEST.api_vips.add(vip_dict) - TEST.vips.add(Vip(vip_dict)) + TEST.vips.add(lbaas.Vip(vip_dict)) # 1st member member_dict = {'id': '78a46e5e-eb1a-418a-88c7-0e3f5968b08', @@ -404,7 +396,7 @@ def data(TEST): 'weight': 10, 'admin_state_up': True} TEST.api_members.add(member_dict) - TEST.members.add(Member(member_dict)) + TEST.members.add(lbaas.Member(member_dict)) # 2nd member member_dict = {'id': '41ac1f8d-6d9c-49a4-a1bf-41955e651f91', @@ -415,7 +407,7 @@ def data(TEST): 'weight': 10, 'admin_state_up': True} TEST.api_members.add(member_dict) - TEST.members.add(Member(member_dict)) + TEST.members.add(lbaas.Member(member_dict)) # 2nd pool pool_dict = {'id': '8913dde8-4915-4b90-8d3e-b95eeedb0d50', @@ -429,7 +421,7 @@ def data(TEST): 'health_monitors': ['d4a0500f-db2b-4cc4-afcf-ec026febff97'], 'admin_state_up': True} TEST.api_pools.add(pool_dict) - TEST.pools.add(Pool(pool_dict)) + TEST.pools.add(lbaas.Pool(pool_dict)) # 1st monitor monitor_dict = {'id': 'd4a0500f-db2b-4cc4-afcf-ec026febff96', @@ -442,7 +434,7 @@ def data(TEST): 'expected_codes': '200', 'admin_state_up': True} TEST.api_monitors.add(monitor_dict) - TEST.monitors.add(PoolMonitor(monitor_dict)) + TEST.monitors.add(lbaas.PoolMonitor(monitor_dict)) # 2nd monitor monitor_dict = {'id': 'd4a0500f-db2b-4cc4-afcf-ec026febff97', @@ -455,4 +447,4 @@ def data(TEST): 'expected_codes': '200', 'admin_state_up': True} TEST.api_monitors.add(monitor_dict) - TEST.monitors.add(PoolMonitor(monitor_dict)) + TEST.monitors.add(lbaas.PoolMonitor(monitor_dict)) diff --git a/openstack_dashboard/test/test_data/nova_data.py b/openstack_dashboard/test/test_data/nova_data.py index 1c5f0b10a3..1231fbb1f0 100644 --- a/openstack_dashboard/test/test_data/nova_data.py +++ b/openstack_dashboard/test/test_data/nova_data.py @@ -32,12 +32,11 @@ from novaclient.v1_1 import volume_snapshots as vol_snaps from novaclient.v1_1 import volume_types from novaclient.v1_1 import volumes -from openstack_dashboard.api.base import Quota -from openstack_dashboard.api.base import QuotaSet as QuotaSetWrapper -from openstack_dashboard.api.nova import FloatingIp as NetFloatingIp -from openstack_dashboard.usage.quotas import QuotaUsage +from openstack_dashboard.api import base +from openstack_dashboard.api import nova +from openstack_dashboard.usage import quotas as usage_quotas -from openstack_dashboard.test.test_data.utils import TestDataContainer +from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa SERVER_DATA = """ @@ -337,8 +336,8 @@ def data(TEST): security_groups='10', security_group_rules='20') quota = quotas.QuotaSet(quotas.QuotaSetManager(None), quota_data) - TEST.quotas.nova = QuotaSetWrapper(quota) - TEST.quotas.add(QuotaSetWrapper(quota)) + TEST.quotas.nova = base.QuotaSet(quota) + TEST.quotas.add(base.QuotaSet(quota)) # Quota Usages quota_usage_data = {'gigabytes': {'used': 0, @@ -353,9 +352,9 @@ def data(TEST): 'quota': 10}, 'volumes': {'used': 0, 'quota': 10}} - quota_usage = QuotaUsage() + quota_usage = usage_quotas.QuotaUsage() for k, v in quota_usage_data.items(): - quota_usage.add_quota(Quota(k, v['quota'])) + quota_usage.add_quota(base.Quota(k, v['quota'])) quota_usage.tally(k, v['used']) TEST.quota_usages.add(quota_usage) @@ -432,8 +431,8 @@ def data(TEST): 'pool': 'pool2'} TEST.api_floating_ips.add(generate_fip(fip_1), generate_fip(fip_2)) - TEST.floating_ips.add(NetFloatingIp(generate_fip(fip_1)), - NetFloatingIp(generate_fip(fip_2))) + TEST.floating_ips.add(nova.FloatingIp(generate_fip(fip_1)), + nova.FloatingIp(generate_fip(fip_2))) # Floating IP with UUID id (for Floating IP with Neutron Proxy) fip_3 = {'id': str(uuid.uuid4()), @@ -448,8 +447,8 @@ def data(TEST): 'pool': 'pool2'} TEST.api_floating_ips_uuid.add(generate_fip(fip_3), generate_fip(fip_4)) - TEST.floating_ips_uuid.add(NetFloatingIp(generate_fip(fip_3)), - NetFloatingIp(generate_fip(fip_4))) + TEST.floating_ips_uuid.add(nova.FloatingIp(generate_fip(fip_3)), + nova.FloatingIp(generate_fip(fip_4))) # Usage usage_vals = {"tenant_id": TEST.tenant.id, diff --git a/openstack_dashboard/test/test_data/swift_data.py b/openstack_dashboard/test/test_data/swift_data.py index ff3b530a69..3132df3b02 100644 --- a/openstack_dashboard/test/test_data/swift_data.py +++ b/openstack_dashboard/test/test_data/swift_data.py @@ -15,7 +15,7 @@ from openstack_dashboard.api import swift from openstack_dashboard.openstack.common import timeutils -from openstack_dashboard.test.test_data.utils import TestDataContainer +from openstack_dashboard.test.test_data.utils import TestDataContainer # noqa def data(TEST): diff --git a/openstack_dashboard/test/tests/error_pages.py b/openstack_dashboard/test/tests/error_pages.py index a889605e1e..a8d25df1a4 100644 --- a/openstack_dashboard/test/tests/error_pages.py +++ b/openstack_dashboard/test/tests/error_pages.py @@ -17,7 +17,7 @@ from os import path -from django.conf import settings +from django.conf import settings # noqa from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/test/tests/quotas.py b/openstack_dashboard/test/tests/quotas.py index 0da699f544..1efd3aafdb 100644 --- a/openstack_dashboard/test/tests/quotas.py +++ b/openstack_dashboard/test/tests/quotas.py @@ -22,7 +22,7 @@ from __future__ import absolute_import from django import http -from mox import IsA +from mox import IsA # noqa from openstack_dashboard import api from openstack_dashboard.api import cinder diff --git a/openstack_dashboard/test/tests/utils.py b/openstack_dashboard/test/tests/utils.py index 2096b26766..9cb552dbb7 100644 --- a/openstack_dashboard/test/tests/utils.py +++ b/openstack_dashboard/test/tests/utils.py @@ -18,25 +18,25 @@ import uuid from openstack_dashboard.test import helpers as test -from openstack_dashboard.utils.filters import get_int_or_uuid +from openstack_dashboard.utils import filters class UtilsFilterTests(test.TestCase): def test_accept_valid_integer(self): val = 100 - ret = get_int_or_uuid(val) + ret = filters.get_int_or_uuid(val) self.assertEqual(val, ret) def test_accept_valid_integer_string(self): val = '100' - ret = get_int_or_uuid(val) + ret = filters.get_int_or_uuid(val) self.assertEqual(int(val), ret) def test_accept_valid_uuid(self): val = str(uuid.uuid4()) - ret = get_int_or_uuid(val) + ret = filters.get_int_or_uuid(val) self.assertEqual(val, ret) def test_reject_random_string(self): val = '55WbJTpJDf' - self.assertRaises(ValueError, get_int_or_uuid, val) + self.assertRaises(ValueError, filters.get_int_or_uuid, val) diff --git a/openstack_dashboard/urls.py b/openstack_dashboard/urls.py index c4faae798e..151bb57783 100644 --- a/openstack_dashboard/urls.py +++ b/openstack_dashboard/urls.py @@ -22,12 +22,12 @@ URL patterns for the OpenStack Dashboard. """ -from django.conf import settings -from django.conf.urls.defaults import include -from django.conf.urls.defaults import patterns -from django.conf.urls.defaults import url -from django.conf.urls.static import static -from django.contrib.staticfiles.urls import staticfiles_urlpatterns +from django.conf import settings # noqa +from django.conf.urls.defaults import include # noqa +from django.conf.urls.defaults import patterns # noqa +from django.conf.urls.defaults import url # noqa +from django.conf.urls.static import static # noqa +from django.contrib.staticfiles.urls import staticfiles_urlpatterns # noqa import horizon diff --git a/openstack_dashboard/usage/__init__.py b/openstack_dashboard/usage/__init__.py index a1f6ef6137..50ff35d45f 100644 --- a/openstack_dashboard/usage/__init__.py +++ b/openstack_dashboard/usage/__init__.py @@ -14,13 +14,13 @@ # License for the specific language governing permissions and limitations # under the License. -from openstack_dashboard.usage.base import BaseUsage -from openstack_dashboard.usage.base import GlobalUsage -from openstack_dashboard.usage.base import ProjectUsage -from openstack_dashboard.usage.tables import BaseUsageTable -from openstack_dashboard.usage.tables import GlobalUsageTable -from openstack_dashboard.usage.tables import ProjectUsageTable -from openstack_dashboard.usage.views import UsageView +from openstack_dashboard.usage.base import BaseUsage # noqa +from openstack_dashboard.usage.base import GlobalUsage # noqa +from openstack_dashboard.usage.base import ProjectUsage # noqa +from openstack_dashboard.usage.tables import BaseUsageTable # noqa +from openstack_dashboard.usage.tables import GlobalUsageTable # noqa +from openstack_dashboard.usage.tables import ProjectUsageTable # noqa +from openstack_dashboard.usage.views import UsageView # noqa assert BaseUsage assert ProjectUsage diff --git a/openstack_dashboard/usage/base.py b/openstack_dashboard/usage/base.py index 445400c978..abf4c157d9 100644 --- a/openstack_dashboard/usage/base.py +++ b/openstack_dashboard/usage/base.py @@ -1,17 +1,17 @@ from __future__ import division -from csv import DictWriter -from csv import writer +from csv import DictWriter # noqa +from csv import writer # noqa import datetime import logging -from StringIO import StringIO +from StringIO import StringIO # noqa -from django.http import HttpResponse +from django.http import HttpResponse # noqa from django import template as django_template from django.utils import timezone -from django.utils.translation import ugettext_lazy as _ -from django import VERSION +from django.utils.translation import ugettext_lazy as _ # noqa +from django import VERSION # noqa from horizon import exceptions from horizon import forms @@ -271,7 +271,7 @@ class BaseCsvResponse(CsvDataMixin, HttpResponse): if VERSION >= (1, 5, 0): - from django.http import StreamingHttpResponse + from django.http import StreamingHttpResponse # noqa class BaseCsvStreamingResponse(CsvDataMixin, StreamingHttpResponse): diff --git a/openstack_dashboard/usage/quotas.py b/openstack_dashboard/usage/quotas.py index 1f799c0ae1..f210e5a0ae 100644 --- a/openstack_dashboard/usage/quotas.py +++ b/openstack_dashboard/usage/quotas.py @@ -1,11 +1,11 @@ -from collections import defaultdict +from collections import defaultdict # noqa import itertools from horizon import exceptions -from horizon.utils.memoized import memoized +from horizon.utils.memoized import memoized # noqa -from openstack_dashboard.api.base import is_service_enabled -from openstack_dashboard.api.base import QuotaSet +from openstack_dashboard.api.base import is_service_enabled # noqa +from openstack_dashboard.api.base import QuotaSet # noqa from openstack_dashboard.api import cinder from openstack_dashboard.api import network from openstack_dashboard.api import nova diff --git a/openstack_dashboard/usage/tables.py b/openstack_dashboard/usage/tables.py index cca842c360..f205c5136f 100644 --- a/openstack_dashboard/usage/tables.py +++ b/openstack_dashboard/usage/tables.py @@ -1,10 +1,10 @@ from django.core import urlresolvers -from django.template.defaultfilters import floatformat -from django.template.defaultfilters import timesince -from django.utils.translation import ugettext_lazy as _ +from django.template.defaultfilters import floatformat # noqa +from django.template.defaultfilters import timesince # noqa +from django.utils.translation import ugettext_lazy as _ # noqa from horizon import tables -from horizon.templatetags.sizeformat import mbformat +from horizon.templatetags.sizeformat import mbformat # noqa class CSVSummary(tables.LinkAction): diff --git a/openstack_dashboard/usage/views.py b/openstack_dashboard/usage/views.py index 702ea35788..630fb34566 100644 --- a/openstack_dashboard/usage/views.py +++ b/openstack_dashboard/usage/views.py @@ -1,7 +1,7 @@ import logging from horizon import tables -from openstack_dashboard.usage.base import BaseUsage +from openstack_dashboard.usage.base import BaseUsage # noqa LOG = logging.getLogger(__name__) diff --git a/openstack_dashboard/views.py b/openstack_dashboard/views.py index 75227e690f..176f3e9186 100644 --- a/openstack_dashboard/views.py +++ b/openstack_dashboard/views.py @@ -19,7 +19,7 @@ from django.views.decorators import vary import horizon -from openstack_auth.views import Login +from openstack_auth.views import Login # noqa def get_user_home(user): diff --git a/tox.ini b/tox.ini index 695fe96f96..4cc1311060 100644 --- a/tox.ini +++ b/tox.ini @@ -39,8 +39,7 @@ exclude = .venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,p # F403 'from import *' used; unable to detect undefined names # F999 syntax error in doctest # H102 Apache 2.0 license header not found -# H302 import only modules.'from optparse import make_option' does not import a module # H4xx docstrings # H701 empty localization string -# H702 Formatting operation should be outside of localization method call -ignore = E121,E126,E127,E128,F403,F999,H102,H302,H4,H701,H702 +# H702 Formatting operation should be outside of localization method call +ignore = E121,E126,E127,E128,F403,F999,H102,H4,H701,H702