ouhft / COPE

Project Repository for Work Package 4 of the COPE Transplant Trial
https://cope.nds.ox.ac.uk
1 stars 0 forks source link

ISE: SAE - String index out of range #260

Closed marshalc closed 7 years ago

marshalc commented 7 years ago

On saving of multiple SAE forms (48 & 52 in emails so far), the following ISE is occurring:

Internal Server Error: /en-gb/wp4/adverse-event/52/

IndexError at /en-gb/wp4/adverse-event/52/
string index out of range

Request Method: POST
Request URL: https://cope.nds.ox.ac.uk/en-gb/wp4/adverse-event/52/
Django Version: 1.10.6
Python Executable: /sites/.virtualenvs/py3_cope/bin/python3
Python Version: 3.5.2
Python Path: ['/sites/py3_cope/cope_repo', '/sites/.virtualenvs/py3_cope/bin', '/sites/py3_cope/cope_repo/${PYTHONPATH}', '/sites/py3_cope/cope_repo', '/sites/.virtualenvs/py3_cope/lib/python35.zip', '/sites/.virtualenvs/py3_cope/lib/python3.5', '/sites/.virtualenvs/py3_cope/lib/python3.5/plat-x86_64-linux-gnu', '/sites/.virtualenvs/py3_cope/lib/python3.5/lib-dynload', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages', '/sites/.virtualenvs/py3_cope/src/django-crispy-forms']
Server time: Tue, 21 Mar 2017 14:53:21 +0000
Installed Applications:
['dal',
'dal_select2',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django.contrib.admin',
'django.contrib.admindocs',
'crispy_forms',
'reversion',
'reversion_compare',
'wp4.compare',
'wp4.locations',
'wp4.staff',
'wp4.perfusion_machine',
'wp4.health_economics',
'wp4.samples',
'wp4.adverse_event',
'wp4.followups',
'wp4.administration',
'wp4.theme',
'djangosecure',
'gunicorn']
Installed Middleware:
['djangosecure.middleware.SecurityMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'reversion.middleware.RevisionMiddleware',
'config.middleware.activate_timezone.TimezoneMiddleware']

Traceback:  

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
 42.             response = get_response(request)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/handlers/base.py" in _legacy_get_response
 249.             response = self._get_response(request)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
 187.                 response = self.process_exception_by_middleware(e, request)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
 185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/views/generic/base.py" in view
 68.             return self.dispatch(request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/braces/views/_access.py" in dispatch
 102.             request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/braces/views/_access.py" in dispatch
 201.             request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/views/generic/base.py" in dispatch
 88.         return handler(request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/views/generic/edit.py" in post
 240.         return super(BaseUpdateView, self).post(request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/views/generic/edit.py" in post
 183.             return self.form_valid(form)

File "/sites/py3_cope/cope_repo/wp4/adverse_event/views.py" in form_valid
 77.             return super(AjaxFormMixin, self).form_valid(form)

File "/sites/py3_cope/cope_repo/wp4/adverse_event/views.py" in form_valid
 59.             email.send()

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/message.py" in send
 342.         return self.get_connection(fail_silently).send_messages([self])

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/backends/smtp.py" in send_messages
 107.                 sent = self._send(message)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/backends/smtp.py" in _send
 120.         recipients = [sanitize_address(addr, encoding) for addr in email_message.recipients()]

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/backends/smtp.py" in <listcomp>
 120.         recipients = [sanitize_address(addr, encoding) for addr in email_message.recipients()]

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/message.py" in sanitize_address
 161.         address = Address(nm, addr_spec=addr)

File "/usr/lib/python3.5/email/headerregistry.py" in __init__
 42.             a_s, rest = parser.get_addr_spec(addr_spec)

File "/usr/lib/python3.5/email/_header_value_parser.py" in get_addr_spec
 1988.     token, value = get_local_part(value)

File "/usr/lib/python3.5/email/_header_value_parser.py" in get_local_part
 1800.     if value[0] in CFWS_LEADER:

Exception Type: IndexError at /en-gb/wp4/adverse-event/52/
Exception Value: string index out of range
Request information:
USER: Margaux Laspeyres

GET: No GET data

POST:
alive_query_7 = 'False'
outcome = 'Culture stools ongoing\r\nPentasa stop 18-09-2015'
alive_query_3 = 'False'
cause_of_death_comment = ''
contact = '268'
serious_eligible_3 = 'False'
alive_query_5 = 'False'
date_of_death = ''
onset_at_date = '27-08-2015'
serious_eligible_6 = 'True'
rehospitalisation = 'False'
death = 'False'
organ = '47'
serious_eligible_4 = 'False'
biopsy_taken = 'False'
serious_eligible_5 = 'True'
description = '- Multifactorial anemia\r\n- Gastro intestinal bleeding --> research on positive blood stool'
serious_eligible_2 = 'False'
alive_query_9 = 'True'
alive_query_2 = 'False'
rehospitalisation_comments = ''
alive_query_6 = 'False'
dialysis_needed = 'False'
date_of_discharge = ''
date_of_admission = ''
action = 'Gastrobiopsy --> mycotic appearance --> daktarin gel\r\n                            rectal ulcer\r\n--> PPI treatment\r\n--> Enema + pentasa'
alive_query_1 = 'False'
surgery_required = 'False'
csrfmiddlewaretoken = 'yoGQHeEqBYZ5c9zbpdXCepU6krN90jxRT5BPu0IEQdAKxEKLVN5HcXsWnJFPXAsr'
admitted_to_itu = 'False'
serious_eligible_1 = 'False'
event_ongoing = 'True'
alive_query_4 = 'False'
alive_query_8 = 'True'

FILES: No FILES data

COOKIES:
dontShowCookieNotice = 'TRUE'
csrftoken = 'wD46AmZSpp0XLIF33bZyb6V2OeoyWZmnRkZ5n836EEBC6dQDzL7D9EtSRwgeTghX'
sessionid = 'zx82t3358ze2bkcdsn4c3p5y8xi7pr07'
ccShowCookieIcon = 'no'
__utma = '107475804.2088071193.1421400528.1474536884.1484217018.2'
_ga = 'GA1.3.2088071193.1421400528'
it-services_cookiecontrol = 'yes'
__utmz = '107475804.1474536884.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none)'

META:
CONTENT_LENGTH = '1035'
CONTENT_TYPE = 'application/x-www-form-urlencoded'
CSRF_COOKIE = 'wD46AmZSpp0XLIF33bZyb6V2OeoyWZmnRkZ5n836EEBC6dQDzL7D9EtSRwgeTghX'
HTTP_ACCEPT = 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8'
HTTP_ACCEPT_ENCODING = 'gzip, deflate, br'
HTTP_ACCEPT_LANGUAGE = 'en-US,en;q=0.8'
HTTP_CACHE_CONTROL = 'max-age=0'
HTTP_CONNECTION = 'close'
HTTP_COOKIE = '__utma=5873900.1234394027.1421142017.1480681072.1480933124.223; __utmz=5873900.1479471377.218.33.utmcsr=google|utmccn=(organic)|utmcmd=organic|utmctr=(not%20provided); __utma=107475804.2088071193.1421400528.1474536884.1484217018.2; __utmz=107475804.1474536884.1.1.utmcsr=(direct)|utmccn=(direct)|utmcmd=(none); dontShowCookieNotice=TRUE; ccShowCookieIcon=no; it-services_cookiecontrol=yes; _ga=GA1.4.2088071193.1421400528; _ga=GA1.3.2088071193.1421400528; sessionid=zx82t3358ze2bkcdsn4c3p5y8xi7pr07; csrftoken=wD46AmZSpp0XLIF33bZyb6V2OeoyWZmnRkZ5n836EEBC6dQDzL7D9EtSRwgeTghX'
HTTP_DNT = '1'
HTTP_HOST = 'cope.nds.ox.ac.uk'
HTTP_ORIGIN = 'https://cope.nds.ox.ac.uk'
HTTP_REFERER = 'https://cope.nds.ox.ac.uk/en-gb/wp4/adverse-event/52/'
HTTP_UPGRADE_INSECURE_REQUESTS = '1'
HTTP_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36'
HTTP_X_FORWARDED_FOR = '163.1.198.136'
HTTP_X_FORWARDED_PROTOCOL = 'https'
HTTP_X_REAL_IP = '163.1.198.136'
HTTP_X_SCHEME = 'https'
PATH_INFO = '/en-gb/wp4/adverse-event/52/'
QUERY_STRING = ''
RAW_URI = '/en-gb/wp4/adverse-event/52/'
REMOTE_ADDR = "b''"
REQUEST_METHOD = 'POST'
SCRIPT_NAME = ''
SERVER_NAME = 'cope.nds.ox.ac.uk'
SERVER_PORT = '80'
SERVER_PROTOCOL = 'HTTP/1.0'
SERVER_SOFTWARE = 'gunicorn/19.7.0'
gunicorn.socket = <socket.socket fd=13, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, laddr=/sites/py3_cope/var/run/wsgi.socket>
wsgi.errors = <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f0eb400bda0>
wsgi.file_wrapper = ''
wsgi.input = <gunicorn.http.body.Body object at 0x7f0eb400bba8>
wsgi.multiprocess = True
wsgi.multithread = False
wsgi.run_once = False
wsgi.url_scheme = 'http'
wsgi.version = 

Settings:
Using settings module config.settings.production
ABSOLUTE_URL_OVERRIDES = {}
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ADD_REVERSION_ADMIN = True
ADMINS = [('Carl Marshall', 'carl.marshall@nds.ox.ac.uk')]
ALLOWED_HOSTS = ['cope.nds.ox.ac.uk', 'localhost', '127.0.0.1']
APPEND_SLASH = True
APPS_DIR = <Path:/sites/py3_cope/cope_repo/wp4>
AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS = '********************'
AUTH_USER_MODEL = 'staff.Person'
AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify'
BASE_DIR = '/sites/py3_cope/cope_repo'
CACHES = {'default': {'LOCATION': '', 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS = 'default'
CACHE_MIDDLEWARE_KEY_PREFIX = '********************'
CACHE_MIDDLEWARE_SECONDS = 600
CRISPY_TEMPLATE_PACK = 'bootstrap3'
CSRF_COOKIE_AGE = 31449600
CSRF_COOKIE_DOMAIN = None
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_NAME = 'csrftoken'
CSRF_COOKIE_PATH = '/'
CSRF_COOKIE_SECURE = False
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS = []
DATABASES = {'default': {'OPTIONS': {}, 'PASSWORD': '********************', 'USER': '', 'PORT': '', 'CONN_MAX_AGE': 0, 'NAME': 'db.sqlite3', 'ATOMIC_REQUESTS': False, 'TEST': {'NAME': None, 'COLLATION': None, 'MIRROR': None, 'CHARSET': None}, 'TIME_ZONE': None, 'AUTOCOMMIT': True, 'HOST': '', 'ENGINE': 'django.db.backends.sqlite3'}}
DATABASE_ROUTERS = []
DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000
DATETIME_FORMAT = 'N j, Y, P'
DATETIME_INPUT_FORMATS = ['%d-%m-%Y %H:%M', '%Y-%m-%d %H:%M', '%d/%m/%Y %H:%M', '%Y/%m/%d %H:%M']
DATE_FORMAT = 'N j, Y'
DATE_INPUT_FORMATS = ['%d-%m-%Y', '%Y-%m-%d', '%d/%m/%Y', '%Y/%m/%d']
DEBUG = False
DEBUG_PROPAGATE_EXCEPTIONS = False
DECIMAL_SEPARATOR = '.'
DEFAULT_CHARSET = 'utf-8'
DEFAULT_CONTENT_TYPE = 'text/html'
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL = 'Cope DB <noreply@nds.ox.ac.uk>'
DEFAULT_INDEX_TABLESPACE = ''
DEFAULT_TABLESPACE = ''
DISALLOWED_USER_AGENTS = []
DJANGO_APPS = ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.contrib.admin', 'django.contrib.admindocs']
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_FILE_PATH = '/tmp'
EMAIL_HOST = 'smtp.ox.ac.uk'
EMAIL_HOST_PASSWORD = '********************'
EMAIL_HOST_USER = ''
EMAIL_PORT = 25
EMAIL_SSL_CERTFILE = None
EMAIL_SSL_KEYFILE = '********************'
EMAIL_SUBJECT_PREFIX = '[Cope DB] '
EMAIL_TIMEOUT = None
EMAIL_USE_SSL = False
EMAIL_USE_TLS = False
FILE_CHARSET = 'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
FILE_UPLOAD_PERMISSIONS = None
FILE_UPLOAD_TEMP_DIR = None
FIRST_DAY_OF_WEEK = 0
FIXTURE_DIRS = ['/sites/py3_cope/cope_repo/wp4/fixtures', '/sites/py3_cope/cope_repo/config/fixtures']
FORCE_SCRIPT_NAME = None
FORMAT_MODULE_PATH = None
IGNORABLE_404_URLS = []
INSTALLED_APPS = ['dal', 'dal_select2', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.contrib.admin', 'django.contrib.admindocs', 'crispy_forms', 'reversion', 'reversion_compare', 'wp4.compare', 'wp4.locations', 'wp4.staff', 'wp4.perfusion_machine', 'wp4.health_economics', 'wp4.samples', 'wp4.adverse_event', 'wp4.followups', 'wp4.administration', 'wp4.theme', 'djangosecure', 'gunicorn']
INTERNAL_IPS = []
LANGUAGES = [('en-gb', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7f0eb6d10048>), ('fr-be', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7f0eb6d10390>), ('nl-nl', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7f0eb6d10780>)]
LANGUAGES_BIDI = ['he', 'ar', 'fa', 'ur']
LANGUAGE_CODE = 'en-gb'
LANGUAGE_COOKIE_AGE = None
LANGUAGE_COOKIE_DOMAIN = None
LANGUAGE_COOKIE_NAME = 'django_language'
LANGUAGE_COOKIE_PATH = '/'
LOCALE_PATHS = ['/sites/py3_cope/cope_repo/locale']
LOCAL_APPS = ['wp4.compare', 'wp4.locations', 'wp4.staff', 'wp4.perfusion_machine', 'wp4.health_economics', 'wp4.samples', 'wp4.adverse_event', 'wp4.followups', 'wp4.administration', 'wp4.theme']
LOGGING = {'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'}}, 'version': 1, 'handlers': {'console': {'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'verbose'}, 'mail_admins': {'level': 'ERROR', 'class': 'django.utils.log.AdminEmailHandler', 'filters': ['require_debug_false']}}, 'formatters': {'verbose': {'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'}}, 'loggers': {'loggers': {'django.security.DisallowedHost': {'level': 'ERROR', 'handlers': ['console', 'mail_admins'], 'propagate': True}}, 'django.request': {'level': 'ERROR', 'handlers': ['mail_admins'], 'propagate': True}}, 'disable_existing_loggers': False}
LOGGING_CONFIG = 'logging.config.dictConfig'
LOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/accounts/login/'
LOGOUT_REDIRECT_URL = '/'
MANAGERS = [('Carl Marshall', 'carl.marshall@nds.ox.ac.uk')]
MEDIA_ROOT = '/sites/py3_cope/htdocs/media'
MEDIA_URL = '/media/'
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
MESSAGE_TAGS = {40: 'danger'}
MIDDLEWARE = None
MIDDLEWARE_CLASSES = ['djangosecure.middleware.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'reversion.middleware.RevisionMiddleware', 'config.middleware.activate_timezone.TimezoneMiddleware']
MIGRATION_MODULES = {}
MONTH_DAY_FORMAT = 'F j'
NUMBER_GROUPING = 0
PASSWORD_HASHERS = '********************'
PASSWORD_RESET_TIMEOUT_DAYS = '********************'
PREPEND_WWW = False
REDIRECT_FIELD_NAME = 'redirect_to'
ROOT_DIR = <Path:/sites/py3_cope/cope_repo>
ROOT_URLCONF = 'config.urls'
SECRET_KEY = '********************'
SECURE_BROWSER_XSS_FILTER = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_FRAME_DENY = True
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_SECONDS = 60
SECURE_PROXY_SSL_HEADER = 
SECURE_REDIRECT_EXEMPT = []
SECURE_SSL_HOST = None
SECURE_SSL_REDIRECT = True
SECURITY_MIDDLEWARE = ['djangosecure.middleware.SecurityMiddleware']
SERVER_EMAIL = 'Cope DB <noreply@nds.ox.ac.uk>'
SESSION_CACHE_ALIAS = 'default'
SESSION_COOKIE_AGE = 1209600
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_NAME = 'sessionid'
SESSION_COOKIE_PATH = '/'
SESSION_COOKIE_SECURE = False
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SESSION_FILE_PATH = None
SESSION_SAVE_EVERY_REQUEST = False
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE = 'config.settings.production'
SHORT_DATETIME_FORMAT = 'm/d/Y P'
SHORT_DATE_FORMAT = 'm/d/Y'
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS = []
SITE_ID = 1
STATICFILES_DIRS = ['/sites/py3_cope/cope_repo/wp4/static', '/sites/py3_cope/cope_repo/docs/static']
STATICFILES_FINDERS = ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT = '/sites/py3_cope/htdocs/'
STATIC_URL = '/static/'
TEMPLATES = [{'OPTIONS': {'debug': False, 'loaders': [('django.template.loaders.cached.Loader', ['django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader'])], 'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.i18n', 'django.template.context_processors.tz', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.contrib.messages.context_processors.messages']}, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['/sites/py3_cope/cope_repo/wp4/templates']}]
TEST_NON_SERIALIZED_APPS = []
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
THIRD_PARTY_APPS = ['crispy_forms', 'reversion', 'reversion_compare']
THIRD_PARTY_PRE_DJANGO_APPS = ['dal', 'dal_select2']
THOUSAND_SEPARATOR = ','
TIME_FORMAT = 'P'
TIME_INPUT_FORMATS = ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE = 'UTC'
USE_ETAGS = False
USE_I18N = True
USE_L10N = True
USE_THOUSAND_SEPARATOR = False
USE_TZ = True
USE_X_FORWARDED_HOST = False
USE_X_FORWARDED_PORT = False
WSGI_APPLICATION = 'config.wsgi.application'
X_FRAME_OPTIONS = 'SAMEORIGIN'
YEAR_MONTH_FORMAT = 'F Y'
marshalc commented 7 years ago

More emails...

Internal Server Error: /nl-nl/wp4/adverse-event/103/

IndexError at /nl-nl/wp4/adverse-event/103/
string index out of range

Request Method: POST
Request URL: https://cope.nds.ox.ac.uk/nl-nl/wp4/adverse-event/103/
Django Version: 1.10.6
Python Executable: /sites/.virtualenvs/py3_cope/bin/python3
Python Version: 3.5.2
Python Path: ['/sites/py3_cope/cope_repo', '/sites/.virtualenvs/py3_cope/bin', '/sites/py3_cope/cope_repo/${PYTHONPATH}', '/sites/py3_cope/cope_repo', '/sites/.virtualenvs/py3_cope/lib/python35.zip', '/sites/.virtualenvs/py3_cope/lib/python3.5', '/sites/.virtualenvs/py3_cope/lib/python3.5/plat-x86_64-linux-gnu', '/sites/.virtualenvs/py3_cope/lib/python3.5/lib-dynload', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages', '/sites/.virtualenvs/py3_cope/src/django-crispy-forms']
Server time: vrij, 31 Mrt 2017 09:20:31 +0200
Installed Applications:
['dal',
'dal_select2',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django.contrib.admin',
'django.contrib.admindocs',
'crispy_forms',
'reversion',
'reversion_compare',
'wp4.compare',
'wp4.locations',
'wp4.staff',
'wp4.perfusion_machine',
'wp4.health_economics',
'wp4.samples',
'wp4.adverse_event',
'wp4.followups',
'wp4.administration',
'wp4.theme',
'djangosecure',
'gunicorn']
Installed Middleware:
['djangosecure.middleware.SecurityMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'reversion.middleware.RevisionMiddleware',
'config.middleware.activate_timezone.TimezoneMiddleware']

Traceback:  

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
 42.             response = get_response(request)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/handlers/base.py" in _legacy_get_response
 249.             response = self._get_response(request)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
 187.                 response = self.process_exception_by_middleware(e, request)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
 185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/views/generic/base.py" in view
 68.             return self.dispatch(request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/braces/views/_access.py" in dispatch
 102.             request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/braces/views/_access.py" in dispatch
 201.             request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/views/generic/base.py" in dispatch
 88.         return handler(request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/views/generic/edit.py" in post
 240.         return super(BaseUpdateView, self).post(request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/views/generic/edit.py" in post
 183.             return self.form_valid(form)

File "/sites/py3_cope/cope_repo/wp4/adverse_event/views.py" in form_valid
 77.             return super(AjaxFormMixin, self).form_valid(form)

File "/sites/py3_cope/cope_repo/wp4/adverse_event/views.py" in form_valid
 59.             email.send()

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/message.py" in send
 342.         return self.get_connection(fail_silently).send_messages([self])

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/backends/smtp.py" in send_messages
 107.                 sent = self._send(message)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/backends/smtp.py" in _send
 120.         recipients = [sanitize_address(addr, encoding) for addr in email_message.recipients()]

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/backends/smtp.py" in <listcomp>
 120.         recipients = [sanitize_address(addr, encoding) for addr in email_message.recipients()]

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/message.py" in sanitize_address
 161.         address = Address(nm, addr_spec=addr)

File "/usr/lib/python3.5/email/headerregistry.py" in __init__
 42.             a_s, rest = parser.get_addr_spec(addr_spec)

File "/usr/lib/python3.5/email/_header_value_parser.py" in get_addr_spec
 1988.     token, value = get_local_part(value)

File "/usr/lib/python3.5/email/_header_value_parser.py" in get_local_part
 1800.     if value[0] in CFWS_LEADER:

Exception Type: IndexError at /nl-nl/wp4/adverse-event/103/
Exception Value: string index out of range
Request information:
USER: Sarah Mertens

GET: No GET data

POST:
alive_query_7 = 'False'
outcome = 'Good, katheter removed on 30-11-2015'
alive_query_3 = 'True'
cause_of_death_comment = ''
contact = '203'
serious_eligible_3 = 'True'
alive_query_5 = 'False'
date_of_death = ''
onset_at_date = '25-10-2015'
serious_eligible_6 = 'True'
rehospitalisation = 'True'
death = 'False'
organ = '73'
serious_eligible_4 = 'True'
biopsy_taken = 'False'
serious_eligible_5 = 'True'
description = 'Hematoma in transplant (increased after kidney biopt)'
serious_eligible_2 = 'False'
alive_query_9 = 'True'
alive_query_2 = 'True'
rehospitalisation_comments = ''
alive_query_6 = 'False'
dialysis_needed = 'False'
date_of_discharge = '06-11-2015'
date_of_admission = '25-10-2015'
action = 'Nefrostomy katheter (admission 11-11-2015 -> 16-11-2015)'
alive_query_1 = 'True'
categories = '28'
surgery_required = 'True'
csrfmiddlewaretoken = 'YCUN6LQqbn8eIE4v0fuOuO3qqelc7GCpm9zecx7wUlYnDMZvcM6LVJfQLHRcvUbc'
admitted_to_itu = 'False'
serious_eligible_1 = 'False'
event_ongoing = 'False'
alive_query_4 = 'False'
alive_query_8 = 'True'

FILES: No FILES data

COOKIES:
csrftoken = 'NFoeJMp9ZWgoZ3oDHXNcTWL8AzfwXcFObc3FPyGfIU6xUbjDTup9kRXyV2LwlqeB'
sessionid = 'jy7xfeuzy23bcy73m6xv4mpv8040qps0'

META:
CONTENT_LENGTH = '917'
CONTENT_TYPE = 'application/x-www-form-urlencoded'
CSRF_COOKIE = 'NFoeJMp9ZWgoZ3oDHXNcTWL8AzfwXcFObc3FPyGfIU6xUbjDTup9kRXyV2LwlqeB'
HTTP_ACCEPT = 'text/html, application/xhtml+xml, */*'
HTTP_ACCEPT_ENCODING = 'gzip, deflate'
HTTP_ACCEPT_LANGUAGE = 'nl-BE'
HTTP_CACHE_CONTROL = 'no-cache'
HTTP_CONNECTION = 'close'
HTTP_COOKIE = 'csrftoken=NFoeJMp9ZWgoZ3oDHXNcTWL8AzfwXcFObc3FPyGfIU6xUbjDTup9kRXyV2LwlqeB; sessionid=jy7xfeuzy23bcy73m6xv4mpv8040qps0'
HTTP_HOST = 'cope.nds.ox.ac.uk'
HTTP_REFERER = 'https://cope.nds.ox.ac.uk/nl-nl/wp4/adverse-event/103/'
HTTP_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko'
HTTP_X_FORWARDED_FOR = '134.58.179.6'
HTTP_X_FORWARDED_PROTOCOL = 'https'
HTTP_X_REAL_IP = '134.58.179.6'
HTTP_X_SCHEME = 'https'
PATH_INFO = '/nl-nl/wp4/adverse-event/103/'
QUERY_STRING = ''
RAW_URI = '/nl-nl/wp4/adverse-event/103/'
REMOTE_ADDR = "b''"
REQUEST_METHOD = 'POST'
SCRIPT_NAME = ''
SERVER_NAME = 'cope.nds.ox.ac.uk'
SERVER_PORT = '80'
SERVER_PROTOCOL = 'HTTP/1.0'
SERVER_SOFTWARE = 'gunicorn/19.7.0'
gunicorn.socket = <socket.socket fd=13, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, laddr=/sites/py3_cope/var/run/wsgi.socket>
wsgi.errors = <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f0eb2cc5ba8>
wsgi.file_wrapper = ''
wsgi.input = <gunicorn.http.body.Body object at 0x7f0eb2cc57b8>
wsgi.multiprocess = True
wsgi.multithread = False
wsgi.run_once = False
wsgi.url_scheme = 'http'
wsgi.version = 

Settings:
Using settings module config.settings.production
ABSOLUTE_URL_OVERRIDES = {}
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ADD_REVERSION_ADMIN = True
ADMINS = [('Carl Marshall', 'carl.marshall@nds.ox.ac.uk')]
ALLOWED_HOSTS = ['cope.nds.ox.ac.uk', 'localhost', '127.0.0.1']
APPEND_SLASH = True
APPS_DIR = <Path:/sites/py3_cope/cope_repo/wp4>
AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS = '********************'
AUTH_USER_MODEL = 'staff.Person'
AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify'
BASE_DIR = '/sites/py3_cope/cope_repo'
CACHES = {'default': {'LOCATION': '', 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS = 'default'
CACHE_MIDDLEWARE_KEY_PREFIX = '********************'
CACHE_MIDDLEWARE_SECONDS = 600
CRISPY_TEMPLATE_PACK = 'bootstrap3'
CSRF_COOKIE_AGE = 31449600
CSRF_COOKIE_DOMAIN = None
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_NAME = 'csrftoken'
CSRF_COOKIE_PATH = '/'
CSRF_COOKIE_SECURE = False
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS = []
DATABASES = {'default': {'OPTIONS': {}, 'PASSWORD': '********************', 'USER': '', 'PORT': '', 'CONN_MAX_AGE': 0, 'NAME': 'db.sqlite3', 'ATOMIC_REQUESTS': False, 'TEST': {'NAME': None, 'COLLATION': None, 'MIRROR': None, 'CHARSET': None}, 'TIME_ZONE': None, 'AUTOCOMMIT': True, 'HOST': '', 'ENGINE': 'django.db.backends.sqlite3'}}
DATABASE_ROUTERS = []
DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000
DATETIME_FORMAT = 'N j, Y, P'
DATETIME_INPUT_FORMATS = ['%d-%m-%Y %H:%M', '%Y-%m-%d %H:%M', '%d/%m/%Y %H:%M', '%Y/%m/%d %H:%M']
DATE_FORMAT = 'N j, Y'
DATE_INPUT_FORMATS = ['%d-%m-%Y', '%Y-%m-%d', '%d/%m/%Y', '%Y/%m/%d']
DEBUG = False
DEBUG_PROPAGATE_EXCEPTIONS = False
DECIMAL_SEPARATOR = '.'
DEFAULT_CHARSET = 'utf-8'
DEFAULT_CONTENT_TYPE = 'text/html'
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL = 'Cope DB <noreply@nds.ox.ac.uk>'
DEFAULT_INDEX_TABLESPACE = ''
DEFAULT_TABLESPACE = ''
DISALLOWED_USER_AGENTS = []
DJANGO_APPS = ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.contrib.admin', 'django.contrib.admindocs']
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_FILE_PATH = '/tmp'
EMAIL_HOST = 'smtp.ox.ac.uk'
EMAIL_HOST_PASSWORD = '********************'
EMAIL_HOST_USER = ''
EMAIL_PORT = 25
EMAIL_SSL_CERTFILE = None
EMAIL_SSL_KEYFILE = '********************'
EMAIL_SUBJECT_PREFIX = '[Cope DB] '
EMAIL_TIMEOUT = None
EMAIL_USE_SSL = False
EMAIL_USE_TLS = False
FILE_CHARSET = 'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
FILE_UPLOAD_PERMISSIONS = None
FILE_UPLOAD_TEMP_DIR = None
FIRST_DAY_OF_WEEK = 0
FIXTURE_DIRS = ['/sites/py3_cope/cope_repo/wp4/fixtures', '/sites/py3_cope/cope_repo/config/fixtures']
FORCE_SCRIPT_NAME = None
FORMAT_MODULE_PATH = None
IGNORABLE_404_URLS = []
INSTALLED_APPS = ['dal', 'dal_select2', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.contrib.admin', 'django.contrib.admindocs', 'crispy_forms', 'reversion', 'reversion_compare', 'wp4.compare', 'wp4.locations', 'wp4.staff', 'wp4.perfusion_machine', 'wp4.health_economics', 'wp4.samples', 'wp4.adverse_event', 'wp4.followups', 'wp4.administration', 'wp4.theme', 'djangosecure', 'gunicorn']
INTERNAL_IPS = []
LANGUAGES = [('en-gb', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7f0eb6d10048>), ('fr-be', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7f0eb6d10390>), ('nl-nl', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7f0eb6d10780>)]
LANGUAGES_BIDI = ['he', 'ar', 'fa', 'ur']
LANGUAGE_CODE = 'en-gb'
LANGUAGE_COOKIE_AGE = None
LANGUAGE_COOKIE_DOMAIN = None
LANGUAGE_COOKIE_NAME = 'django_language'
LANGUAGE_COOKIE_PATH = '/'
LOCALE_PATHS = ['/sites/py3_cope/cope_repo/locale']
LOCAL_APPS = ['wp4.compare', 'wp4.locations', 'wp4.staff', 'wp4.perfusion_machine', 'wp4.health_economics', 'wp4.samples', 'wp4.adverse_event', 'wp4.followups', 'wp4.administration', 'wp4.theme']
LOGGING = {'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'}}, 'version': 1, 'handlers': {'console': {'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'verbose'}, 'mail_admins': {'level': 'ERROR', 'class': 'django.utils.log.AdminEmailHandler', 'filters': ['require_debug_false']}}, 'formatters': {'verbose': {'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'}}, 'loggers': {'loggers': {'django.security.DisallowedHost': {'level': 'ERROR', 'handlers': ['console', 'mail_admins'], 'propagate': True}}, 'django.request': {'level': 'ERROR', 'handlers': ['mail_admins'], 'propagate': True}}, 'disable_existing_loggers': False}
LOGGING_CONFIG = 'logging.config.dictConfig'
LOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/accounts/login/'
LOGOUT_REDIRECT_URL = '/'
MANAGERS = [('Carl Marshall', 'carl.marshall@nds.ox.ac.uk')]
MEDIA_ROOT = '/sites/py3_cope/htdocs/media'
MEDIA_URL = '/media/'
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
MESSAGE_TAGS = {40: 'danger'}
MIDDLEWARE = None
MIDDLEWARE_CLASSES = ['djangosecure.middleware.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'reversion.middleware.RevisionMiddleware', 'config.middleware.activate_timezone.TimezoneMiddleware']
MIGRATION_MODULES = {}
MONTH_DAY_FORMAT = 'F j'
NUMBER_GROUPING = 0
PASSWORD_HASHERS = '********************'
PASSWORD_RESET_TIMEOUT_DAYS = '********************'
PREPEND_WWW = False
REDIRECT_FIELD_NAME = 'redirect_to'
ROOT_DIR = <Path:/sites/py3_cope/cope_repo>
ROOT_URLCONF = 'config.urls'
SECRET_KEY = '********************'
SECURE_BROWSER_XSS_FILTER = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_FRAME_DENY = True
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_SECONDS = 60
SECURE_PROXY_SSL_HEADER = 
SECURE_REDIRECT_EXEMPT = []
SECURE_SSL_HOST = None
SECURE_SSL_REDIRECT = True
SECURITY_MIDDLEWARE = ['djangosecure.middleware.SecurityMiddleware']
SERVER_EMAIL = 'Cope DB <noreply@nds.ox.ac.uk>'
SESSION_CACHE_ALIAS = 'default'
SESSION_COOKIE_AGE = 1209600
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_NAME = 'sessionid'
SESSION_COOKIE_PATH = '/'
SESSION_COOKIE_SECURE = False
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SESSION_FILE_PATH = None
SESSION_SAVE_EVERY_REQUEST = False
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE = 'config.settings.production'
SHORT_DATETIME_FORMAT = 'm/d/Y P'
SHORT_DATE_FORMAT = 'm/d/Y'
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS = []
SITE_ID = 1
STATICFILES_DIRS = ['/sites/py3_cope/cope_repo/wp4/static', '/sites/py3_cope/cope_repo/docs/static']
STATICFILES_FINDERS = ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT = '/sites/py3_cope/htdocs/'
STATIC_URL = '/static/'
TEMPLATES = [{'OPTIONS': {'debug': False, 'loaders': [('django.template.loaders.cached.Loader', ['django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader'])], 'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.i18n', 'django.template.context_processors.tz', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.contrib.messages.context_processors.messages']}, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['/sites/py3_cope/cope_repo/wp4/templates']}]
TEST_NON_SERIALIZED_APPS = []
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
THIRD_PARTY_APPS = ['crispy_forms', 'reversion', 'reversion_compare']
THIRD_PARTY_PRE_DJANGO_APPS = ['dal', 'dal_select2']
THOUSAND_SEPARATOR = ','
TIME_FORMAT = 'P'
TIME_INPUT_FORMATS = ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE = 'UTC'
USE_ETAGS = False
USE_I18N = True
USE_L10N = True
USE_THOUSAND_SEPARATOR = False
USE_TZ = True
USE_X_FORWARDED_HOST = False
USE_X_FORWARDED_PORT = False
WSGI_APPLICATION = 'config.wsgi.application'
X_FRAME_OPTIONS = 'SAMEORIGIN'
YEAR_MONTH_FORMAT = 'F Y'

Repeats for IDs 103, 101, 99, 100, 96, 95, 94, 74, 73, 72, 71, 66, 64, 56, 52, 48, 44, 8 (over 10 times!), 9.

First email of the day...

Internal Server Error: /nl-nl/wp4/adverse-event/8/

IndexError at /nl-nl/wp4/adverse-event/8/
string index out of range

Request Method: POST
Request URL: https://cope.nds.ox.ac.uk/nl-nl/wp4/adverse-event/8/
Django Version: 1.10.6
Python Executable: /sites/.virtualenvs/py3_cope/bin/python3
Python Version: 3.5.2
Python Path: ['/sites/py3_cope/cope_repo', '/sites/.virtualenvs/py3_cope/bin', '/sites/py3_cope/cope_repo/${PYTHONPATH}', '/sites/py3_cope/cope_repo', '/sites/.virtualenvs/py3_cope/lib/python35.zip', '/sites/.virtualenvs/py3_cope/lib/python3.5', '/sites/.virtualenvs/py3_cope/lib/python3.5/plat-x86_64-linux-gnu', '/sites/.virtualenvs/py3_cope/lib/python3.5/lib-dynload', '/usr/lib/python3.5', '/usr/lib/python3.5/plat-x86_64-linux-gnu', '/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages', '/sites/.virtualenvs/py3_cope/src/django-crispy-forms']
Server time: vrij, 31 Mrt 2017 07:47:25 +0200
Installed Applications:
['dal',
'dal_select2',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.humanize',
'django.contrib.admin',
'django.contrib.admindocs',
'crispy_forms',
'reversion',
'reversion_compare',
'wp4.compare',
'wp4.locations',
'wp4.staff',
'wp4.perfusion_machine',
'wp4.health_economics',
'wp4.samples',
'wp4.adverse_event',
'wp4.followups',
'wp4.administration',
'wp4.theme',
'djangosecure',
'gunicorn']
Installed Middleware:
['djangosecure.middleware.SecurityMiddleware',
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'reversion.middleware.RevisionMiddleware',
'config.middleware.activate_timezone.TimezoneMiddleware']

Traceback:  

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/handlers/exception.py" in inner
 42.             response = get_response(request)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/handlers/base.py" in _legacy_get_response
 249.             response = self._get_response(request)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
 187.                 response = self.process_exception_by_middleware(e, request)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/handlers/base.py" in _get_response
 185.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/views/generic/base.py" in view
 68.             return self.dispatch(request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/braces/views/_access.py" in dispatch
 102.             request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/braces/views/_access.py" in dispatch
 201.             request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/views/generic/base.py" in dispatch
 88.         return handler(request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/views/generic/edit.py" in post
 240.         return super(BaseUpdateView, self).post(request, *args, **kwargs)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/views/generic/edit.py" in post
 183.             return self.form_valid(form)

File "/sites/py3_cope/cope_repo/wp4/adverse_event/views.py" in form_valid
 77.             return super(AjaxFormMixin, self).form_valid(form)

File "/sites/py3_cope/cope_repo/wp4/adverse_event/views.py" in form_valid
 59.             email.send()

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/message.py" in send
 342.         return self.get_connection(fail_silently).send_messages([self])

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/backends/smtp.py" in send_messages
 107.                 sent = self._send(message)

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/backends/smtp.py" in _send
 120.         recipients = [sanitize_address(addr, encoding) for addr in email_message.recipients()]

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/backends/smtp.py" in <listcomp>
 120.         recipients = [sanitize_address(addr, encoding) for addr in email_message.recipients()]

File "/sites/.virtualenvs/py3_cope/lib/python3.5/site-packages/django/core/mail/message.py" in sanitize_address
 161.         address = Address(nm, addr_spec=addr)

File "/usr/lib/python3.5/email/headerregistry.py" in __init__
 42.             a_s, rest = parser.get_addr_spec(addr_spec)

File "/usr/lib/python3.5/email/_header_value_parser.py" in get_addr_spec
 1988.     token, value = get_local_part(value)

File "/usr/lib/python3.5/email/_header_value_parser.py" in get_local_part
 1800.     if value[0] in CFWS_LEADER:

Exception Type: IndexError at /nl-nl/wp4/adverse-event/8/
Exception Value: string index out of range
Request information:
USER: Sarah Mertens

GET: No GET data

POST:
alive_query_7 = 'False'
outcome = 'resolved'
alive_query_3 = 'True'
cause_of_death_comment = ''
contact = '245'
serious_eligible_3 = 'False'
alive_query_5 = 'False'
date_of_death = ''
onset_at_date = '22-11-2015'
serious_eligible_6 = 'False'
rehospitalisation = 'False'
death = 'False'
organ = '104'
serious_eligible_4 = 'False'
biopsy_taken = 'False'
serious_eligible_5 = 'True'
description = 'patient had diarrhea from 22/11/2015 until 27/11/2015.\r\nstool sample of 24/11/2015 showed positive results for Campylobacter jejuni'
serious_eligible_2 = 'False'
alive_query_9 = 'False'
alive_query_2 = 'True'
rehospitalisation_comments = ''
alive_query_6 = 'False'
dialysis_needed = 'False'
date_of_discharge = ''
date_of_admission = ''
action = 'clarithromycine was given during 7 days, from 25/11/2015 until 01/12/2015, 250mg, BID, oral'
alive_query_1 = 'True'
categories = '23'
surgery_required = 'False'
csrfmiddlewaretoken = 'rcD20ID25I2BL9dMsZpxRKMfXlP2mF9ALe5MTvaYupYENEEF8CkweZljCbhBhoOO'
admitted_to_itu = 'False'
serious_eligible_1 = 'False'
event_ongoing = 'False'
alive_query_4 = 'False'
alive_query_8 = 'True'

FILES: No FILES data

COOKIES:
csrftoken = '3zhRKxCeZxO2YpOnz6YPXs89769npZ1OnBJBDk9aoeK50UfgfJTOkHHdMWBWkIG2'
sessionid = 'z06xr01gdtyn45cip0c70189rnwqz2dk'

META:
CONTENT_LENGTH = '1023'
CONTENT_TYPE = 'application/x-www-form-urlencoded'
CSRF_COOKIE = '3zhRKxCeZxO2YpOnz6YPXs89769npZ1OnBJBDk9aoeK50UfgfJTOkHHdMWBWkIG2'
HTTP_ACCEPT = 'text/html, application/xhtml+xml, */*'
HTTP_ACCEPT_ENCODING = 'gzip, deflate'
HTTP_ACCEPT_LANGUAGE = 'nl-BE'
HTTP_CACHE_CONTROL = 'no-cache'
HTTP_CONNECTION = 'close'
HTTP_COOKIE = 'csrftoken=3zhRKxCeZxO2YpOnz6YPXs89769npZ1OnBJBDk9aoeK50UfgfJTOkHHdMWBWkIG2; sessionid=z06xr01gdtyn45cip0c70189rnwqz2dk'
HTTP_HOST = 'cope.nds.ox.ac.uk'
HTTP_REFERER = 'https://cope.nds.ox.ac.uk/nl-nl/wp4/adverse-event/8/'
HTTP_USER_AGENT = 'Mozilla/5.0 (Windows NT 6.1; WOW64; Trident/7.0; rv:11.0) like Gecko'
HTTP_X_FORWARDED_FOR = '134.58.179.6'
HTTP_X_FORWARDED_PROTOCOL = 'https'
HTTP_X_REAL_IP = '134.58.179.6'
HTTP_X_SCHEME = 'https'
PATH_INFO = '/nl-nl/wp4/adverse-event/8/'
QUERY_STRING = ''
RAW_URI = '/nl-nl/wp4/adverse-event/8/'
REMOTE_ADDR = "b''"
REQUEST_METHOD = 'POST'
SCRIPT_NAME = ''
SERVER_NAME = 'cope.nds.ox.ac.uk'
SERVER_PORT = '80'
SERVER_PROTOCOL = 'HTTP/1.0'
SERVER_SOFTWARE = 'gunicorn/19.7.0'
gunicorn.socket = <socket.socket fd=12, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0, laddr=/sites/py3_cope/var/run/wsgi.socket>
wsgi.errors = <gunicorn.http.wsgi.WSGIErrorsWrapper object at 0x7f0eb2b244e0>
wsgi.file_wrapper = ''
wsgi.input = <gunicorn.http.body.Body object at 0x7f0eb2c65ba8>
wsgi.multiprocess = True
wsgi.multithread = False
wsgi.run_once = False
wsgi.url_scheme = 'http'
wsgi.version = 

Settings:
Using settings module config.settings.production
ABSOLUTE_URL_OVERRIDES = {}
ACCOUNT_AUTHENTICATION_METHOD = 'username'
ACCOUNT_EMAIL_REQUIRED = True
ACCOUNT_EMAIL_VERIFICATION = 'mandatory'
ADD_REVERSION_ADMIN = True
ADMINS = [('Carl Marshall', 'carl.marshall@nds.ox.ac.uk')]
ALLOWED_HOSTS = ['cope.nds.ox.ac.uk', 'localhost', '127.0.0.1']
APPEND_SLASH = True
APPS_DIR = <Path:/sites/py3_cope/cope_repo/wp4>
AUTHENTICATION_BACKENDS = ['django.contrib.auth.backends.ModelBackend']
AUTH_PASSWORD_VALIDATORS = '********************'
AUTH_USER_MODEL = 'staff.Person'
AUTOSLUG_SLUGIFY_FUNCTION = 'slugify.slugify'
BASE_DIR = '/sites/py3_cope/cope_repo'
CACHES = {'default': {'LOCATION': '', 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache'}}
CACHE_MIDDLEWARE_ALIAS = 'default'
CACHE_MIDDLEWARE_KEY_PREFIX = '********************'
CACHE_MIDDLEWARE_SECONDS = 600
CRISPY_TEMPLATE_PACK = 'bootstrap3'
CSRF_COOKIE_AGE = 31449600
CSRF_COOKIE_DOMAIN = None
CSRF_COOKIE_HTTPONLY = False
CSRF_COOKIE_NAME = 'csrftoken'
CSRF_COOKIE_PATH = '/'
CSRF_COOKIE_SECURE = False
CSRF_FAILURE_VIEW = 'django.views.csrf.csrf_failure'
CSRF_HEADER_NAME = 'HTTP_X_CSRFTOKEN'
CSRF_TRUSTED_ORIGINS = []
DATABASES = {'default': {'OPTIONS': {}, 'PASSWORD': '********************', 'USER': '', 'PORT': '', 'CONN_MAX_AGE': 0, 'NAME': 'db.sqlite3', 'ATOMIC_REQUESTS': False, 'TEST': {'NAME': None, 'COLLATION': None, 'MIRROR': None, 'CHARSET': None}, 'TIME_ZONE': None, 'AUTOCOMMIT': True, 'HOST': '', 'ENGINE': 'django.db.backends.sqlite3'}}
DATABASE_ROUTERS = []
DATA_UPLOAD_MAX_MEMORY_SIZE = 2621440
DATA_UPLOAD_MAX_NUMBER_FIELDS = 1000
DATETIME_FORMAT = 'N j, Y, P'
DATETIME_INPUT_FORMATS = ['%d-%m-%Y %H:%M', '%Y-%m-%d %H:%M', '%d/%m/%Y %H:%M', '%Y/%m/%d %H:%M']
DATE_FORMAT = 'N j, Y'
DATE_INPUT_FORMATS = ['%d-%m-%Y', '%Y-%m-%d', '%d/%m/%Y', '%Y/%m/%d']
DEBUG = False
DEBUG_PROPAGATE_EXCEPTIONS = False
DECIMAL_SEPARATOR = '.'
DEFAULT_CHARSET = 'utf-8'
DEFAULT_CONTENT_TYPE = 'text/html'
DEFAULT_EXCEPTION_REPORTER_FILTER = 'django.views.debug.SafeExceptionReporterFilter'
DEFAULT_FILE_STORAGE = 'django.core.files.storage.FileSystemStorage'
DEFAULT_FROM_EMAIL = 'Cope DB <noreply@nds.ox.ac.uk>'
DEFAULT_INDEX_TABLESPACE = ''
DEFAULT_TABLESPACE = ''
DISALLOWED_USER_AGENTS = []
DJANGO_APPS = ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.contrib.admin', 'django.contrib.admindocs']
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_FILE_PATH = '/tmp'
EMAIL_HOST = 'smtp.ox.ac.uk'
EMAIL_HOST_PASSWORD = '********************'
EMAIL_HOST_USER = ''
EMAIL_PORT = 25
EMAIL_SSL_CERTFILE = None
EMAIL_SSL_KEYFILE = '********************'
EMAIL_SUBJECT_PREFIX = '[Cope DB] '
EMAIL_TIMEOUT = None
EMAIL_USE_SSL = False
EMAIL_USE_TLS = False
FILE_CHARSET = 'utf-8'
FILE_UPLOAD_DIRECTORY_PERMISSIONS = None
FILE_UPLOAD_HANDLERS = ['django.core.files.uploadhandler.MemoryFileUploadHandler', 'django.core.files.uploadhandler.TemporaryFileUploadHandler']
FILE_UPLOAD_MAX_MEMORY_SIZE = 2621440
FILE_UPLOAD_PERMISSIONS = None
FILE_UPLOAD_TEMP_DIR = None
FIRST_DAY_OF_WEEK = 0
FIXTURE_DIRS = ['/sites/py3_cope/cope_repo/wp4/fixtures', '/sites/py3_cope/cope_repo/config/fixtures']
FORCE_SCRIPT_NAME = None
FORMAT_MODULE_PATH = None
IGNORABLE_404_URLS = []
INSTALLED_APPS = ['dal', 'dal_select2', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.humanize', 'django.contrib.admin', 'django.contrib.admindocs', 'crispy_forms', 'reversion', 'reversion_compare', 'wp4.compare', 'wp4.locations', 'wp4.staff', 'wp4.perfusion_machine', 'wp4.health_economics', 'wp4.samples', 'wp4.adverse_event', 'wp4.followups', 'wp4.administration', 'wp4.theme', 'djangosecure', 'gunicorn']
INTERNAL_IPS = []
LANGUAGES = [('en-gb', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7f0eb6d06f60>), ('fr-be', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7f0eb6d10320>), ('nl-nl', <django.utils.functional.lazy.<locals>.__proxy__ object at 0x7f0eb6d10710>)]
LANGUAGES_BIDI = ['he', 'ar', 'fa', 'ur']
LANGUAGE_CODE = 'en-gb'
LANGUAGE_COOKIE_AGE = None
LANGUAGE_COOKIE_DOMAIN = None
LANGUAGE_COOKIE_NAME = 'django_language'
LANGUAGE_COOKIE_PATH = '/'
LOCALE_PATHS = ['/sites/py3_cope/cope_repo/locale']
LOCAL_APPS = ['wp4.compare', 'wp4.locations', 'wp4.staff', 'wp4.perfusion_machine', 'wp4.health_economics', 'wp4.samples', 'wp4.adverse_event', 'wp4.followups', 'wp4.administration', 'wp4.theme']
LOGGING = {'filters': {'require_debug_false': {'()': 'django.utils.log.RequireDebugFalse'}}, 'version': 1, 'handlers': {'console': {'level': 'DEBUG', 'class': 'logging.StreamHandler', 'formatter': 'verbose'}, 'mail_admins': {'level': 'ERROR', 'class': 'django.utils.log.AdminEmailHandler', 'filters': ['require_debug_false']}}, 'formatters': {'verbose': {'format': '%(levelname)s %(asctime)s %(module)s %(process)d %(thread)d %(message)s'}}, 'loggers': {'loggers': {'django.security.DisallowedHost': {'level': 'ERROR', 'handlers': ['console', 'mail_admins'], 'propagate': True}}, 'django.request': {'level': 'ERROR', 'handlers': ['mail_admins'], 'propagate': True}}, 'disable_existing_loggers': False}
LOGGING_CONFIG = 'logging.config.dictConfig'
LOGIN_REDIRECT_URL = '/'
LOGIN_URL = '/accounts/login/'
LOGOUT_REDIRECT_URL = '/'
MANAGERS = [('Carl Marshall', 'carl.marshall@nds.ox.ac.uk')]
MEDIA_ROOT = '/sites/py3_cope/htdocs/media'
MEDIA_URL = '/media/'
MESSAGE_STORAGE = 'django.contrib.messages.storage.fallback.FallbackStorage'
MESSAGE_TAGS = {40: 'danger'}
MIDDLEWARE = None
MIDDLEWARE_CLASSES = ['djangosecure.middleware.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.locale.LocaleMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'reversion.middleware.RevisionMiddleware', 'config.middleware.activate_timezone.TimezoneMiddleware']
MIGRATION_MODULES = {}
MONTH_DAY_FORMAT = 'F j'
NUMBER_GROUPING = 0
PASSWORD_HASHERS = '********************'
PASSWORD_RESET_TIMEOUT_DAYS = '********************'
PREPEND_WWW = False
REDIRECT_FIELD_NAME = 'redirect_to'
ROOT_DIR = <Path:/sites/py3_cope/cope_repo>
ROOT_URLCONF = 'config.urls'
SECRET_KEY = '********************'
SECURE_BROWSER_XSS_FILTER = True
SECURE_CONTENT_TYPE_NOSNIFF = True
SECURE_FRAME_DENY = True
SECURE_HSTS_INCLUDE_SUBDOMAINS = True
SECURE_HSTS_SECONDS = 60
SECURE_PROXY_SSL_HEADER = 
SECURE_REDIRECT_EXEMPT = []
SECURE_SSL_HOST = None
SECURE_SSL_REDIRECT = True
SECURITY_MIDDLEWARE = ['djangosecure.middleware.SecurityMiddleware']
SERVER_EMAIL = 'Cope DB <noreply@nds.ox.ac.uk>'
SESSION_CACHE_ALIAS = 'default'
SESSION_COOKIE_AGE = 1209600
SESSION_COOKIE_DOMAIN = None
SESSION_COOKIE_HTTPONLY = True
SESSION_COOKIE_NAME = 'sessionid'
SESSION_COOKIE_PATH = '/'
SESSION_COOKIE_SECURE = False
SESSION_ENGINE = 'django.contrib.sessions.backends.db'
SESSION_EXPIRE_AT_BROWSER_CLOSE = False
SESSION_FILE_PATH = None
SESSION_SAVE_EVERY_REQUEST = False
SESSION_SERIALIZER = 'django.contrib.sessions.serializers.JSONSerializer'
SETTINGS_MODULE = 'config.settings.production'
SHORT_DATETIME_FORMAT = 'm/d/Y P'
SHORT_DATE_FORMAT = 'm/d/Y'
SIGNING_BACKEND = 'django.core.signing.TimestampSigner'
SILENCED_SYSTEM_CHECKS = []
SITE_ID = 1
STATICFILES_DIRS = ['/sites/py3_cope/cope_repo/wp4/static', '/sites/py3_cope/cope_repo/docs/static']
STATICFILES_FINDERS = ['django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder']
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'
STATIC_ROOT = '/sites/py3_cope/htdocs/'
STATIC_URL = '/static/'
TEMPLATES = [{'OPTIONS': {'debug': False, 'loaders': [('django.template.loaders.cached.Loader', ['django.template.loaders.filesystem.Loader', 'django.template.loaders.app_directories.Loader'])], 'context_processors': ['django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.template.context_processors.i18n', 'django.template.context_processors.tz', 'django.template.context_processors.media', 'django.template.context_processors.static', 'django.contrib.messages.context_processors.messages']}, 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': ['/sites/py3_cope/cope_repo/wp4/templates']}]
TEST_NON_SERIALIZED_APPS = []
TEST_RUNNER = 'django.test.runner.DiscoverRunner'
THIRD_PARTY_APPS = ['crispy_forms', 'reversion', 'reversion_compare']
THIRD_PARTY_PRE_DJANGO_APPS = ['dal', 'dal_select2']
THOUSAND_SEPARATOR = ','
TIME_FORMAT = 'P'
TIME_INPUT_FORMATS = ['%H:%M:%S', '%H:%M:%S.%f', '%H:%M']
TIME_ZONE = 'UTC'
USE_ETAGS = False
USE_I18N = True
USE_L10N = True
USE_THOUSAND_SEPARATOR = False
USE_TZ = True
USE_X_FORWARDED_HOST = False
USE_X_FORWARDED_PORT = False
WSGI_APPLICATION = 'config.wsgi.application'
X_FRAME_OPTIONS = 'SAMEORIGIN'
YEAR_MONTH_FORMAT = 'F Y'`

Suspect this is what @mertenssarah is referring to in #272

mertenssarah commented 7 years ago

yes it is... Can this be solved? Or will it not possible to save categories for these AEs today?

marshalc commented 7 years ago

Yes, and will be solved in the 0.8.1 release. Dependant on how today's tasks go that should be out in the next 24-36 hours.

marshalc commented 7 years ago

So the problem here is related to email addresses for the people this is to be sent to... need to look at the data and find out what's missing.

marshalc commented 7 years ago

These are all due to missing or invalid email addresses for the Local Investigator on record. Attempting to do an enhanced email message that highlights missing data, and can handle the problem. Data appears to have been saving fine even, though the ISE will have triggered after the save whilst attempting to send the email.