mirror of
https://github.com/retspen/webvirtcloud
synced 2024-11-01 03:54:15 +00:00
Fixed pep8
This commit is contained in:
parent
b9bf14fdb5
commit
56f840c893
13 changed files with 37 additions and 18 deletions
12
.travis.yml
Normal file
12
.travis.yml
Normal file
|
@ -0,0 +1,12 @@
|
|||
language: python
|
||||
python:
|
||||
- "2.7"
|
||||
env:
|
||||
- DJANGO=1.7.7
|
||||
install:
|
||||
- pip install -r dev/requirements.txt --use-mirrors
|
||||
script:
|
||||
- pep8 --exclude=IPy.py --ignore=E501 vrtManager accounts computes console create instances interfaces networks secrets storages
|
||||
- pyflakes vrtManager accounts computes console create instances interfaces networks secrets storages
|
||||
- python manage.py migrate
|
||||
- python manage.py test --settings=webvirtcloud.settings-dev
|
|
@ -6,8 +6,8 @@ from django.contrib.auth.models import User
|
|||
|
||||
class UserAddForm(forms.Form):
|
||||
name = forms.CharField(label="Name",
|
||||
error_messages={'required': _('No User name has been entered')},
|
||||
max_length=20)
|
||||
error_messages={'required': _('No User name has been entered')},
|
||||
max_length=20)
|
||||
password = forms.CharField(required=True, error_messages={'required': _('No password has been entered')},)
|
||||
|
||||
def clean_name(self):
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
|
||||
def add_admin(apps, schema_editor):
|
||||
add_user = User.objects.create_user("admin", None, "admin")
|
||||
add_user.is_active = True
|
||||
|
@ -11,6 +12,7 @@ def add_admin(apps, schema_editor):
|
|||
add_user.is_staff = True
|
||||
add_user.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
|
|
|
@ -122,7 +122,7 @@ def account(request, user_id):
|
|||
instances = Instance.objects.all()
|
||||
|
||||
if user.username == request.user.username:
|
||||
return HttpResponseRedirect(reverse('profile'))
|
||||
return HttpResponseRedirect(reverse('profile'))
|
||||
|
||||
if request.method == 'POST':
|
||||
if 'delete' in request.POST:
|
||||
|
|
|
@ -37,7 +37,7 @@ def computes(request):
|
|||
'type': compute.type,
|
||||
'login': compute.login,
|
||||
'password': compute.password
|
||||
})
|
||||
})
|
||||
return compute_data
|
||||
|
||||
error_messages = []
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models, migrations
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
def add_favors(apps, schema_editor):
|
||||
Flavor = apps.get_model("create", "Flavor")
|
||||
|
@ -18,6 +19,7 @@ def add_favors(apps, schema_editor):
|
|||
add_flavor = Flavor(label="xlarge", vcpu="8", memory="16384", disk="160")
|
||||
add_flavor.save()
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
|
|
|
@ -1,2 +1,5 @@
|
|||
Django==1.7.7
|
||||
websockify==0.6.0
|
||||
pep8==1.6.2
|
||||
pyflakes==0.8.1
|
||||
pylint==1.4.3
|
|
@ -234,7 +234,7 @@ def instance(request, compute_id, vname):
|
|||
conn.force_shutdown()
|
||||
msg = _("Force Off")
|
||||
addlogmsg(request.user.id, instance.id, msg)
|
||||
return HttpResponseRedirect(request.get_full_path() + '#powerforce')
|
||||
return HttpResponseRedirect(request.get_full_path() + '#powerforce')
|
||||
|
||||
if 'delete' in request.POST:
|
||||
if conn.get_status() == 1:
|
||||
|
@ -547,7 +547,7 @@ def inst_graph(request, compute_id, vname):
|
|||
json_net.append({'dev': net['dev'], 'data': [datasets_rx, datasets_tx]})
|
||||
datasets_net[net['dev']] = [datasets_rx, datasets_tx]
|
||||
|
||||
data = json.dumps({'cpudata': datasets['cpu'], 'blkdata': json_blk, 'netdata': json_net, 'timeline': datasets['timer']})
|
||||
data = json.dumps({'cpudata': datasets['cpu'], 'blkdata': json_blk, 'netdata': json_net, 'timeline': datasets['timer']})
|
||||
|
||||
response.cookies['cpu'] = datasets['cpu']
|
||||
response.cookies['timer'] = datasets['timer']
|
||||
|
|
|
@ -132,7 +132,7 @@ def storage(request, compute_id, pool):
|
|||
if 'delete' in request.POST:
|
||||
try:
|
||||
conn.delete()
|
||||
return HttpResponseRedirect(reverse('storages', args=[host_id]))
|
||||
return HttpResponseRedirect(reverse('storages', args=[compute_id]))
|
||||
except libvirtError as lib_err:
|
||||
error_messages.append(lib_err.message)
|
||||
if 'set_autostart' in request.POST:
|
||||
|
|
Loading…
Reference in a new issue