Clean up code

This commit is contained in:
Christian Cueni 2020-05-12 11:36:59 +02:00
parent d159876472
commit a2554fbf37
9 changed files with 3 additions and 82 deletions

View File

@ -1,14 +1,3 @@
# -*- coding: utf-8 -*-
#
# ITerativ GmbH
# http://www.iterativ.ch/
#
# Copyright (c) 2020 ITerativ GmbH. All rights reserved.
#
# Created on 03.02.20
# @author: chrigu <christian.cueni@iterativ.ch>
## Mocks
import json
import os
from datetime import datetime, timedelta

View File

@ -1,12 +1,3 @@
# -*- coding: utf-8 -*-
#
# ITerativ GmbH
# http://www.iterativ.ch/
#
# Copyright (c) 2020 ITerativ GmbH. All rights reserved.
#
# Created on 23.01.20
# @author: chrigu <christian.cueni@iterativ.ch>
import json
from datetime import datetime, timedelta

View File

@ -1,12 +1,3 @@
# -*- coding: utf-8 -*-
#
# ITerativ GmbH
# http://www.iterativ.ch/
#
# Copyright (c) 2020 ITerativ GmbH. All rights reserved.
#
# Created on 17.02.20
# @author: chrigu <christian.cueni@iterativ.ch>
from datetime import timedelta
from django.test import TestCase

View File

@ -1,12 +1,3 @@
# -*- coding: utf-8 -*-
#
# ITerativ GmbH
# http://www.iterativ.ch/
#
# Copyright (c) 2020 ITerativ GmbH. All rights reserved.
#
# Created on 25.02.20
# @author: chrigu <christian.cueni@iterativ.ch>
from django.conf.urls import url
from django.views.decorators.csrf import csrf_exempt

View File

@ -9,7 +9,7 @@
# @author: chrigu <christian.cueni@iterativ.ch>
import json
from django.http import HttpResponse
from django.http import JsonResponse
from django.views import View
from core.hep_client import HepClient, HepClientException
@ -25,10 +25,10 @@ class RegistrationProxyView(View):
try:
hep_data = hep_client.customer_create(data)
except HepClientException as e:
return HttpResponse(json.dumps(e.args[1]), status=e.args[0], content_type='application/json')
return JsonResponse(e.args[1], status=e.args[0])
response_data = hep_data.copy()
del response_data['confirmation']
return HttpResponse(json.dumps(response_data), content_type='application/json')
return JsonResponse(response_data)

View File

@ -1,10 +1 @@
# -*- coding: utf-8 -*-
#
# ITerativ GmbH
# http://www.iterativ.ch/
#
# Copyright (c) 2020 ITerativ GmbH. All rights reserved.
#
# Created on 20.02.20
# @author: chrigu <christian.cueni@iterativ.ch>
from django.conf import settings

View File

@ -1,10 +1 @@
# -*- coding: utf-8 -*-
#
# ITerativ GmbH
# http://www.iterativ.ch/
#
# Copyright (c) 2020 ITerativ GmbH. All rights reserved.
#
# Created on 20.02.20
# @author: chrigu <christian.cueni@iterativ.ch>
from django.conf import settings

View File

@ -1,12 +1,3 @@
# -*- coding: utf-8 -*-
#
# ITerativ GmbH
# http://www.iterativ.ch/
#
# Copyright (c) 2020 ITerativ GmbH. All rights reserved.
#
# Created on 20.02.20
# @author: chrigu <christian.cueni@iterativ.ch>
import os
import shutil

View File

@ -1,14 +1,3 @@
# -*- coding: utf-8 -*-
#
# ITerativ GmbH
# http://www.iterativ.ch/
#
# Copyright (c) 2020 ITerativ GmbH. All rights reserved.
#
# Created on 30.01.20
# @author: chrigu <christian.cueni@iterativ.ch>
from django.conf import settings
from core.hep_client import HepClient, HepClientException
from core.models import AdminData
from users.models import License
@ -21,7 +10,6 @@ NO_VALID_LICENSE = 'no_valid_license'
def handle_user_and_verify_products(user_data):
hep_client = HepClient()
try:
@ -29,8 +17,6 @@ def handle_user_and_verify_products(user_data):
except User.DoesNotExist:
user = User.objects.create_user_from_hep(user_data)
# todo check if email has changed, any impact on our system?
try:
if not hep_client.is_email_verified(user_data):
return user, EMAIL_NOT_VERIFIED