Permalink
Browse files

Merge pull request #22 from klrmn/pep8

Pep8.  Looks great!  thanks for doing this!!
  • Loading branch information...
camd committed Feb 20, 2013
2 parents 99e61d5 + fcc0885 commit ab95db20d32eb21e57630615b10b926b659c334e
Showing with 255 additions and 214 deletions.
  1. +4 −1 moztrap/deploy/paths.py
  2. +3 −2 moztrap/deploy/vendor_wsgi.py
  3. +4 −2 moztrap/deploy/wsgi.py
  4. +2 −2 moztrap/model/attachments/migrations/0001_initial.py
  5. +2 −2 moztrap/model/core/api.py
  6. +1 −0 moztrap/model/core/fixture_gen.py
  7. +2 −2 moztrap/model/core/management/commands/create_default_roles.py
  8. +0 −1 moztrap/model/core/management/commands/import.py
  9. +3 −2 moztrap/model/core/migrations/0001_initial.py
  10. +3 −2 moztrap/model/core/migrations/0002_auto__del_unique_productversion_product_version.py
  11. +3 −2 moztrap/model/core/migrations/0003_auto__add_field_productversion_cc_version__add_field_product.py
  12. +1 −0 moztrap/model/core/migrations/0004_fix_dupe_emails.py
  13. +1 −0 moztrap/model/core/migrations/0005_add_manage_products_permission_for_test_managers.py
  14. +1 −1 moztrap/model/core/migrations/0006_auto__add_apikey.py
  15. +1 −1 ...el/core/migrations/0007_auto__chg_field_productversion_modified_by__chg_field_productversion_c.py
  16. +0 −2 moztrap/model/environments/api.py
  17. +1 −0 moztrap/model/environments/fixture_gen.py
  18. +3 −2 moztrap/model/environments/migrations/0001_initial.py
  19. +3 −2 ...onments/migrations/0002_auto__add_field_profile_cc_version__add_field_element_cc_version__add_.py
  20. +1 −1 ...onments/migrations/0003_auto__chg_field_profile_modified_by__chg_field_profile_created_by__chg.py
  21. +5 −8 moztrap/model/execution/api.py
  22. +1 −0 moztrap/model/execution/fixture_gen.py
  23. +3 −2 moztrap/model/execution/migrations/0001_initial.py
  24. +3 −2 ...ecution/migrations/0002_auto__add_field_runcaseversion_cc_version__add_field_run_cc_version__a.py
  25. +1 −1 moztrap/model/execution/migrations/0003_auto.py
  26. +2 −1 moztrap/model/execution/migrations/0004_auto__chg_field_result_started.py
  27. +1 −1 moztrap/model/execution/migrations/0005_auto__add_field_result_is_latest.py
  28. +1 −1 ...rap/model/execution/migrations/0006_auto__del_field_result_started__del_field_result_completed.py
  29. +1 −1 moztrap/model/execution/migrations/0007_auto__del_field_result_reviewed_on.py
  30. +1 −1 ...ecution/migrations/0008_auto__chg_field_runcaseversion_modified_by__chg_field_runcaseversion_d.py
  31. +1 −1 ...ecution/migrations/0009_auto__add_field_run_build__add_field_run_is_series__add_field_run_seri.py
  32. +1 −1 moztrap/model/execution/migrations/0010_auto.py
  33. +1 −3 moztrap/model/execution/models.py
  34. +23 −2 moztrap/model/library/api.py
  35. +2 −0 moztrap/model/library/bulk.py
  36. +1 −0 moztrap/model/library/fixture_gen.py
  37. +1 −1 moztrap/model/library/importer.py
  38. +3 −2 moztrap/model/library/migrations/0001_initial.py
  39. +3 −2 ...library/migrations/0002_auto__del_unique_suitecase_case_suite__del_unique_caseversion_case_pro.py
  40. +3 −2 ...library/migrations/0003_auto__add_field_suite_cc_version__add_field_suitecase_cc_version__add_.py
  41. +1 −1 moztrap/model/library/migrations/0004_auto__add_field_caseattachment_name.py
  42. +1 −1 moztrap/model/library/migrations/0005_auto__add_field_case_idprefix.py
  43. +1 −1 ...library/migrations/0006_auto__chg_field_suite_modified_by__chg_field_suite_created_by__chg_fie.py
  44. +1 −1 moztrap/model/library/migrations/0007_auto__chg_field_caseversion_name.py
  45. +1 −1 moztrap/model/migrations/preferences/0001_initial.py
  46. +9 −8 moztrap/model/mtapi.py
  47. +2 −2 moztrap/model/mtmodel.py
  48. +1 −2 moztrap/model/tags/api.py
  49. +1 −0 moztrap/model/tags/fixture_gen.py
  50. +3 −2 moztrap/model/tags/migrations/0001_initial.py
  51. +3 −2 moztrap/model/tags/migrations/0002_auto__del_unique_tag_name.py
  52. +3 −2 moztrap/model/tags/migrations/0003_auto__add_field_tag_cc_version.py
  53. +1 −1 ...el/tags/migrations/0004_auto__chg_field_tag_modified_by__chg_field_tag_created_by__chg_field_t.py
  54. +1 −1 moztrap/model/tags/migrations/0005_auto__add_field_tag_description.py
  55. +3 −3 moztrap/settings/base.py
  56. +2 −3 moztrap/settings/default.py
  57. +1 −0 moztrap/view/lists/cases.py
  58. +2 −0 moztrap/view/lists/filters.py
  59. +4 −4 moztrap/view/lists/pagination.py
  60. +1 −1 moztrap/view/lists/sort.py
  61. +0 −2 moztrap/view/lists/templatetags/filters.py
  62. +2 −4 moztrap/view/manage/cases/forms.py
  63. +2 −2 moztrap/view/manage/environments/decorators.py
  64. +2 −2 moztrap/view/manage/environments/views.py
  65. +1 −1 moztrap/view/manage/runs/forms.py
  66. +2 −2 moztrap/view/manage/tags/views.py
  67. +1 −1 moztrap/view/runtests/views.py
  68. +1 −1 moztrap/view/templatetags/site.py
  69. +1 −1 moztrap/view/users/forms.py
  70. +2 −1 moztrap/view/utils/mtforms.py
  71. +3 −3 tests/case/api/base.py
  72. +8 −8 tests/model/core/api/test_product_resource.py
  73. +5 −5 tests/model/core/api/test_productversion_env_resource.py
  74. +1 −1 tests/model/core/api/test_productversion_resource.py
  75. +0 −1 tests/model/core/models/test_user.py
  76. +5 −5 tests/model/environments/api/test_category_resource.py
  77. +5 −5 tests/model/environments/api/test_element_resource.py
  78. +5 −5 tests/model/environments/api/test_environment_resource.py
  79. +8 −8 tests/model/execution/api/test_result.py
  80. +5 −8 tests/model/execution/api/test_run.py
  81. +6 −6 tests/model/execution/api/test_runcaseversion.py
  82. +1 −1 tests/model/execution/models/test_result.py
  83. +7 −5 tests/model/execution/models/test_run.py
  84. +1 −1 tests/model/execution/models/test_runcaseversion.py
  85. +1 −1 tests/model/library/api/test_case_resource.py
  86. +3 −3 tests/model/library/api/test_caseversion_resource.py
  87. +8 −8 tests/model/library/api/test_suite_resource.py
  88. +2 −2 tests/model/library/test_bulk.py
  89. +3 −2 tests/model/library/test_importer.py
  90. +10 −10 tests/model/tags/api/test_tags_resource.py
  91. +1 −0 tests/model/test_mtadmin.py
  92. +2 −0 tests/view/lists/test_actions.py
  93. +2 −2 tests/view/lists/test_filters.py
  94. +1 −1 tests/view/lists/test_sort.py
  95. +5 −5 tests/view/manage/cases/test_forms.py
  96. +1 −1 tests/view/manage/tags/test_forms.py
  97. +0 −2 tests/view/runtests/templatetags/test_execution.py
  98. +1 −1 tests/view/runtests/test_forms.py
  99. +1 −1 tests/view/users/test_views.py
  100. +1 −1 tests/view/utils/test_mtforms.py
View
@@ -2,7 +2,10 @@
Utility functions for deployment-related path-munging.
"""
import os, sys, site
import os
import sys
import site
def add_vendor_lib():
@@ -1,9 +1,10 @@
"""
"""
Alternative WSGI entry-point that uses requirements/vendor for
dependencies.
"""
import os, sys
import os
import sys
base_dir = os.path.dirname(
os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
View
@@ -1,5 +1,7 @@
"WSGI entry-point for MozTrap."""
import os, sys
"""WSGI entry-point for MozTrap."""
import os
import sys
base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.insert(0, base_dir)
@@ -14,7 +14,7 @@ def backwards(self, orm):
pass
models = {
}
complete_apps = ['attachments']
complete_apps = ['attachments']
@@ -11,6 +11,7 @@
import logging
logger = logging.getLogger(__name__)
class ReportResultsAuthorization(MTAuthorization):
"""Authorization that only allows users with execute privileges."""
@@ -131,7 +132,7 @@ def obj_update(self, bundle, request=None, **kwargs):
productversions = bundle.data.pop("productversions", [])
bundle.data["productversions"] = []
updated_bundle = super(ProductResource, self).obj_update(
updated_bundle = super(ProductResource, self).obj_update(
bundle=bundle, request=request, **kwargs)
# create the productversions
@@ -166,4 +167,3 @@ class Meta:
queryset = User.objects.all()
list_allowed_methods = ['get']
fields = ["id", "username"]
@@ -11,6 +11,7 @@
from .models import Product, ProductVersion
@fixture_generator(
Product, ProductVersion, requires=[
"environments.sample_environments", "core.sample_users"])
@@ -50,7 +50,7 @@ def handle_noargs(self, **options):
if not created:
if verbosity:
print("Role %r already exists; skipping." % role_name)
continue # pragma: no cover http://bugs.python.org/issue2506
continue # pragma: no cover http://bugs.python.org/issue2506
if verbosity:
print("Role %r created." % role_name)
@@ -64,7 +64,7 @@ def handle_noargs(self, **options):
except Permission.DoesNotExist:
if verbosity:
print(" Permission %r unknown; skipping." % perm_label)
continue # pragma: no cover http://bugs.python.org/issue2506
continue # pragma: no cover http://bugs.python.org/issue2506
role.permissions.add(perm)
@@ -128,4 +128,3 @@ def handle(self, *args, **options):
'Could not open "{0}", I/O error {1}: {2}'.format(
args[2], errno, strerror)
)
@@ -4,10 +4,11 @@
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Product'
db.create_table('core_product', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
@@ -70,7 +71,7 @@ def forwards(self, orm):
def backwards(self, orm):
# Removing unique constraint on 'ProductVersion', fields ['product', 'version']
db.delete_unique('core_productversion', ['product_id', 'version'])
@@ -4,16 +4,17 @@
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Removing unique constraint on 'ProductVersion', fields ['product', 'version']
db.delete_unique('core_productversion', ['product_id', 'version'])
def backwards(self, orm):
# Adding unique constraint on 'ProductVersion', fields ['product', 'version']
db.create_unique('core_productversion', ['product_id', 'version'])
@@ -4,10 +4,11 @@
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'ProductVersion.cc_version'
db.add_column('core_productversion', 'cc_version', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
@@ -16,7 +17,7 @@ def forwards(self, orm):
def backwards(self, orm):
# Deleting field 'ProductVersion.cc_version'
db.delete_column('core_productversion', 'cc_version')
@@ -4,6 +4,7 @@
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
@@ -5,6 +5,7 @@
from django.core.exceptions import ObjectDoesNotExist
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
@@ -165,4 +165,4 @@ def backwards(self, orm):
}
}
complete_apps = ['core']
complete_apps = ['core']
@@ -150,4 +150,4 @@ def backwards(self, orm):
}
}
complete_apps = ['core']
complete_apps = ['core']
@@ -36,5 +36,3 @@ class Meta:
list_allowed_methods = ['get']
fields = ["id"]
filtering = {"elements": ALL}
@@ -6,6 +6,7 @@
from ..core.auth import User
from .models import Profile, Environment, Element, Category
@fixture_generator(
Profile, Category, Element, Environment, requires=["core.sample_users"])
def sample_environments():
@@ -4,10 +4,11 @@
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'Profile'
db.create_table('environments_profile', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
@@ -71,7 +72,7 @@ def forwards(self, orm):
def backwards(self, orm):
# Deleting model 'Profile'
db.delete_table('environments_profile')
@@ -4,10 +4,11 @@
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'Profile.cc_version'
db.add_column('environments_profile', 'cc_version', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
@@ -22,7 +23,7 @@ def forwards(self, orm):
def backwards(self, orm):
# Deleting field 'Profile.cc_version'
db.delete_column('environments_profile', 'cc_version')
@@ -102,4 +102,4 @@ def backwards(self, orm):
}
}
complete_apps = ['environments']
complete_apps = ['environments']
@@ -99,14 +99,14 @@ def dehydrate(self, bundle):
def dispatch_detail(self, request, **kwargs):
"""For details, we want the full info on environments for the run """
self.fields["environments"].full=True
self.fields["environments"].full = True
return super(RunResource, self).dispatch_detail(request, **kwargs)
def dispatch_list(self, request, **kwargs):
"""For list, we don't want the full info on environments """
self.fields["environments"].full=False
self.fields["environments"].full = False
return super(RunResource, self).dispatch_list(request, **kwargs)
@@ -258,9 +258,9 @@ def obj_create(self, bundle, request=None, **kwargs):
try:
status = data.pop("status")
case=data.pop("case")
case = data.pop("case")
env = Environment.objects.get(pk=data.get("environment"))
run=data.pop("run_id")
run = data.pop("run_id")
except KeyError as e:
raise ValidationError(
@@ -326,7 +326,7 @@ def dehydrate(self, bundle):
bundle.data["filter_cases"] = filter_url("manage_cases", suite)
if "runs" in bundle.request.GET.keys():
run_id=int(bundle.request.GET["runs"])
run_id = int(bundle.request.GET["runs"])
s = suite.runsuites.all()
order = [x.order for x in suite.runsuites.all()
if x.run_id == run_id][0]
@@ -335,6 +335,3 @@ def dehydrate(self, bundle):
bundle.data["order"] = None
return bundle
@@ -7,6 +7,7 @@
from .models import Run, RunSuite, RunCaseVersion
@fixture_generator(
Run, RunSuite, RunCaseVersion, requires=[
"library.sample_suites", "core.sample_users", "core.sample_products"])
@@ -4,6 +4,7 @@
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
depends_on = [
@@ -13,7 +14,7 @@ class Migration(SchemaMigration):
]
def forwards(self, orm):
# Adding model 'Run'
db.create_table('execution_run', (
('id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
@@ -127,7 +128,7 @@ def forwards(self, orm):
def backwards(self, orm):
# Deleting model 'Run'
db.delete_table('execution_run')
@@ -4,10 +4,11 @@
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'RunCaseVersion.cc_version'
db.add_column('execution_runcaseversion', 'cc_version', self.gf('django.db.models.fields.IntegerField')(default=0), keep_default=False)
@@ -25,7 +26,7 @@ def forwards(self, orm):
def backwards(self, orm):
# Deleting field 'RunCaseVersion.cc_version'
db.delete_column('execution_runcaseversion', 'cc_version')
@@ -321,4 +321,4 @@ def backwards(self, orm):
}
}
complete_apps = ['execution']
complete_apps = ['execution']
@@ -11,6 +11,7 @@ def forwards(self, orm):
# Changing field 'Result.started'
db.alter_column('execution_result', 'started', self.gf('django.db.models.fields.DateTimeField')(null=True))
def backwards(self, orm):
# Changing field 'Result.started'
@@ -316,4 +317,4 @@ def backwards(self, orm):
}
}
complete_apps = ['execution']
complete_apps = ['execution']
@@ -320,4 +320,4 @@ def backwards(self, orm):
}
}
complete_apps = ['execution']
complete_apps = ['execution']
@@ -326,4 +326,4 @@ def backwards(self, orm):
}
}
complete_apps = ['execution']
complete_apps = ['execution']
Oops, something went wrong.

0 comments on commit ab95db2

Please sign in to comment.