Commit 2196390d authored by PCoder's avatar PCoder

Handle more errors

Internal Server Error: /ipv6/work/signup/
Traceback (most recent call last):
  File "/home/app/pyvenv/lib/python3.5/site-packages/django/core/handlers/", line 34, in inner
    response = get_response(request)
  File "/home/app/pyvenv/lib/python3.5/site-packages/django/core/handlers/", line 126, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/app/pyvenv/lib/python3.5/site-packages/django/core/handlers/", line 124, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "./users/", line 19, in signup
    create_user(username, raw_password, first_name, last_name, email)
  File "./users/", line 18, in create_user
    uidNumber = get_max_uid() + 1
  File "./users/", line 79, in get_max_uid
    return int(
ValueError: invalid literal for int() with base 10: ''
parent 506679b8
...@@ -76,9 +76,21 @@ def get_max_uid(): ...@@ -76,9 +76,21 @@ def get_max_uid():
""" """
try: try:
with open(settings.LDAP_MAX_UID_PATH, 'r+') as handler: with open(settings.LDAP_MAX_UID_PATH, 'r+') as handler:
return int( try:
return_value = int(
except ValueError as ve:
"Error reading int value from {}. {}"
"Returning default value {} instead".format(
return_value = settings.LDAP_DEFAULT_START_UID
return return_value
except FileNotFoundError as fnfe: except FileNotFoundError as fnfe:
logger.error("File not found : " + str(fnfe)) logger.error("File not found : " + str(fnfe))
ret = settings.LDAP_DEFAULT_START_UID retrun_value = settings.LDAP_DEFAULT_START_UID
logger.error("So, returing UID={}".format(ret)) logger.error("So, returning UID={}".format(retrun_value))
return ret return retrun_value
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment