Pārlūkot izejas kodu

flake8

pull/142/head
winkidney pirms 5 gadiem
committed by Ji Qu
vecāks
revīzija
0d60075f28
10 mainītis faili ar 22 papildinājumiem un 19 dzēšanām
  1. +0
    -1
      core/context_processors.py
  2. +0
    -2
      core/tests/views.py
  3. +1
    -0
      core/utils.py
  4. +3
    -3
      django_images/tests.py
  5. +1
    -3
      pinry/wsgi.py
  6. +0
    -1
      users/__init__.py
  7. +5
    -3
      users/auth/backends.py
  8. +8
    -4
      users/forms.py
  9. +2
    -1
      users/middleware.py
  10. +2
    -1
      users/views.py

+ 0
- 1
core/context_processors.py Parādīt failu

@@ -5,4 +5,3 @@ def template_settings(request):
return {
'API_LIMIT_PER_PAGE': settings.API_LIMIT_PER_PAGE,
}


+ 0
- 2
core/tests/views.py Parādīt failu

@@ -1,6 +1,4 @@
from django.conf import settings
from django.core.urlresolvers import reverse
from django.template import TemplateDoesNotExist
from django.test import TestCase

from core.models import Image


+ 1
- 0
core/utils.py Parādīt failu

@@ -1,6 +1,7 @@
import hashlib
import os


def upload_path(instance, filename, **kwargs):
hasher = hashlib.md5()
for chunk in instance.image.chunks():


+ 3
- 3
django_images/tests.py Parādīt failu

@@ -20,7 +20,7 @@ class ImageModelTest(TestCase):

def test_get_by_size(self):
size = list(settings.IMAGE_SIZES.keys())[0]
thumb = Thumbnail.objects.get_or_create_at_size(self.image.id, size)
Thumbnail.objects.get_or_create_at_size(self.image.id, size)
self.image.get_by_size(size)

def test_get_absolute_url(self):
@@ -53,7 +53,7 @@ class ThumbnailManagerModelTest(TestCase):

# TODO: Test the image object and data
def test_create(self):
thumb = Thumbnail.objects.get_or_create_at_size(self.image.id, self.size)
Thumbnail.objects.get_or_create_at_size(self.image.id, self.size)
self.assertEqual(self.image.thumbnail_set.count(), 1)

def test_get(self):
@@ -89,7 +89,7 @@ class PostSaveSignalOriginalChangedTestCase(TestCase):

def test_post_save_signal_original_changed(self):
size = list(settings.IMAGE_SIZES.keys())[0]
thumb = Thumbnail.objects.get_or_create_at_size(self.image.id, size)
Thumbnail.objects.get_or_create_at_size(self.image.id, size)
self.image.delete()
self.assertFalse(Thumbnail.objects.exists())



+ 1
- 3
pinry/wsgi.py Parādīt failu

@@ -1,8 +1,6 @@
import os
from django.core.wsgi import get_wsgi_application


os.environ.setdefault("DJANGO_SETTINGS_MODULE", "pinry.settings.docker")


from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

+ 0
- 1
users/__init__.py Parādīt failu

@@ -1 +0,0 @@


+ 5
- 3
users/auth/backends.py Parādīt failu

@@ -1,15 +1,17 @@
import re

from core.models import Pin
from users.models import User


email_re = re.compile(
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom
r"(^[-!#$%&'*+/=?^_`{}|~0-9A-Z]+(\.[-!#$%&'*+/=?^_`{}|~0-9A-Z]+)*" # dot-atom
# quoted-string, see also http://tools.ietf.org/html/rfc2822#section-3.2.5
r'|^"([\001-\010\013\014\016-\037!#-\[\]-\177]|\\[\001-\011\013\014\016-\177])*"'
r')@((?:[A-Z0-9](?:[A-Z0-9-]{0,61}[A-Z0-9])?\.)+(?:[A-Z]{2,6}\.?|[A-Z0-9-]{2,}\.?)$)'
# domain
r'|\[(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\]$', re.IGNORECASE) # literal form, ipv4 address (SMTP 4.1.3)
r'|\[(25[0-5]|2[0-4]\d|[0-1]?\d?\d)(\.(25[0-5]|2[0-4]\d|[0-1]?\d?\d)){3}\]$',
re.IGNORECASE
) # literal form, ipv4 address (SMTP 4.1.3)


class CombinedAuthBackend(object):


+ 8
- 4
users/forms.py Parādīt failu

@@ -11,10 +11,14 @@ class UserCreationForm(forms.ModelForm):
error_messages = {
'duplicate_username': _("A user with that username already exists."),
}
username = forms.RegexField(label=_("Username"), max_length=30,
regex=r'^[\w-]+$')
password = forms.CharField(label=_("Password"),
widget=forms.PasswordInput)
username = forms.RegexField(
label=_("Username"), max_length=30,
regex=r'^[\w-]+$'
)
password = forms.CharField(
label=_("Password"),
widget=forms.PasswordInput
)

class Meta:
model = User


+ 2
- 1
users/middleware.py Parādīt failu

@@ -4,8 +4,9 @@ from django.core.urlresolvers import reverse


class Public(object):

def process_request(self, request):
if settings.PUBLIC == False and not request.user.is_authenticated():
if settings.PUBLIC is False and not request.user.is_authenticated():
acceptable_paths = [
'/login/',
'/private/',


+ 2
- 1
users/views.py Parādīt failu

@@ -13,7 +13,8 @@ from .forms import UserCreationForm
from users.models import User


reverse_lazy = lambda name=None, *args: lazy(reverse, str)(name, args=args)
def reverse_lazy(name=None, *args):
return lazy(reverse, str)(name, args=args)


class CreateUser(CreateView):


Notiek ielāde…
Atcelt
Saglabāt