1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2024-12-25 15:45:23 +00:00

Fixed pep8

This commit is contained in:
Retspen 2015-04-06 10:51:50 +03:00
parent 6a066f6e6d
commit 2aa5558df7
14 changed files with 110 additions and 89 deletions

View file

@ -6,7 +6,10 @@ env:
install: install:
- pip install -r dev/requirements.txt --use-mirrors - pip install -r dev/requirements.txt --use-mirrors
script: script:
- pep8 --exclude=IPy.py --ignore=E501 vrtManager accounts computes console create instances interfaces networks secrets storages - pep8 --exclude=IPy.py --ignore=E501 vrtManager accounts computes \
- pyflakes vrtManager accounts computes console create instances interfaces networks secrets storages 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 migrate
- python manage.py test --settings=webvirtcloud.settings-dev - python manage.py test --settings=webvirtcloud.settings-dev

View file

@ -5,9 +5,10 @@ from django.db import migrations
def add_useradmin(apps, schema_editor): def add_useradmin(apps, schema_editor):
from django.contrib.auth.models import User # from django.contrib.auth.models import User
# Broken in Django 1.8 # Broken in Django 1.8
#User.objects.create_superuser("admin", None, "admin") # User.objects.create_superuser("admin", None, "admin")
pass
class Migration(migrations.Migration): class Migration(migrations.Migration):

View file

@ -1,9 +1,11 @@
from django.conf.urls import url from django.conf.urls import url
from . import views from . import views
urlpatterns =[ urlpatterns = [
url(r'^login/$', 'django.contrib.auth.views.login', {'template_name': 'login.html'}, name='login'), url(r'^login/$', 'django.contrib.auth.views.login',
url(r'^logout/$', 'django.contrib.auth.views.logout', {'template_name': 'logout.html'}, name='logout'), {'template_name': 'login.html'}, name='login'),
url(r'^logout/$', 'django.contrib.auth.views.logout',
{'template_name': 'logout.html'}, name='logout'),
url(r'^profile/$', views.profile, name='profile'), url(r'^profile/$', views.profile, name='profile'),
url(r'^$', views.accounts, name='accounts'), url(r'^$', views.accounts, name='accounts'),
url(r'^profile/(?P<user_id>[0-9]+)/$', views.account, name='account'), url(r'^profile/(?P<user_id>[0-9]+)/$', views.account, name='account'),

View file

@ -1,5 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "Overview" %} - {{ compute.name }}{% endblock %} {% block title %}{% trans "Overview" %} - {{ compute.name }}{% endblock %}
{% block content %} {% block content %}
<!-- Page Heading --> <!-- Page Heading -->
@ -81,7 +82,7 @@
</div> </div>
{% endblock %} {% endblock %}
{% block script %} {% block script %}
<script src="{{ STATIC_URL }}js/Chart.min.js"></script> <script src="{% static "js/Chart.min.js" %}"></script>
<script> <script>
var cpuLineData = { var cpuLineData = {
labels : [0, 0, 0, 0, 0], labels : [0, 0, 0, 0, 0],

View file

@ -1,8 +1,9 @@
from django.conf.urls import url from django.conf.urls import url
from . import views from . import views
urlpatterns =[ urlpatterns = [
url(r'^$', views.computes, name='computes'), url(r'^$', views.computes, name='computes'),
url(r'^overview/(?P<compute_id>[0-9]+)/$', views.overview, name='overview'), url(r'^overview/(?P<compute_id>[0-9]+)/$', views.overview, name='overview'),
url(r'^statistics/(?P<compute_id>[0-9]+)/$', views.compute_graph, name='compute_graph'), url(r'^statistics/(?P<compute_id>[0-9]+)/$',
views.compute_graph, name='compute_graph'),
] ]

View file

@ -1,6 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load static %} {% load staticfiles %}
{% block title %}{% trans "Create new instance" %}{% endblock %} {% block title %}{% trans "Create new instance" %}{% endblock %}
{% block style %} {% block style %}
<link href="{% static "css/bootstrap-multiselect.css" %}" rel="stylesheet"> <link href="{% static "css/bootstrap-multiselect.css" %}" rel="stylesheet">
@ -410,7 +410,7 @@
}); });
}); });
</script> </script>
<script src="{{ STATIC_URL }}/js/ace.js" type="text/javascript" charset="utf-8"></script> <script src="{% static "js/ace.js" %}"></script>
<script> <script>
var editor = ace.edit("editor"); var editor = ace.edit("editor");
editor.getSession().setMode("ace/mode/xml"); editor.getSession().setMode("ace/mode/xml");

View file

@ -1,8 +1,9 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "Instances" %}{% endblock %} {% block title %}{% trans "Instances" %}{% endblock %}
{% block style %} {% block style %}
<link rel="stylesheet" href="{{ STATIC_URL }}/css/sortable-theme-bootstrap.css" /> <link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" />
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<!-- Page Heading --> <!-- Page Heading -->
@ -215,7 +216,7 @@
</div> </div>
{% endblock %} {% endblock %}
{% block script %} {% block script %}
<script src="{{ STATIC_URL }}js/sortable.min.js"></script> <script src="{% static "js/sortable.min.js" %}"></script>
<script> <script>
function open_console(uuid) { function open_console(uuid) {
window.open("{% url 'console' %}?token=" + uuid, "", "width=850,height=485"); window.open("{% url 'console' %}?token=" + uuid, "", "width=850,height=485");

View file

@ -1,8 +1,11 @@
from django.conf.urls import url from django.conf.urls import url
from . import views from . import views
urlpatterns =[ urlpatterns = [
url(r'^(?P<compute_id>[0-9]+)/(?P<vname>[\w\-\.]+)/$', views.instance, name='instance'), url(r'^(?P<compute_id>[0-9]+)/(?P<vname>[\w\-\.]+)/$',
url(r'^statistics/(?P<compute_id>[0-9]+)/(?P<vname>[\w\-\.]+)/$', views.inst_graph, name='inst_graph'), views.instance, name='instance'),
url(r'^status/(?P<compute_id>[0-9]+)/(?P<vname>[\w\-\.]+)/$', views.inst_status, name='inst_status'), url(r'^statistics/(?P<compute_id>[0-9]+)/(?P<vname>[\w\-\.]+)/$',
views.inst_graph, name='inst_graph'),
url(r'^status/(?P<compute_id>[0-9]+)/(?P<vname>[\w\-\.]+)/$',
views.inst_status, name='inst_status'),
] ]

View file

@ -1,5 +1,6 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "Interfaces" %} - {{ compute.name }}{% endblock %} {% block title %}{% trans "Interfaces" %} - {{ compute.name }}{% endblock %}
{% block content %} {% block content %}
<!-- Page Heading --> <!-- Page Heading -->
@ -65,29 +66,29 @@
</div> </div>
{% endblock %} {% endblock %}
{% block script %} {% block script %}
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$('#itype').change(function (eventObject) { $('#itype').change(function (eventObject) {
if ($(this).val() == 'bridge') { if ($(this).val() == 'bridge') {
$('.bridge_name_form_group').show(); $('.bridge_name_form_group').show();
} else { } else {
$('.bridge_name_form_group').hide(); $('.bridge_name_form_group').hide();
} }
}).change(); }).change();
$('#ipv4').change(function (eventObject) { $('#ipv4').change(function (eventObject) {
if ($(this).val() == 'static') { if ($(this).val() == 'static') {
$('.static_ipv4_form_group').show(); $('.static_ipv4_form_group').show();
} else { } else {
$('.static_ipv4_form_group').hide(); $('.static_ipv4_form_group').hide();
} }
}).change(); }).change();
$('#ipv6').change(function (eventObject) { $('#ipv6').change(function (eventObject) {
if ($(this).val() == 'static') { if ($(this).val() == 'static') {
$('.static_ipv6_form_group').show(); $('.static_ipv6_form_group').show();
} else { } else {
$('.static_ipv6_form_group').hide(); $('.static_ipv6_form_group').hide();
} }
}).change(); }).change();
}); });
</script> </script>
{% endblock %} {% endblock %}

View file

@ -2,9 +2,7 @@
from __future__ import unicode_literals from __future__ import unicode_literals
from django.db import models, migrations from django.db import models, migrations
import datetime
from django.conf import settings from django.conf import settings
from django.utils.timezone import utc
class Migration(migrations.Migration): class Migration(migrations.Migration):

View file

@ -147,41 +147,41 @@
{% endif %} {% endif %}
{% endblock %} {% endblock %}
{% block script %} {% block script %}
<script> <script>
$.expr[':'].Contains = $.expr.createPseudo(function (arg) { $.expr[':'].Contains = $.expr.createPseudo(function (arg) {
return function (elem) { return function (elem) {
return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0; return $(elem).text().toUpperCase().indexOf(arg.toUpperCase()) >= 0;
}; };
});
$(document).ready(function () {
// add event button labeled "filter"
$('#filter_button').click(function (event) {
// get value
var filter_val = $('#filter_input').val();
if (filter_val == '') {
// show all
$('tbody tr').show();
} else {
// show only matches
$('tbody tr:Contains(\'' + filter_val + '\')').show();
// hide non-matching items
$('tbody tr:not(:Contains(\'' + filter_val + '\'))').hide();
}
}); });
$(document).ready(function () { // add event button labeled "clear"
// add event button labeled "filter" $('#filter_clear').click(function (event) {
$('#filter_button').click(function (event) { $('#filter_input').val('');
// get value $('#filter_button').click();
var filter_val = $('#filter_input').val(); });
if (filter_val == '') {
// show all
$('tbody tr').show();
} else {
// show only matches
$('tbody tr:Contains(\'' + filter_val + '\')').show();
// hide non-matching items
$('tbody tr:not(:Contains(\'' + filter_val + '\'))').hide();
}
});
// add event button labeled "clear" // trigger filter when enter key pressed
$('#filter_clear').click(function (event) { $('#filter_input').keyup(function (event) {
$('#filter_input').val(''); if (event.keyCode == 13) {
$('#filter_button').click(); $('#filter_button').click();
}); }
// trigger filter when enter key pressed
$('#filter_input').keyup(function (event) {
if (event.keyCode == 13) {
$('#filter_button').click();
}
});
}); });
</script> });
</script>
{% endblock %} {% endblock %}

