Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

create_or_update_partner error when 'code' is too long #451

Open
danielmcquillen opened this issue Nov 24, 2016 · 0 comments
Open

create_or_update_partner error when 'code' is too long #451

danielmcquillen opened this issue Nov 24, 2016 · 0 comments

Comments

@danielmcquillen
Copy link

danielmcquillen commented Nov 24, 2016

The create_or_update_partner command doesn't gracefully handle a 'code' string that it considers too long. The first time I ran this command (i.e. no existing partners), I used a code 15 characters long. Here's the error I got...

Traceback (most recent call last):
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/query.py", line 480, in update_or_create
    obj = self.get(**lookup)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/query.py", line 387, in get
    self.model._meta.object_name
course_discovery.apps.core.models.DoesNotExist: Partner matching query does not exist.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./manage.py", line 15, in <module>
    execute_from_command_line(sys.argv)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
    utility.execute()
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/core/management/__init__.py", line 345, in execute
    self.fetch_command(subcommand).run_from_argv(self.argv)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/core/management/base.py", line 348, in run_from_argv
    self.execute(*args, **cmd_options)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/core/management/base.py", line 399, in execute
    output = self.handle(*args, **options)
  File "/edx/app/discovery/discovery/course_discovery/apps/core/management/commands/create_or_update_partner.py", line 113, in handle
    'oidc_secret': options.get('oidc_secret'),
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/manager.py", line 122, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/query.py", line 482, in update_or_create
    obj, created = self._create_object_from_params(lookup, params)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/query.py", line 499, in _create_object_from_params
    obj = self.create(**params)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/query.py", line 401, in create
    obj.save(force_insert=True, using=self.db)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django_extensions/db/models.py", line 24, in save
    super(TimeStampedModel, self).save(**kwargs)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/base.py", line 708, in save
    force_update=force_update, update_fields=update_fields)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/base.py", line 736, in save_base
    updated = self._save_table(raw, cls, force_insert, force_update, using, update_fields)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/base.py", line 820, in _save_table
    result = self._do_insert(cls._base_manager, using, fields, update_pk, raw)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/base.py", line 859, in _do_insert
    using=using, raw=raw)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/manager.py", line 122, in manager_method
    return getattr(self.get_queryset(), name)(*args, **kwargs)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/query.py", line 1039, in _insert
    return query.get_compiler(using=using).execute_sql(return_id)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/models/sql/compiler.py", line 1060, in execute_sql
    cursor.execute(sql, params)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/backends/utils.py", line 64, in execute
    return self.cursor.execute(sql, params)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/django/db/backends/mysql/base.py", line 112, in execute
    return self.cursor.execute(query, args)
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/MySQLdb/cursors.py", line 228, in execute
    if not self._defer_warnings: self._warning_check()
  File "/edx/app/discovery/venvs/discovery/lib/python3.5/site-packages/MySQLdb/cursors.py", line 127, in _warning_check
    warn(w[-1], self.Warning, 3)
_mysql_exceptions.Warning: Data truncated for column 'short_code' at row 1
@danielmcquillen danielmcquillen changed the title Error when code is too long create_or_update_partner error when 'code' is too long Nov 24, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant