Skip to content
This repository has been archived by the owner on May 1, 2020. It is now read-only.

Commit

Permalink
Fix all flake8 'E302 expected 2 blank lines, found 1' errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
audreyfeldroy committed Sep 2, 2015
1 parent 4ae0277 commit 9cef3a2
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions spam/admin.py
Expand Up @@ -6,6 +6,7 @@
from .models import SpammyPosting
from .utils import spammables


class SpammyPostingAdmin(admin.ModelAdmin):
model = SpammyPosting
readonly_fields = ('source', 'created', 'modified',)
Expand Down
1 change: 1 addition & 0 deletions spam/exceptions.py
@@ -1,5 +1,6 @@
class SpamNotFound(Exception):
"""When the system can't find spam the user defined"""


class B16DecodingFail(Exception):
"""When decoding from B16 fails"""
4 changes: 4 additions & 0 deletions spam/utils.py
Expand Up @@ -22,13 +22,16 @@ def spammables():
flaggables.append(model)
return flaggables


def is_spammable(app, model):
model_class = apps.get_model("{}.{}".format(app, model))
return model_class in spammables()


def get_app_name(model_class_or_instance):
return model_class_or_instance._meta.app_config.name.split('.')[-1]


def b16_slug_to_arguments(b16_slug):
"""
Expand All @@ -49,6 +52,7 @@ def b16_slug_to_arguments(b16_slug):
raise B16DecodingFail("Invalid b16_slug passed")
return app, model, pk


def get_spammable_or_404(app, model, pk):
# Does this view have the is_spammable mixin?
if is_spammable(app, model):
Expand Down
1 change: 1 addition & 0 deletions test_app/models.py
Expand Up @@ -3,6 +3,7 @@

from spam import Spammable


class Data(Spammable, models.Model):

title = models.CharField(max_length=50)
Expand Down

0 comments on commit 9cef3a2

Please sign in to comment.