View file

@ -1,8 +1,9 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "Secrets" %} - {{ compute.name }}{% endblock %} {% block title %}{% trans "Secrets" %} - {{ compute.name }}{% endblock %}
{% block style %} {% block style %}
<link rel="stylesheet" href="{{ STATIC_URL }}/css/sortable-theme-bootstrap.css" /> <link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" />
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<!-- Page Heading --> <!-- Page Heading -->
@ -117,5 +118,5 @@
</div> </div>
{% endblock %} {% endblock %}
{% block script %} {% block script %}
<script src="{{ STATIC_URL }}/js/sortable.min.js"></script> <script src="{% static "js/sortable.min.js" %}"></script>
{% endblock %} {% endblock %}

View file

@ -1,8 +1,9 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load i18n %} {% load i18n %}
{% load staticfiles %}
{% block title %}{% trans "Storage" %} - {{ pool }}{% endblock %} {% block title %}{% trans "Storage" %} - {{ pool }}{% endblock %}
{% block style %} {% block style %}
<link rel="stylesheet" href="{{ STATIC_URL }}css/sortable-theme-bootstrap.css" /> <link rel="stylesheet" href="{% static "css/sortable-theme-bootstrap.css" %}" />
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<!-- Page Heading --> <!-- Page Heading -->
@ -186,7 +187,7 @@
</div> </div>
{% endblock %} {% endblock %}
{% block script %} {% block script %}
<script src="{{ STATIC_URL }}/js/sortable.min.js"></script> <script src="{% static "js/sortable.min.js" %}"></script>
<script> <script>
$('.format-convert').hide(); $('.format-convert').hide();
$(document).on('change', '.volume-convert', function () { $(document).on('change', '.volume-convert', function () {

View file

@ -9,14 +9,22 @@ urlpatterns = patterns('',
url(r'^accounts/', include('accounts.urls')), url(r'^accounts/', include('accounts.urls')),
url(r'^computes/', include('computes.urls')), url(r'^computes/', include('computes.urls')),
url(r'^compute/(?P<compute_id>[0-9]+)/storages/$', 'storages.views.storages', name='storages'), url(r'^compute/(?P<compute_id>[0-9]+)/storages/$',
url(r'^compute/(?P<compute_id>[0-9]+)/storage/(?P<pool>[\w\-\.]+)/$', 'storages.views.storage', name='storage'), 'storages.views.storages', name='storages'),
url(r'^compute/(?P<compute_id>[0-9]+)/networks/$', 'networks.views.networks', name='networks'), url(r'^compute/(?P<compute_id>[0-9]+)/storage/(?P<pool>[\w\-\.]+)/$',
url(r'^compute/(?P<compute_id>[0-9]+)/network/(?P<pool>[\w\-\.]+)/$', 'networks.views.network', name='network'), 'storages.views.storage', name='storage'),
url(r'^compute/(?P<compute_id>[0-9]+)/interfaces/$', 'interfaces.views.interfaces', name='interfaces'), url(r'^compute/(?P<compute_id>[0-9]+)/networks/$',
url(r'^compute/(?P<compute_id>[0-9]+)/interface/(?P<iface>[\w\-\.\:]+)/$', 'interfaces.views.interface', name='interface'), 'networks.views.networks', name='networks'),
url(r'^compute/(?P<compute_id>[0-9]+)/secrets/$', 'secrets.views.secrets', name='secrets'), url(r'^compute/(?P<compute_id>[0-9]+)/network/(?P<pool>[\w\-\.]+)/$',
url(r'^compute/(?P<compute_id>[0-9]+)/create/$', 'create.views.create_instance', name='create_instance'), 'networks.views.network', name='network'),
url(r'^compute/(?P<compute_id>[0-9]+)/interfaces/$',
'interfaces.views.interfaces', name='interfaces'),
url(r'^compute/(?P<compute_id>[0-9]+)/interface/(?P<iface>[\w\-\.\:]+)/$',
'interfaces.views.interface', name='interface'),
url(r'^compute/(?P<compute_id>[0-9]+)/secrets/$',
'secrets.views.secrets', name='secrets'),
url(r'^compute/(?P<compute_id>[0-9]+)/create/$',
'create.views.create_instance', name='create_instance'),
url(r'^console/$', 'console.views.console', name='console'), url(r'^console/$', 'console.views.console', name='console'),
url(r'^logs/$', 'logs.views.showlogs', name='showlogs'), url(r'^logs/$', 'logs.views.showlogs', name='showlogs'),