Fixed small issues with parameters. It is required fix.

This commit is contained in:
Timur Nurlygayanov 2013-03-04 18:24:27 +04:00
parent 1c92f3ad22
commit 93044d53f6
6 changed files with 14 additions and 17 deletions

View File

@ -35,11 +35,11 @@ import pdb
LOG = logging.getLogger(__name__)
class WizardForm1(forms.Form):
class WizardFormServiceType(forms.Form):
_type = forms.ChoiceField(label=_("Service Type"))
class WizardForm2(forms.Form):
class WizardFormConfiguration(forms.Form):
subject = forms.CharField(max_length=100)
sender = forms.CharField(max_length=1)

View File

@ -81,8 +81,7 @@ class DeleteDataCenter(tables.BatchAction):
return True
def action(self, request, datacenter_id):
datacenter = api.windc.datacenters_get(request, datacenter_id)
api.windc.datacenters_delete(request, datacenter)
api.windc.datacenters_delete(request, datacenter_id)
class DeleteService(tables.BatchAction):
@ -101,9 +100,8 @@ class DeleteService(tables.BatchAction):
link = request.__dict__['META']['HTTP_REFERER']
datacenter_id = re.search('windc/(\S+)', link).group(0)[6:-1]
##############
datacenter = api.windc.datacenters_get(request, datacenter_id)
api.windc.services_delete(request, datacenter, service_id)
api.windc.services_delete(request, datacenter_id, service_id)
class EditService(tables.LinkAction):

View File

@ -22,7 +22,7 @@ from django.conf.urls.defaults import patterns, url
from .views import IndexView, CreateWinDCView, WinServices, CreateWinServiceView
from .views import Wizard
from .forms import WizardForm1, WizardForm2
from .forms import WizardFormServiceType, WizardFormConfiguration
VIEW_MOD = 'openstack_dashboard.dashboards.project.windc.views'
@ -32,7 +32,8 @@ urlpatterns = patterns(VIEW_MOD,
url(r'^create_dc$', CreateWinDCView.as_view(), name='create_dc'),
url(r'^(?P<data_center_id>[^/]+)/$', WinServices.as_view(),
name='services'),
url(r'^update$', Wizard.as_view([WizardForm2, WizardForm2]),
url(r'^update$',
Wizard.as_view([WizardFormServiceType, WizardFormConfiguration]),
name='update'),
url(r'^(?P<service_id>[^/]+)/$', WinServices.as_view(),
name='service_details')

View File

@ -40,7 +40,7 @@ from horizon.forms.views import ModalFormMixin
from openstack_dashboard import api
from .tables import WinDCTable, WinServicesTable
from .workflows import CreateWinService, CreateWinDC
from .forms import WizardForm1, WizardForm2
from .forms import WizardFormServiceType, WizardFormConfiguration
import pdb
LOG = logging.getLogger(__name__)
@ -57,7 +57,6 @@ class Wizard(ModalFormMixin, SessionWizardView, generic.FormView):
form = super(Wizard, self).get_form(step, data, files)
print step
print data
print files
return form
class IndexView(tables.DataTableView):

View File

@ -35,9 +35,9 @@ class DCManager(base.Manager):
body.update(extra)
return self._create('/datacenters', body, 'datacenter')
def delete(self, datacenter):
return self._delete("/datacenters/%s" % base.getid(datacenter))
def delete(self, datacenter_id):
return self._delete("/datacenters/%s" % datacenter_id)
def get(self, datacenter):
return self._get("/datacenters/%s" % base.getid(datacenter),
def get(self, datacenter_id):
return self._get("/datacenters/%s" % datacenter_id,
'datacenter')

View File

@ -37,10 +37,9 @@ class DCServiceManager(base.Manager):
return self._create("/datacenters/%s/services" % base.getid(datacenter),
body, 'service')
def delete(self, datacenter, service):
def delete(self, datacenter_id, service_id):
return self._delete("/datacenters/%s/services/%s" % \
(base.getid(datacenter),
base.getid(service)))
(datacenter_id, service_id))
def get(self, datacenter, service):
return self._get("/datacenters/%s/services/%s" % \