summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan OMara <jomara@redhat.com>2013-08-02 18:32:38 -0400
committerJordan OMara <jomara@redhat.com>2013-08-02 18:32:38 -0400
commit6c921037e94e61662479e970d9f7d3a2b193ed48 (patch)
treed6c8a1d99e964418cd4388637d6e900fded47034
parent24db898db911cef184e895aa4b841c644da446c5 (diff)
downloadtuskar-ui-6c921037e94e61662479e970d9f7d3a2b193ed48.tar.gz
Fixed ~70 PEP8 issues
-rw-r--r--horizon/tables/base.py9
-rw-r--r--horizon/workflows/base.py3
-rw-r--r--openstack_dashboard/dashboards/infrastructure/overview/panel.py2
-rw-r--r--openstack_dashboard/dashboards/infrastructure/overview/urls.py3
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/flavors/forms.py7
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/flavors/tests.py2
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/flavors/views.py8
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/nodes/tests.py6
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/nodes/urls.py3
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/racks/forms.py12
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/racks/tests.py13
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/racks/urls.py3
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/racks/views.py7
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/racks/workflows.py7
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/forms.py2
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tables.py5
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tabs.py3
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tests.py2
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/urls.py7
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/views.py5
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/workflows.py11
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/tests.py2
-rw-r--r--openstack_dashboard/dashboards/infrastructure/resource_management/urls.py8
23 files changed, 63 insertions, 67 deletions
diff --git a/horizon/tables/base.py b/horizon/tables/base.py
index 5e9ee06c..7a0edaed 100644
--- a/horizon/tables/base.py
+++ b/horizon/tables/base.py
@@ -462,15 +462,16 @@ class Row(html.HTMLElement):
# FIXME: TableStep code modified
# multi_select fields in the table must be checked after
# a server action
- # TODO: remove this ugly code and create proper TableFormWidget
+ # TODO(remove this ugly code and create proper TableFormWidget)
multi_select_values = []
if (getattr(table, 'request', False) and
- getattr(table.request, 'POST', False)):
+ getattr(table.request, 'POST', False)):
multi_select_values = table.request.POST.getlist(
- self.table._meta.multi_select_name)
+ self.table._meta.multi_select_name)
multi_select_values += getattr(table,
- 'active_multi_select_values', [])
+ 'active_multi_select_values',
+ [])
if unicode(table.get_object_id(datum)) in multi_select_values:
multi_select_value = lambda value: True
diff --git a/horizon/workflows/base.py b/horizon/workflows/base.py
index 44a7a4a8..60d8a1e9 100644
--- a/horizon/workflows/base.py
+++ b/horizon/workflows/base.py
@@ -31,8 +31,6 @@ from django.utils.translation import ugettext_lazy as _
# FIXME: TableStep
from django.utils.datastructures import SortedDict
-from django.template.defaultfilters import linebreaks, safe
-from django.forms.forms import NON_FIELD_ERRORS
from horizon import base
from horizon import exceptions
@@ -441,6 +439,7 @@ class Step(object):
"""
self.action.add_error(message)
+
# FIXME: TableStep
class TableStep(Step):
"""
diff --git a/openstack_dashboard/dashboards/infrastructure/overview/panel.py b/openstack_dashboard/dashboards/infrastructure/overview/panel.py
index e8aee3fe..59f31143 100644
--- a/openstack_dashboard/dashboards/infrastructure/overview/panel.py
+++ b/openstack_dashboard/dashboards/infrastructure/overview/panel.py
@@ -18,8 +18,6 @@ from django.utils.translation import ugettext_lazy as _
import horizon
-from openstack_dashboard.dashboards.infrastructure import dashboard
-
class Overview(horizon.Panel):
name = _("Overview")
diff --git a/openstack_dashboard/dashboards/infrastructure/overview/urls.py b/openstack_dashboard/dashboards/infrastructure/overview/urls.py
index d6e4d2d5..e09af394 100644
--- a/openstack_dashboard/dashboards/infrastructure/overview/urls.py
+++ b/openstack_dashboard/dashboards/infrastructure/overview/urls.py
@@ -14,7 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from django.conf.urls.defaults import patterns, url
+from django.conf.urls.defaults import patterns
+from django.conf.urls.defaults import url
from .views import IndexView
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/forms.py b/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/forms.py
index ef84a261..a859bf7f 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/forms.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/forms.py
@@ -13,9 +13,6 @@
# License for the specific language governing permissions and limitations
# under the License.
-import re
-
-from django.core import validators
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
@@ -70,7 +67,7 @@ class CreateFlavor(forms.SelfHandlingForm):
def handle(self, request, data):
try:
- flavor = api.tuskar.FlavorTemplate.create(
+ api.tuskar.FlavorTemplate.create(
request,
data['name'],
data['cpu'],
@@ -90,7 +87,7 @@ class EditFlavor(CreateFlavor):
def handle(self, request, data):
try:
- flavor = api.tuskar.FlavorTemplate.update(
+ api.tuskar.FlavorTemplate.update(
self.request,
self.initial['flavor_id'],
data['name'],
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/tests.py b/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/tests.py
index fbedce8f..6fb06e09 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/tests.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/tests.py
@@ -1,5 +1,5 @@
-from django import http
from django.core.urlresolvers import reverse
+from django import http
from mox import IsA
from openstack_dashboard import api
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/views.py b/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/views.py
index bd82666a..ed619917 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/views.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/flavors/views.py
@@ -13,24 +13,24 @@
# License for the specific language governing permissions and limitations
# under the License.
-from datetime import datetime, timedelta
+from datetime import datetime
+from datetime import timedelta
import json
import logging
from django.core.serializers.json import DjangoJSONEncoder
-from django.core.urlresolvers import reverse, reverse_lazy
+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.views.generic import View
from horizon import exceptions
from horizon import forms
-from horizon import tables
from horizon import tabs
from openstack_dashboard import api
from .forms import CreateFlavor, EditFlavor
-from .tables import FlavorsTable
from .tabs import FlavorDetailTabs
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/nodes/tests.py b/openstack_dashboard/dashboards/infrastructure/resource_management/nodes/tests.py
index 16865b8b..d352605d 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/nodes/tests.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/nodes/tests.py
@@ -1,8 +1,8 @@
+from django import http
from django.core.urlresolvers import reverse
-from openstack_dashboard.test import helpers as test
-from openstack_dashboard import api
from mox import IsA
-from django import http
+from openstack_dashboard import api
+from openstack_dashboard.test import helpers as test
class ResourceViewTests(test.BaseAdminViewTests):
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/nodes/urls.py b/openstack_dashboard/dashboards/infrastructure/resource_management/nodes/urls.py
index 5752b44d..cb53400d 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/nodes/urls.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/nodes/urls.py
@@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from django.conf.urls.defaults import patterns, url
+from django.conf.urls.defaults import patterns
+from django.conf.urls.defaults import url
from .views import DetailView
from .views import UnrackedView
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/racks/forms.py b/openstack_dashboard/dashboards/infrastructure/resource_management/racks/forms.py
index d525091a..3b3ce324 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/racks/forms.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/racks/forms.py
@@ -1,11 +1,7 @@
# vim: tabstop=4 shiftwidth=4 softtabstop=4
-import re
-
-from django.core import validators
-from django.utils.translation import ugettext_lazy as _
from django.forms import ValidationError
-from django import template
+from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import forms
@@ -13,10 +9,10 @@ from horizon import messages
from openstack_dashboard import api
-import csv
import base64
-import StringIO
+import csv
import logging
+import StringIO
LOG = logging.getLogger(__name__)
@@ -38,7 +34,7 @@ class UploadRack(forms.SelfHandlingForm):
else:
try:
CSVRack.from_str(data)
- except Exception as e:
+ except Exception:
LOG.exception("Failed to parse rack CSV file.")
raise ValidationError(_('Failed to parse CSV file.'))
return data
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/racks/tests.py b/openstack_dashboard/dashboards/infrastructure/resource_management/racks/tests.py
index 63e1ed1f..71d422f5 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/racks/tests.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/racks/tests.py
@@ -11,13 +11,16 @@
# under the License.
from django.core.urlresolvers import reverse
-from openstack_dashboard.test import helpers as test
-from openstack_dashboard import api
-from mox import IsA, IgnoreArg
from django import http
-import tempfile
+
+from mox import IgnoreArg
+from mox import IsA
+
+from openstack_dashboard import api
+from openstack_dashboard.test import helpers as test
+
import base64
-from django.core.files.uploadedfile import InMemoryUploadedFile
+import tempfile
class RackViewTests(test.BaseAdminViewTests):
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/racks/urls.py b/openstack_dashboard/dashboards/infrastructure/resource_management/racks/urls.py
index b41e6660..c3bad0e6 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/racks/urls.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/racks/urls.py
@@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from django.conf.urls import patterns, url, include
+from django.conf.urls import patterns
+from django.conf.urls import url
from .views import (CreateView, UploadView, EditView, DetailEditView,
EditRackStatusView, DetailView, UsageDataView)
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/racks/views.py b/openstack_dashboard/dashboards/infrastructure/resource_management/racks/views.py
index 8b66bc11..e21ca7da 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/racks/views.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/racks/views.py
@@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from datetime import datetime, timedelta
+from datetime import datetime
+from datetime import timedelta
import json
import logging
import random
@@ -27,16 +28,16 @@ from django.utils.translation import ugettext_lazy as _
from django.views.generic import View
from horizon import exceptions
-from horizon import tabs
from horizon import forms
+from horizon import tabs
from horizon import workflows
from .workflows import (CreateRack, EditRack, DetailEditRack)
from openstack_dashboard import api
from .forms import UploadRack, UpdateRackStatus
-from .tabs import RackDetailTabs
from .tables import UploadRacksTable
+from .tabs import RackDetailTabs
LOG = logging.getLogger(__name__)
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/racks/workflows.py b/openstack_dashboard/dashboards/infrastructure/resource_management/racks/workflows.py
index 8a133dd7..7c8c47c2 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/racks/workflows.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/racks/workflows.py
@@ -12,18 +12,15 @@
# License for the specific language governing permissions and limitations
# under the License.
-from django.core.urlresolvers import reverse, reverse_lazy
+from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
-from django.forms import widgets
from horizon import exceptions
-from horizon import workflows
from horizon import forms
+from horizon import workflows
from openstack_dashboard import api
-import re
-
class NodeCreateAction(workflows.Action):
# node_macs = forms.CharField(label=_("MAC Addresses"),
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/forms.py b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/forms.py
index 00dbda82..31d92c33 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/forms.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/forms.py
@@ -29,7 +29,7 @@ class DeleteForm(forms.SelfHandlingForm):
exceptions.handle(request, _("Unable to delete Resource Class."))
-# TODO this command will be reused in table, so code is not duplicated
+# TODO(this command will be reused in table, so code is not duplicated)
class DeleteCommand(object):
def __init__(self, request, resource_class):
self.resource_class = resource_class
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tables.py b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tables.py
index 3e0a7c5f..53772586 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tables.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tables.py
@@ -14,15 +14,12 @@
import logging
-from django import shortcuts
from django.core import urlresolvers
-from django.utils.http import urlencode
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
-from horizon import messages
-from horizon import tables
from horizon import forms
+from horizon import tables
from openstack_dashboard import api
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tabs.py b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tabs.py
index 0b667cad..0c2c61ac 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tabs.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tabs.py
@@ -17,7 +17,8 @@ from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
from horizon import tabs
-from tables import ResourceClassDetailFlavorsTable, RacksTable
+from tables import RacksTable
+from tables import ResourceClassDetailFlavorsTable
class OverviewTab(tabs.Tab):
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tests.py b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tests.py
index 67ec51f6..8c118cd6 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tests.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/tests.py
@@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from django import http
from django.core.urlresolvers import reverse
+from django import http
from mox import IsA
from openstack_dashboard import api
from openstack_dashboard.test import helpers as test
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/urls.py b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/urls.py
index c4f48fcf..218f0487 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/urls.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/urls.py
@@ -12,10 +12,11 @@
# License for the specific language governing permissions and limitations
# under the License.
-from django.conf.urls.defaults import patterns, url, include
+from django.conf.urls.defaults import patterns
+from django.conf.urls.defaults import url
-from .views import (CreateView, UpdateView, DetailView, UpdateRacksView,
- UpdateFlavorsView, DetailUpdateView, DetailActionView)
+from .views import (CreateView, DetailUpdateView, DetailActionView, DetailView,
+ UpdateFlavorsView, UpdateRacksView, UpdateView)
RESOURCE_CLASS = r'^(?P<resource_class_id>[^/]+)/%s$'
VIEW_MOD = 'openstack_dashboard.dashboards.infrastructure.' \
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/views.py b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/views.py
index a8c9e89c..a975776e 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/views.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/views.py
@@ -22,14 +22,14 @@ Views for managing resource classes
import logging
import random
-from django.core.urlresolvers import reverse_lazy, reverse
+from django.core.urlresolvers import reverse
from django.http import HttpResponse
from django.utils import simplejson
from django.utils.translation import ugettext_lazy as _
-from horizon import tabs
from horizon import exceptions
from horizon import forms
+from horizon import tabs
from horizon import workflows
from openstack_dashboard import api
@@ -38,7 +38,6 @@ from .forms import DeleteForm
from .workflows import (CreateResourceClass, UpdateResourceClass,
UpdateRacksWorkflow, UpdateFlavorsWorkflow,
DetailUpdateWorkflow)
-from .tables import ResourceClassesTable
from .tabs import ResourceClassDetailTabs
LOG = logging.getLogger(__name__)
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/workflows.py b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/workflows.py
index 24b7c4ae..ac96bf6c 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/workflows.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/resource_classes/workflows.py
@@ -17,14 +17,15 @@ from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from horizon import exceptions
-from horizon import workflows
from horizon import forms
+from horizon import workflows
from openstack_dashboard import api
import re
-from .tables import FlavorsTable, RacksTable
+from .tables import FlavorsTable
+from .tables import RacksTable
class ResourceClassInfoAndFlavorsAction(workflows.Action):
@@ -116,7 +117,7 @@ class CreateResourceClassInfoAndFlavors(workflows.TableStep):
self.workflow.request,
resource_class_id)
- # TODO: lsmola ugly interface, rewrite
+ # TODO(lsmola ugly interface, rewrite)
self._tables['flavors'].active_multi_select_values = \
resource_class.flavortemplates_ids
@@ -124,7 +125,7 @@ class CreateResourceClassInfoAndFlavors(workflows.TableStep):
else:
all_flavors = api.tuskar.FlavorTemplate.list(
self.workflow.request)
- except Exception, ex:
+ except Exception:
all_flavors = []
exceptions.handle(self.workflow.request,
_('Unable to retrieve resource flavors list.'))
@@ -159,7 +160,7 @@ class CreateRacks(workflows.TableStep):
resource_class = api.tuskar.ResourceClass.get(
self.workflow.request,
resource_class_id)
- # TODO: lsmola ugly interface, rewrite
+ # TODO(lsmola ugly interface, rewrite)
self._tables['racks'].active_multi_select_values = \
resource_class.racks_ids
racks = \
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/tests.py b/openstack_dashboard/dashboards/infrastructure/resource_management/tests.py
index 2535a5b4..612c48b0 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/tests.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/tests.py
@@ -14,8 +14,8 @@
# License for the specific language governing permissions and limitations
# under the License.
-from django import http
from django.core.urlresolvers import reverse
+from django import http
from mox import IsA
diff --git a/openstack_dashboard/dashboards/infrastructure/resource_management/urls.py b/openstack_dashboard/dashboards/infrastructure/resource_management/urls.py
index 89f462b8..cdd009d9 100644
--- a/openstack_dashboard/dashboards/infrastructure/resource_management/urls.py
+++ b/openstack_dashboard/dashboards/infrastructure/resource_management/urls.py
@@ -14,12 +14,14 @@
# License for the specific language governing permissions and limitations
# under the License.
-from django.conf.urls.defaults import patterns, url, include
+from django.conf.urls.defaults import include
+from django.conf.urls.defaults import patterns
+from django.conf.urls.defaults import url
from .flavors import urls as flavor_urls
-from .resource_classes import urls as resource_classes_urls
-from .racks import urls as rack_urls
from .nodes import urls as node_urls
+from .racks import urls as rack_urls
+from .resource_classes import urls as resource_classes_urls
from .views import IndexView
urlpatterns = patterns('',