Our CAS server is returning names longer than the 30 characters in some instances (our source auth is kerberos which allows 256 chars), as a result we get stack traces when using django-cas-ng of this sort:
Traceback (most recent call last):
File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 132, in get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django_cas_ng/views.py", line 103, in login
user = authenticate(ticket=ticket, service=service, request=request)
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/auth/__init__.py", line 74, in authenticate
user = backend.authenticate(**credentials)
File "/app/.heroku/python/lib/python2.7/site-packages/django_cas_ng/backends.py", line 256, in authenticate
user = User.objects.create_user(username, '')
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/auth/models.py", line 187, in create_user
**extra_fields)
File "/app/.heroku/python/lib/python2.7/site-packages/django/contrib/auth/models.py", line 182, in _create_user
user.save(using=self._db)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/base.py", line 710, in save
force_update=force_update, update_fields=update_fields)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/base.py", line 738, in save_base
updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/base.py", line 822, in _save_table
result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/base.py", line 861, in _do_insert
using=using, raw=raw)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/manager.py", line 127, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/query.py", line 920, in _insert
return query.get_compiler(using=using).execute_sql(return_id)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 974, in execute_sql
cursor.execute(sql, params)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/utils.py", line 97, in __exit__
six.reraise(dj_exc_type, dj_exc_value, traceback)
File "/app/.heroku/python/lib/python2.7/site-packages/django/db/backends/utils.py", line 64, in execute
return self.cursor.execute(sql, params)
DataError: value too long for type character varying(30)
Would you be interested in a patch to do some automated truncation of some sort in this project, or am I better off trying a custom user model, or patching the user.username field?