Skip to content

Commit

Permalink
Update dependencies (#1868)
Browse files Browse the repository at this point in the history
- djangorestframework (3.7.1)
- psycopg2 (2.7.3.2)
- djoser (1.0.1)
- django-allauth (0.34.0)
- django-filter (1.1.0)
- django-crispy-forms (1.7.0)
- openpyxl (2.4.9)
- pytz (2017.3)
- shapely (1.6.2.post1)
- awscli (1.11.179)
- pandas (0.21.0)
- opbeat (3.5.3)
- flake8 (3.5.0)
- django-extensions (1.9.7)
  • Loading branch information
seav authored and oliverroick committed Dec 7, 2017
1 parent 82871ef commit 75d62db
Show file tree
Hide file tree
Showing 18 changed files with 48 additions and 45 deletions.
2 changes: 1 addition & 1 deletion cadasta/accounts/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def run(verbose=True, force=False):
pols[pol] = models.Policy.objects.get(name=pol)
pols[pol].body = policy_file.read()
pols[pol].save()
except:
except models.Policy.DoesNotExist:
pols[pol] = models.Policy.objects.create(
name=pol,
body=policy_file.read()
Expand Down
5 changes: 2 additions & 3 deletions cadasta/accounts/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@


class RegistrationSerializer(SanitizeFieldSerializer,
djoser_serializers.UserRegistrationSerializer):
djoser_serializers.UserCreateSerializer):
email = serializers.EmailField(
allow_blank=True,
allow_null=True,
Expand Down Expand Up @@ -298,8 +298,7 @@ def validate_last_login(self, last_login):
return last_login


class AccountLoginSerializer(djoser_serializers.LoginSerializer):

class AccountLoginSerializer(djoser_serializers.TokenCreateSerializer):
def validate(self, attrs):
attrs = super(AccountLoginSerializer, self).validate(attrs)

Expand Down
4 changes: 2 additions & 2 deletions cadasta/accounts/views/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ def perform_update(self, serializer):
user.save()


class AccountRegister(djoser_views.RegistrationView):
class AccountRegister(djoser_views.UserCreateView):
serializer_class = serializers.RegistrationSerializer

def create(self, request, *args, **kwargs):
Expand Down Expand Up @@ -103,7 +103,7 @@ def perform_create(self, serializer):
verification_device.generate_challenge()


class AccountLogin(djoser_views.LoginView):
class AccountLogin(djoser_views.TokenCreateView):
serializer_class = serializers.AccountLoginSerializer

def post(self, request):
Expand Down
1 change: 1 addition & 0 deletions cadasta/config/urls/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

api_v1 = [
url(r'^account/', include('accounts.urls.api', namespace='accounts')),
url(r'^account/', include('djoser.urls')),
url(r'^account/', include('djoser.urls.authtoken')),

url(r'^organizations/',
Expand Down
2 changes: 1 addition & 1 deletion cadasta/core/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def wrapper(*args, **kwds):
try:
for (method, errors) in getattr(cls, METHOD_KEY, []):
setattr(cls, method, safe_func(getattr(cls, method), errors))
except:
except (ValueError, AttributeError):
raise ValueError(
"Failed to implement class {!r} with metaclass "
"'HandledErrors'".format(name))
6 changes: 3 additions & 3 deletions cadasta/organization/importers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ def _map_attrs_to_content_types(self, headers, row, content_types,
continue
try:
val = row[headers.index(attribute.name.lower())]
except:
except (KeyError, ValueError):
val = row[headers.index(attr_label)]

if not sanitize_string(val):
Expand All @@ -303,11 +303,11 @@ def _cast_to_type(self, val, type):
if type == 'integer':
try:
val = int(float(val))
except:
except (ValueError, TypeError):
val = 0
if type == 'decimal':
try:
val = float(val)
except:
except (ValueError, TypeError):
val = 0.0
return val
2 changes: 1 addition & 1 deletion cadasta/organization/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ def save(self, *args, **kwargs):
self.country = WorldBorder.objects.get(
mpoly__contains=self.extent.centroid
).iso2
except:
except WorldBorder.DoesNotExist:
pass
super().save(*args, **kwargs)

Expand Down
10 changes: 5 additions & 5 deletions cadasta/organization/views/api.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from django.shortcuts import get_object_or_404

from django_filters.rest_framework import DjangoFilterBackend
from rest_framework.response import Response
from rest_framework.exceptions import PermissionDenied, NotAuthenticated
from rest_framework import generics, filters, status
Expand All @@ -21,7 +21,7 @@ class OrganizationList(PermissionsFilterMixin,
lookup_field = 'slug'
queryset = Organization.objects.all()
serializer_class = serializers.OrganizationSerializer
filter_backends = (filters.DjangoFilterBackend,
filter_backends = (DjangoFilterBackend,
filters.SearchFilter,
filters.OrderingFilter,)
filter_fields = ('archived',)
Expand Down Expand Up @@ -117,7 +117,7 @@ def destroy(self, request, *args, **kwargs):
class UserAdminList(APIPermissionRequiredMixin, generics.ListAPIView):
queryset = User.objects.all()
serializer_class = serializers.UserAdminSerializer
filter_backends = (filters.DjangoFilterBackend,
filter_backends = (DjangoFilterBackend,
filters.SearchFilter,
filters.OrderingFilter,)
filter_fields = ('is_active',)
Expand Down Expand Up @@ -145,7 +145,7 @@ class OrganizationProjectList(PermissionsFilterMixin,
generics.ListCreateAPIView):
org_lookup = 'organization'
serializer_class = serializers.ProjectSerializer
filter_backends = (filters.DjangoFilterBackend,
filter_backends = (DjangoFilterBackend,
filters.SearchFilter,
filters.OrderingFilter,)
filter_fields = ('archived',)
Expand Down Expand Up @@ -201,7 +201,7 @@ def permission_filter(self, view, p):
return ('project.view',)

serializer_class = serializers.ProjectSerializer
filter_backends = (filters.DjangoFilterBackend,
filter_backends = (DjangoFilterBackend,
filters.SearchFilter,
filters.OrderingFilter,)
filter_fields = ('archived',)
Expand Down
7 changes: 4 additions & 3 deletions cadasta/party/views/api.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""Party API."""
from django.db.models import Q
from django.utils.translation import gettext as _
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import generics, filters, status
from rest_framework.views import APIView
from rest_framework.response import Response
Expand All @@ -23,7 +24,7 @@ class PartyList(APIPermissionRequiredMixin,
generics.ListCreateAPIView):

serializer_class = serializers.PartySerializer
filter_backends = (filters.DjangoFilterBackend,
filter_backends = (DjangoFilterBackend,
filters.SearchFilter, filters.OrderingFilter,)
filter_fields = ('name', 'type')
search_fields = ('name',)
Expand Down Expand Up @@ -57,7 +58,7 @@ class PartyResourceList(APIPermissionRequiredMixin,
mixins.PartyResourceMixin,
generics.ListCreateAPIView):
serializer_class = ResourceSerializer
filter_backends = (filters.DjangoFilterBackend,
filter_backends = (DjangoFilterBackend,
filters.SearchFilter,
filters.OrderingFilter,)
filter_fields = ('archived',)
Expand Down Expand Up @@ -233,7 +234,7 @@ class TenureRelationshipResourceList(APIPermissionRequiredMixin,
mixins.TenureRelationshipResourceMixin,
generics.ListCreateAPIView):
serializer_class = ResourceSerializer
filter_backends = (filters.DjangoFilterBackend,
filter_backends = (DjangoFilterBackend,
filters.SearchFilter,
filters.OrderingFilter,)
filter_fields = ('archived',)
Expand Down
5 changes: 3 additions & 2 deletions cadasta/resources/views/api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters, generics
from tutelary.mixins import APIPermissionRequiredMixin
from core.mixins import update_permissions
Expand Down Expand Up @@ -27,7 +28,7 @@ def filter_archived_resources(self, view, obj):
class ProjectResources(APIPermissionRequiredMixin,
mixins.ProjectResourceMixin,
generics.ListCreateAPIView):
filter_backends = (filters.DjangoFilterBackend,
filter_backends = (DjangoFilterBackend,
filters.SearchFilter,
filters.OrderingFilter,)
filter_fields = ('archived',)
Expand Down Expand Up @@ -63,7 +64,7 @@ class ProjectSpatialResources(APIPermissionRequiredMixin,
mixins.ProjectSpatialResourceMixin,
generics.ListAPIView):

filter_backends = (filters.DjangoFilterBackend,
filter_backends = (DjangoFilterBackend,
filters.SearchFilter,
filters.OrderingFilter,)
filter_fields = ('id', 'name')
Expand Down
4 changes: 2 additions & 2 deletions cadasta/spatial/tests/test_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,10 @@ def test_get_url(self):
serializer = serializers.SpatialUnitGeoJsonSerializer(location)

expected_url = ('/organizations/{o}/projects/{p}/records/'
'locations/{l}/'.format(
'locations/{loc}/'.format(
o=location.project.organization.slug,
p=location.project.slug,
l=location.id
loc=location.id
))

assert serializer.get_url(location) == expected_url
Expand Down
5 changes: 3 additions & 2 deletions cadasta/spatial/views/api.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import generics, filters, status
from rest_framework.response import Response
from tutelary.mixins import APIPermissionRequiredMixin
Expand All @@ -20,7 +21,7 @@ def get_actions(self, request):
return ['project.view_private', 'spatial.list']

serializer_class = serializers.SpatialUnitSerializer
filter_backends = (filters.DjangoFilterBackend,
filter_backends = (DjangoFilterBackend,
filters.SearchFilter,
filters.OrderingFilter,)
filter_fields = ('type',)
Expand Down Expand Up @@ -57,7 +58,7 @@ class SpatialUnitResourceList(APIPermissionRequiredMixin,
mixins.SpatialUnitResourceMixin,
generics.ListCreateAPIView):
serializer_class = ResourceSerializer
filter_backends = (filters.DjangoFilterBackend,
filter_backends = (DjangoFilterBackend,
filters.SearchFilter,
filters.OrderingFilter,)
filter_fields = ('archived',)
Expand Down
4 changes: 2 additions & 2 deletions functional_tests/pages/OrganizationList.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,15 @@ def try_submit(self, err=None, ok=None, message=None):
for f in err:
try:
self.test.assert_field_has_error(fields[f], message)
except:
except AssertionError:
raise AssertionError(
'Field "' + f + '" should have error, but does not'
)
if ok is not None:
for f in ok:
try:
self.test.assert_field_has_no_error(fields[f])
except:
except AssertionError:
raise AssertionError(
'Field "' + f + '" should not have error, but does'
)
2 changes: 1 addition & 1 deletion functional_tests/pages/OrganizationMemberList.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def try_submit(self, err=None, ok=None, message=None):
for f in err:
try:
self.test.assert_field_has_error(fields[f], message)
except:
except AssertionError:
raise AssertionError(
'Field "' + f + '" should have error, but does not'
)
Expand Down
4 changes: 2 additions & 2 deletions functional_tests/pages/Registration.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ def try_submit(self, err=None, ok=None, message=None):
for f in err:
try:
self.test.assert_field_has_error(fields[f], message)
except:
except AssertionError:
raise AssertionError('Field "' + f +
'" should have error, but does not')
if ok is not None:
for f in ok:
try:
self.test.assert_field_has_no_error(fields[f])
except:
except AssertionError:
raise AssertionError('Field "' + f +
'" should not have error, but does')
24 changes: 12 additions & 12 deletions requirements/common.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
Django==1.10.8 # rq.filter: <1.11.0
djangorestframework==3.6.4
psycopg2==2.7.3.1
djoser==0.7.0
django-allauth==0.33.0
djangorestframework==3.7.1
psycopg2==2.7.3.2
djoser==1.0.1
django-allauth==0.34.0
django-cors-headers==2.1.0
django-filter==1.0.4
django-crispy-forms==1.6.1
django-filter==1.1.0
django-crispy-forms==1.7.0
django-parsley==0.6
django-formtools==2.1
django-countries==5.0
Expand All @@ -25,13 +25,13 @@ pyxform-cadasta==0.9.22
python-magic==0.4.13
Pillow==4.3.0
django-jsonattrs==0.1.23
openpyxl==2.4.8
pytz==2017.2
shapely==1.6.1
openpyxl==2.4.9
pytz==2017.3
shapely==1.6.2.post1
gdal==1.10.0 # rq.filter: <2.0.0
pylibmc==1.5.2
awscli==1.11.167
pandas==0.20.3
awscli==1.11.179
pandas==0.21.0
argon2-cffi==16.3.0
requests==2.18.4
pyparsing==2.2.0
Expand All @@ -41,4 +41,4 @@ gpxpy==1.1.2
django-otp==0.3.11
twilio==6.5.0
phonenumbers==8.5.2
opbeat==3.5.2
opbeat==3.5.3
4 changes: 2 additions & 2 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ pytest-cov==2.5.1
selenium==3.6.0
transifex-client==0.12.4
tox==2.9.1
flake8==3.4.1
flake8==3.5.0
django-debug-toolbar==1.8
django-extensions==1.9.1
django-extensions==1.9.7
django-skivvy==0.1.9
ipython==6.2.1
git+https://github.com/Cadasta/[email protected]
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ install_command = pip install --find-links https://s3.amazonaws.com:443/cadasta-
commands = ./runtests.py --lint
deps =
pytest==3.2.3
flake8==3.4.1
flake8==3.5.0

[testenv:py35-django-migration]
commands = python ./cadasta/manage.py makemigrations --check
Expand Down

0 comments on commit 75d62db

Please sign in to comment.