Clean up code
This commit is contained in:
parent
d159876472
commit
a2554fbf37
|
|
@ -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 json
|
||||||
import os
|
import os
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
|
||||||
|
|
@ -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
|
import json
|
||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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 datetime import timedelta
|
||||||
|
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
|
||||||
|
|
@ -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.conf.urls import url
|
||||||
from django.views.decorators.csrf import csrf_exempt
|
from django.views.decorators.csrf import csrf_exempt
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@
|
||||||
# @author: chrigu <christian.cueni@iterativ.ch>
|
# @author: chrigu <christian.cueni@iterativ.ch>
|
||||||
import json
|
import json
|
||||||
|
|
||||||
from django.http import HttpResponse
|
from django.http import JsonResponse
|
||||||
from django.views import View
|
from django.views import View
|
||||||
|
|
||||||
from core.hep_client import HepClient, HepClientException
|
from core.hep_client import HepClient, HepClientException
|
||||||
|
|
@ -25,10 +25,10 @@ class RegistrationProxyView(View):
|
||||||
try:
|
try:
|
||||||
hep_data = hep_client.customer_create(data)
|
hep_data = hep_client.customer_create(data)
|
||||||
except HepClientException as e:
|
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()
|
response_data = hep_data.copy()
|
||||||
del response_data['confirmation']
|
del response_data['confirmation']
|
||||||
|
|
||||||
return HttpResponse(json.dumps(response_data), content_type='application/json')
|
return JsonResponse(response_data)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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
|
from django.conf import settings
|
||||||
|
|
|
||||||
|
|
@ -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
|
from django.conf import settings
|
||||||
|
|
|
||||||
|
|
@ -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 os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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.hep_client import HepClient, HepClientException
|
||||||
from core.models import AdminData
|
from core.models import AdminData
|
||||||
from users.models import License
|
from users.models import License
|
||||||
|
|
@ -21,7 +10,6 @@ NO_VALID_LICENSE = 'no_valid_license'
|
||||||
|
|
||||||
|
|
||||||
def handle_user_and_verify_products(user_data):
|
def handle_user_and_verify_products(user_data):
|
||||||
|
|
||||||
hep_client = HepClient()
|
hep_client = HepClient()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
@ -29,8 +17,6 @@ def handle_user_and_verify_products(user_data):
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
user = User.objects.create_user_from_hep(user_data)
|
user = User.objects.create_user_from_hep(user_data)
|
||||||
|
|
||||||
# todo check if email has changed, any impact on our system?
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not hep_client.is_email_verified(user_data):
|
if not hep_client.is_email_verified(user_data):
|
||||||
return user, EMAIL_NOT_VERIFIED
|
return user, EMAIL_NOT_VERIFIED
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue