Fix pep8 violations

This commit is contained in:
Gary W. Smith 2015-04-09 15:31:13 -07:00
parent 2dd906428c
commit 72cdc8488d
33 changed files with 157 additions and 159 deletions

View File

@ -62,6 +62,7 @@ def timesince_sortable(dt):
return mark_safe("<span data-seconds=\"%d\">%s</span>" % return mark_safe("<span data-seconds=\"%d\">%s</span>" %
(seconds, timesince(dt))) (seconds, timesince(dt)))
@register.filter @register.filter
def get_item(dictionary, key): def get_item(dictionary, key):
return dictionary.get(key) return dictionary.get(key)

View File

@ -156,8 +156,8 @@ def share_network_get(request, share_net_id):
def share_network_update(request, share_net_id, name=None, description=None): def share_network_update(request, share_net_id, name=None, description=None):
return manilaclient(request).share_networks.update(share_net_id, return manilaclient(request).share_networks.update(
name=name, description=description) share_net_id, name=name, description=description)
def share_network_delete(request, share_network_id): def share_network_delete(request, share_network_id):
@ -165,7 +165,8 @@ def share_network_delete(request, share_network_id):
def security_service_list(request, search_opts=None): def security_service_list(request, search_opts=None):
return manilaclient(request).security_services.list(detailed=True, return manilaclient(request).security_services.list(
detailed=True,
search_opts=search_opts) search_opts=search_opts)

View File

@ -71,7 +71,7 @@ class QuotasTable(tables.DataTable):
def get_object_id(self, obj): def get_object_id(self, obj):
return obj.name return obj.name
class Meta: class Meta(object):
name = "quotas" name = "quotas"
verbose_name = _("Quotas") verbose_name = _("Quotas")
table_actions = (QuotaFilterAction, UpdateDefaultQuotas) table_actions = (QuotaFilterAction, UpdateDefaultQuotas)

View File

@ -38,7 +38,8 @@ class CreateShareType(forms.SelfHandlingForm):
name = forms.CharField(max_length="255", label=_("Name")) name = forms.CharField(max_length="255", label=_("Name"))
spec_driver_handles_share_servers = forms.CharField( spec_driver_handles_share_servers = forms.CharField(
max_length="5", label=_("Driver handles share servers")) max_length="5", label=_("Driver handles share servers"))
extra_specs = forms.CharField(required=False, label=_("Extra specs"), extra_specs = forms.CharField(
required=False, label=_("Extra specs"),
widget=forms.widgets.Textarea(attrs=ST_EXTRA_SPECS_FORM_ATTRS)) widget=forms.widgets.Textarea(attrs=ST_EXTRA_SPECS_FORM_ATTRS))
def handle(self, request, data): def handle(self, request, data):
@ -86,7 +87,8 @@ class UpdateShareType(forms.SelfHandlingForm):
es_str += "%s=%s\r\n" % (k, v) es_str += "%s=%s\r\n" % (k, v)
self.initial["extra_specs"] = es_str self.initial["extra_specs"] = es_str
extra_specs = forms.CharField(required=False, label=_("Extra specs"), extra_specs = forms.CharField(
required=False, label=_("Extra specs"),
widget=forms.widgets.Textarea(attrs=ST_EXTRA_SPECS_FORM_ATTRS)) widget=forms.widgets.Textarea(attrs=ST_EXTRA_SPECS_FORM_ATTRS))
def handle(self, request, data): def handle(self, request, data):

View File

@ -80,7 +80,7 @@ class ShareTypesTable(tables.DataTable):
def get_object_id(self, share_type): def get_object_id(self, share_type):
return str(share_type.id) return str(share_type.id)
class Meta: class Meta(object):
name = "share_types" name = "share_types"
verbose_name = _("Share Types") verbose_name = _("Share Types")
table_actions = (CreateShareType, DeleteShareType, table_actions = (CreateShareType, DeleteShareType,
@ -115,7 +115,7 @@ class SharesTable(shares_tables.SharesTable):
verbose_name=_("Share Server"), verbose_name=_("Share Server"),
link=get_share_server_link) link=get_share_server_link)
class Meta: class Meta(object):
name = "shares" name = "shares"
verbose_name = _("Shares") verbose_name = _("Shares")
status_columns = ["status"] status_columns = ["status"]
@ -188,7 +188,7 @@ class SnapshotsTable(tables.DataTable):
def get_object_display(self, obj): def get_object_display(self, obj):
return obj.name return obj.name
class Meta: class Meta(object):
name = "snapshots" name = "snapshots"
verbose_name = _("Snapshots") verbose_name = _("Snapshots")
status_columns = ["status"] status_columns = ["status"]
@ -257,7 +257,7 @@ class SecurityServiceTable(tables.DataTable):
def get_object_id(self, security_service): def get_object_id(self, security_service):
return str(security_service.id) return str(security_service.id)
class Meta: class Meta(object):
name = "security_services" name = "security_services"
verbose_name = _("Security Services") verbose_name = _("Security Services")
table_actions = (DeleteSecurityService,) table_actions = (DeleteSecurityService,)
@ -307,13 +307,14 @@ class ShareNetworkTable(tables.DataTable):
def get_object_id(self, share_network): def get_object_id(self, share_network):
return str(share_network.id) return str(share_network.id)
class Meta: class Meta(object):
name = "share_networks" name = "share_networks"
verbose_name = _("Share Networks") verbose_name = _("Share Networks")
table_actions = (DeleteShareNetwork, ) table_actions = (DeleteShareNetwork, )
row_class = UpdateShareNetworkRow row_class = UpdateShareNetworkRow
row_actions = (DeleteShareNetwork, ) row_actions = (DeleteShareNetwork, )
class SharesServersFilterAction(tables.FilterAction): class SharesServersFilterAction(tables.FilterAction):
def filter(self, table, shares, filter_string): def filter(self, table, shares, filter_string):
@ -355,7 +356,7 @@ class ShareServerTable(tables.DataTable):
def get_object_id(self, share_server): def get_object_id(self, share_server):
return six.text_type(share_server.id) return six.text_type(share_server.id)
class Meta: class Meta(object):
name = "share_servers" name = "share_servers"
status_columns = ["status"] status_columns = ["status"]
verbose_name = _("Share Server") verbose_name = _("Share Server")

View File

@ -21,12 +21,12 @@ from horizon import tabs
from openstack_dashboard.api import neutron from openstack_dashboard.api import neutron
from manila_ui.api import manila from manila_ui.api import manila
from manila_ui.dashboards.admin.shares.tables import SharesTable
from manila_ui.dashboards.admin.shares.tables import SnapshotsTable
from manila_ui.dashboards.admin.shares.tables import SecurityServiceTable from manila_ui.dashboards.admin.shares.tables import SecurityServiceTable
from manila_ui.dashboards.admin.shares.tables import ShareNetworkTable from manila_ui.dashboards.admin.shares.tables import ShareNetworkTable
from manila_ui.dashboards.admin.shares.tables import ShareServerTable from manila_ui.dashboards.admin.shares.tables import ShareServerTable
from manila_ui.dashboards.admin.shares.tables import SharesTable
from manila_ui.dashboards.admin.shares.tables import ShareTypesTable from manila_ui.dashboards.admin.shares.tables import ShareTypesTable
from manila_ui.dashboards.admin.shares.tables import SnapshotsTable
from manila_ui.dashboards.admin.shares import utils from manila_ui.dashboards.admin.shares import utils

View File

@ -21,7 +21,8 @@ from manila_ui.dashboards.project.shares.share_networks\
from manila_ui.dashboards.project.shares.snapshots\ from manila_ui.dashboards.project.shares.snapshots\
import views as project_snapshot_views import views as project_snapshot_views
urlpatterns = patterns('', urlpatterns = patterns(
'',
url(r'^$', views.IndexView.as_view(), name='index'), url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<share_id>[^/]+)/$', views.DetailView.as_view(), name='detail'), url(r'^(?P<share_id>[^/]+)/$', views.DetailView.as_view(), name='detail'),
url(r'^snapshots/(?P<snapshot_id>[^/]+)$', url(r'^snapshots/(?P<snapshot_id>[^/]+)$',

View File

@ -79,6 +79,7 @@ class UpdateShareTypeView(forms.ModalFormView):
"extra_specs": share_type.extra_specs, "extra_specs": share_type.extra_specs,
} }
class ShareServDetail(tabs.TabView): class ShareServDetail(tabs.TabView):
tab_group_class = project_tabs.ShareServerDetailTabs tab_group_class = project_tabs.ShareServerDetailTabs
template_name = 'admin/shares/detail_share_server.html' template_name = 'admin/shares/detail_share_server.html'

View File

@ -66,8 +66,7 @@ class Create(forms.SelfHandlingForm):
security_service = manila.security_service_create( security_service = manila.security_service_create(
request, **data) request, **data)
messages.success(request, _('Successfully created security ' messages.success(request, _('Successfully created security '
'service: %s') 'service: %s') % data['name'])
% data['name'])
return security_service return security_service
except Exception: except Exception:
exceptions.handle(request, exceptions.handle(request,
@ -77,8 +76,8 @@ class Create(forms.SelfHandlingForm):
class Update(forms.SelfHandlingForm): class Update(forms.SelfHandlingForm):
name = forms.CharField(max_length="255", label=_("Share Name")) name = forms.CharField(max_length="255", label=_("Share Name"))
description = forms.CharField(widget=forms.Textarea, description = forms.CharField(
label=_("Description"), required=False) widget=forms.Textarea, label=_("Description"), required=False)
def handle(self, request, data): def handle(self, request, data):
sec_service_id = self.initial['sec_service_id'] sec_service_id = self.initial['sec_service_id']
@ -87,8 +86,8 @@ class Update(forms.SelfHandlingForm):
name=data['name'], name=data['name'],
description=data['description']) description=data['description'])
message = _('Successfully updated security service "%s"')\ message = _('Successfully updated security service '
% data['name'] '"%s"') % data['name']
messages.success(request, message) messages.success(request, message)
return True return True
except Exception: except Exception:

View File

@ -58,7 +58,7 @@ class SecurityServiceTable(tables.DataTable):
def get_object_id(self, security_service): def get_object_id(self, security_service):
return str(security_service.id) return str(security_service.id)
class Meta: class Meta(object):
name = "security_services" name = "security_services"
verbose_name = _("Security Services") verbose_name = _("Security Services")
table_actions = (Create, Delete) table_actions = (Create, Delete)

View File

@ -15,7 +15,6 @@
# under the License. # under the License.
from django.core.urlresolvers import NoReverseMatch # noqa from django.core.urlresolvers import NoReverseMatch # noqa
from django.core.urlresolvers import reverse
from django.template.defaultfilters import title # noqa from django.template.defaultfilters import title # noqa
from django.utils.translation import string_concat # noqa from django.utils.translation import string_concat # noqa
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
@ -25,7 +24,6 @@ from horizon import tables
from manila_ui.api import manila from manila_ui.api import manila
from openstack_dashboard.api import neutron from openstack_dashboard.api import neutron
from openstack_dashboard.usage import quotas
DELETABLE_STATES = ("INACTIVE", "ERROR") DELETABLE_STATES = ("INACTIVE", "ERROR")
@ -64,7 +62,7 @@ class EditShareNetwork(tables.LinkAction):
policy_rules = (("share", "share_network:update"),) policy_rules = (("share", "share_network:update"),)
def allowed(self, request, obj_id): def allowed(self, request, obj_id):
sn = manila.share_network_get(request, obj_id) # sn = manila.share_network_get(request, obj_id)
# return sn.status in EDITABLE_STATES # return sn.status in EDITABLE_STATES
# NOTE: leave it always True, until statuses become used # NOTE: leave it always True, until statuses become used
return True return True
@ -112,7 +110,7 @@ class ShareNetworkTable(tables.DataTable):
def get_object_id(self, share_network): def get_object_id(self, share_network):
return str(share_network.id) return str(share_network.id)
class Meta: class Meta(object):
name = "share_networks" name = "share_networks"
verbose_name = _("Share Networks") verbose_name = _("Share Networks")
table_actions = (Create, Delete, ) table_actions = (Create, Delete, )

View File

@ -42,7 +42,7 @@ class ShareNetworksViewTests(test.TestCase):
api.neutron.subnet_list = mock.Mock(return_value=self.subnets.list()) api.neutron.subnet_list = mock.Mock(return_value=self.subnets.list())
api.manila.share_network_create = mock.Mock() api.manila.share_network_create = mock.Mock()
url = reverse('horizon:project:shares:create_share_network') url = reverse('horizon:project:shares:create_share_network')
res = self.client.post(url, formData) self.client.post(url, formData)
api.manila.share_network_create.assert_called_with( api.manila.share_network_create.assert_called_with(
mock.ANY, name=formData['name'], neutron_net_id=neutron_net_id, mock.ANY, name=formData['name'], neutron_net_id=neutron_net_id,
neutron_subnet_id=formData['subnet-choices-%s' % neutron_net_id], neutron_subnet_id=formData['subnet-choices-%s' % neutron_net_id],

View File

@ -36,7 +36,7 @@ class UpdateShareNetworkInfoAction(workflows.Action):
self.fields['name'].initial = share_network.name self.fields['name'].initial = share_network.name
self.fields['description'].initial = share_network.description self.fields['description'].initial = share_network.description
class Meta: class Meta(object):
name = _("Share Network Info") name = _("Share Network Info")
help_text = _("From here you can update share network info. ") help_text = _("From here you can update share network info. ")
slug = "update-share_network_info" slug = "update-share_network_info"
@ -83,7 +83,7 @@ class AddSecurityServiceAction(workflows.MembershipAction):
self.fields[field_name].choices = sec_services_choices self.fields[field_name].choices = sec_services_choices
self.fields[field_name].initial = sec_services_initial self.fields[field_name].initial = sec_services_initial
class Meta: class Meta(object):
name = _("Security services within share network") name = _("Security services within share network")
slug = "add_security_service" slug = "add_security_service"
@ -125,7 +125,8 @@ class UpdateShareNetworkWorkflow(workflows.Workflow):
name=context['name']) name=context['name'])
sec_services = manila.security_service_list(request, search_opts={ sec_services = manila.security_service_list(request, search_opts={
'share_network_id': context['id']}) 'share_network_id': context['id']})
sec_services_old = set([sec_service.id for sec_service in sec_services]) sec_services_old = set([sec_service.id
for sec_service in sec_services])
sec_services_new = set(context['security_service']) sec_services_new = set(context['security_service'])
for sec_service in sec_services_new - sec_services_old: for sec_service in sec_services_new - sec_services_old:
manila.share_network_security_service_add(request, manila.share_network_security_service_add(request,

View File

@ -82,9 +82,9 @@ class CreateForm(forms.SelfHandlingForm):
self.fields['share_type'].initial = orig_share.share_type self.fields['share_type'].initial = orig_share.share_type
except Exception: except Exception:
pass pass
self.fields['size'].help_text = _('Share size must be equal ' self.fields['size'].help_text = _(
'to or greater than the snapshot size (%sGB)') \ 'Share size must be equal to or greater than the snapshot '
% snapshot.size 'size (%sGB)') % snapshot.size
del self.fields['share_source_type'] del self.fields['share_source_type']
except Exception: except Exception:
exceptions.handle(request, exceptions.handle(request,
@ -129,7 +129,8 @@ class CreateForm(forms.SelfHandlingForm):
[(sn.id, sn.name or sn.id) for sn in share_networks]) [(sn.id, sn.name or sn.id) for sn in share_networks])
sn_field_name = self.sn_field_name_prefix + st.name sn_field_name = self.sn_field_name_prefix + st.name
sn_field = forms.ChoiceField( sn_field = forms.ChoiceField(
label=_("Share Network"), required=True, choices=sn_choices, label=_("Share Network"), required=True,
choices=sn_choices,
widget=forms.Select(attrs={ widget=forms.Select(attrs={
'class': 'switched', 'class': 'switched',
'data-switch-on': 'sharetype', 'data-switch-on': 'sharetype',
@ -173,8 +174,8 @@ class CreateForm(forms.SelfHandlingForm):
data["snapshot"]) data["snapshot"])
snapshot_id = snapshot.id snapshot_id = snapshot.id
if (data['size'] < snapshot.size): if (data['size'] < snapshot.size):
error_message = _('The share size cannot be less than ' error_message = _('The share size cannot be less than the '
'the snapshot size (%sGB)') % snapshot.size 'snapshot size (%sGB)') % snapshot.size
raise ValidationError(error_message) raise ValidationError(error_message)
else: else:
if type(data['size']) is str: if type(data['size']) is str:

View File

@ -121,7 +121,8 @@ class UpdateRow(tables.Row):
if not share.name: if not share.name:
share.name = share_id share.name = share_id
if share.share_network_id: if share.share_network_id:
share_net = manila.share_network_get(request, share.share_network_id) share_net = manila.share_network_get(request,
share.share_network_id)
share.share_network = share_net.name or share_net.id share.share_network = share_net.name or share_net.id
else: else:
share.share_network = None share.share_network = None
@ -229,7 +230,7 @@ class RulesTable(tables.DataTable):
def get_object_display(self, obj): def get_object_display(self, obj):
return obj.id return obj.id
class Meta: class Meta(object):
name = "rules" name = "rules"
verbose_name = _("Rules") verbose_name = _("Rules")
status_columns = ["status"] status_columns = ["status"]
@ -253,7 +254,7 @@ class SharesTable(SharesTableBase):
verbose_name=_("Share Network"), verbose_name=_("Share Network"),
empty_value="-") empty_value="-")
class Meta: class Meta(object):
name = "shares" name = "shares"
verbose_name = _("Shares") verbose_name = _("Shares")
status_columns = ["status"] status_columns = ["status"]

View File

@ -40,7 +40,7 @@ class ShareViewTests(test.TestCase):
api.manila.share_snapshot_list = mock.Mock(return_value=[]) api.manila.share_snapshot_list = mock.Mock(return_value=[])
api.manila.share_network_list = mock.Mock(return_value=share_nets) api.manila.share_network_list = mock.Mock(return_value=share_nets)
url = reverse('horizon:project:shares:create') url = reverse('horizon:project:shares:create')
res = self.client.post(url, formData) self.client.post(url, formData)
api.manila.share_create.assert_called_with( api.manila.share_create.assert_called_with(
mock.ANY, formData['size'], formData['name'], mock.ANY, formData['size'], formData['name'],
formData['description'], formData['type'], snapshot_id=None, formData['description'], formData['type'], snapshot_id=None,
@ -94,7 +94,7 @@ class ShareViewTests(test.TestCase):
api.manila.share_network_list = mock.Mock(return_value=share_nets) api.manila.share_network_list = mock.Mock(return_value=share_nets)
url = reverse('horizon:project:shares:create') url = reverse('horizon:project:shares:create')
url = url + '?snapshot_id=%s' % snapshot.id url = url + '?snapshot_id=%s' % snapshot.id
res = self.client.post(url, formData) self.client.post(url, formData)
api.manila.share_create.assert_called_with( api.manila.share_create.assert_called_with(
mock.ANY, formData['size'], formData['name'], mock.ANY, formData['size'], formData['name'],
formData['description'], formData['type'], snapshot_id=None, formData['description'], formData['type'], snapshot_id=None,
@ -180,7 +180,8 @@ class ShareViewTests(test.TestCase):
api.manila.share_allow.assert_called_once_with( api.manila.share_allow.assert_called_once_with(
mock.ANY, share.id, access_type=formData['type'], mock.ANY, share.id, access_type=formData['type'],
access=formData['access_to']) access=formData['access_to'])
self.assertRedirectsNoFollow(res, self.assertRedirectsNoFollow(
res,
reverse('horizon:project:shares:manage_rules', args=[share.id])) reverse('horizon:project:shares:manage_rules', args=[share.id]))
def test_delete_rule(self): def test_delete_rule(self):
@ -195,6 +196,6 @@ class ShareViewTests(test.TestCase):
api.manila.share_rules_list = mock.Mock( api.manila.share_rules_list = mock.Mock(
return_value=[rule]) return_value=[rule])
url = reverse('horizon:project:shares:manage_rules', args=[share.id]) url = reverse('horizon:project:shares:manage_rules', args=[share.id])
res = self.client.post(url, formData) self.client.post(url, formData)
api.manila.share_deny.assert_called_with( api.manila.share_deny.assert_called_with(
mock.ANY, test_data.share.id, rule.id) mock.ANY, test_data.share.id, rule.id)

View File

@ -33,7 +33,8 @@ from manila_ui.api import manila
class CreateSnapshotForm(forms.SelfHandlingForm): class CreateSnapshotForm(forms.SelfHandlingForm):
name = forms.CharField(max_length="255", label=_("Snapshot Name")) name = forms.CharField(max_length="255", label=_("Snapshot Name"))
description = forms.CharField(widget=forms.Textarea, description = forms.CharField(
widget=forms.Textarea,
label=_("Description"), required=False) label=_("Description"), required=False)
def __init__(self, request, *args, **kwargs): def __init__(self, request, *args, **kwargs):
@ -46,8 +47,7 @@ class CreateSnapshotForm(forms.SelfHandlingForm):
def handle(self, request, data): def handle(self, request, data):
try: try:
share = manila.share_get(request, share = manila.share_get(request, data['share_id'])
data['share_id'])
force = False force = False
message = _('Creating share snapshot "%s".') % data['name'] message = _('Creating share snapshot "%s".') % data['name']
if share.status == 'in-use': if share.status == 'in-use':

View File

@ -157,7 +157,7 @@ class SnapshotsTable(tables.DataTable):
def get_object_display(self, obj): def get_object_display(self, obj):
return obj.name return obj.name
class Meta: class Meta(object):
name = "snapshots" name = "snapshots"
verbose_name = _("Snapshots") verbose_name = _("Snapshots")
status_columns = ["status"] status_columns = ["status"]

View File

@ -39,7 +39,7 @@ class SnapshotSnapshotViewTests(test.TestCase):
api.manila.share_get = mock.Mock(return_value=share) api.manila.share_get = mock.Mock(return_value=share)
url = reverse('horizon:project:shares:create_snapshot', url = reverse('horizon:project:shares:create_snapshot',
args=[share.id]) args=[share.id])
res = self.client.post(url, formData) self.client.post(url, formData)
api.manila.share_snapshot_create.assert_called_with( api.manila.share_snapshot_create.assert_called_with(
mock.ANY, share.id, formData['name'], formData['description'], mock.ANY, share.id, formData['name'], formData['description'],
force=False) force=False)

View File

@ -13,17 +13,18 @@
# under the License. # under the License.
import collections import collections
from manilaclient.v1 import quotas
from manilaclient.v1 import security_services from manilaclient.v1 import security_services
from manilaclient.v1 import share_networks from manilaclient.v1 import share_networks
from manilaclient.v1 import share_snapshots from manilaclient.v1 import share_snapshots
from manilaclient.v1 import shares from manilaclient.v1 import shares
from manilaclient.v1 import quotas
from openstack_dashboard import api from openstack_dashboard import api
from openstack_dashboard.usage import quotas as usage_quotas from openstack_dashboard.usage import quotas as usage_quotas
share = shares.Share(shares.ShareManager(None), share = shares.Share(
shares.ShareManager(None),
{'id': "11023e92-8008-4c8b-8059-7f2293ff3887", {'id': "11023e92-8008-4c8b-8059-7f2293ff3887",
'status': 'available', 'status': 'available',
'size': 40, 'size': 40,
@ -31,10 +32,10 @@ share = shares.Share(shares.ShareManager(None),
'description': 'Share description', 'description': 'Share description',
'share_proto': 'NFS', 'share_proto': 'NFS',
'created_at': '2014-01-27 10:30:00', 'created_at': '2014-01-27 10:30:00',
'share_network_id': 'share_network_id': '7f3d1c33-8d00-4511-29df-a2def31f3b5d'})
'7f3d1c33-8d00-4511-29df-a2def31f3b5d'})
nameless_share = shares.Share(shares.ShareManager(None), nameless_share = shares.Share(
shares.ShareManager(None),
{'id': "4b069dd0-6eaa-4272-8abc-5448a68f1cce", {'id': "4b069dd0-6eaa-4272-8abc-5448a68f1cce",
'status': 'available', 'status': 'available',
'size': 10, 'size': 10,
@ -44,10 +45,10 @@ nameless_share = shares.Share(shares.ShareManager(None),
'export_location': "/dev/hda", 'export_location': "/dev/hda",
'created_at': '2010-11-21 18:34:25', 'created_at': '2010-11-21 18:34:25',
'share_type': 'vol_type_1', 'share_type': 'vol_type_1',
'share_network_id': 'share_network_id': '7f3d1c33-8d00-4511-29df-a2def31f3b5d'})
'7f3d1c33-8d00-4511-29df-a2def31f3b5d'})
other_share = shares.Share(shares.ShareManager(None), other_share = shares.Share(
shares.ShareManager(None),
{'id': "21023e92-8008-1234-8059-7f2293ff3889", {'id': "21023e92-8008-1234-8059-7f2293ff3889",
'status': 'in-use', 'status': 'in-use',
'size': 10, 'size': 10,
@ -56,8 +57,7 @@ other_share = shares.Share(shares.ShareManager(None),
'share_proto': 'NFS', 'share_proto': 'NFS',
'created_at': '2013-04-01 10:30:00', 'created_at': '2013-04-01 10:30:00',
'share_type': None, 'share_type': None,
'share_network_id': 'share_network_id': '7f3d1c33-8d00-4511-29df-a2def31f3b5d'})
'7f3d1c33-8d00-4511-29df-a2def31f3b5d'})
rule = collections.namedtuple('Access', ['access_type', 'access_to', 'status', rule = collections.namedtuple('Access', ['access_type', 'access_to', 'status',
'id']) 'id'])
@ -114,14 +114,10 @@ quota_data = dict(shares='1',
quota = quotas.QuotaSet(quotas.QuotaSetManager(None), quota_data) quota = quotas.QuotaSet(quotas.QuotaSetManager(None), quota_data)
# Quota Usages # Quota Usages
quota_usage_data = {'gigabytes': {'used': 0, quota_usage_data = {'gigabytes': {'used': 0, 'quota': 1000},
'quota': 1000}, 'shares': {'used': 0, 'quota': 10},
'shares': {'used': 0, 'snapshots': {'used': 0, 'quota': 10},
'quota': 10}, 'share_networks': {'used': 0, 'quota': 10}}
'snapshots': {'used': 0,
'quota': 10},
'share_networks': {'used': 0,
'quota': 10}}
quota_usage = usage_quotas.QuotaUsage() quota_usage = usage_quotas.QuotaUsage()
for k, v in quota_usage_data.items(): for k, v in quota_usage_data.items():
quota_usage.add_quota(api.base.Quota(k, v['quota'])) quota_usage.add_quota(api.base.Quota(k, v['quota']))

View File

@ -28,7 +28,8 @@ from manila_ui.dashboards.project.shares.snapshots\
from manila_ui.dashboards.project.shares import views from manila_ui.dashboards.project.shares import views
urlpatterns = patterns('openstack_dashboard.dashboards.project.shares.views', urlpatterns = patterns(
'openstack_dashboard.dashboards.project.shares.views',
url(r'^$', views.IndexView.as_view(), name='index'), url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^create/$', shares_views.CreateView.as_view(), name='create'), url(r'^create/$', shares_views.CreateView.as_view(), name='create'),
url(r'^create_security_service$', url(r'^create_security_service$',

View File

@ -8,12 +8,6 @@ Babel>=1.3
Django>=1.4.2,<1.7 Django>=1.4.2,<1.7
django_compressor>=1.4 django_compressor>=1.4
django_openstack_auth>=1.1.7,!=1.1.8 django_openstack_auth>=1.1.7,!=1.1.8
eventlet>=0.16.1
kombu>=2.5.0
iso8601>=0.1.9 iso8601>=0.1.9
netaddr>=0.7.12
os-cloud-config
python-keystoneclient>=1.1.0 python-keystoneclient>=1.1.0
pytz>=2013.6
python-manilaclient>=1.0.2 python-manilaclient>=1.0.2

View File

@ -3,7 +3,6 @@
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
hacking<0.11,>=0.10.0 hacking<0.11,>=0.10.0
coverage>=3.6 coverage>=3.6
discover discover
python-subunit>=0.0.18 python-subunit>=0.0.18

10
tox.ini
View File

@ -1,6 +1,6 @@
[tox] [tox]
minversion = 1.6 minversion = 1.6
envlist = py33,py34,py26,py27,pypy,pep8 envlist = py33,py34,py27,pep8
skipsdist = True skipsdist = True
[testenv] [testenv]
@ -28,9 +28,9 @@ commands = python setup.py build_sphinx
commands = oslo_debug_helper {posargs} commands = oslo_debug_helper {posargs}
[flake8] [flake8]
# E123, E125 skipped as they are invalid PEP-8.
show-source = True show-source = True
ignore = E123,E125 # E123, E125 skipped as they are invalid PEP-8.
# H405 multi line docstring summary not separated with an empty line
ignore = E123,E125,H405
builtins = _ builtins = _
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build,.ropeproject