#22304: permission creation during the migration raises data error
-------------------------+-------------------------------------------------
     Reporter:           |      Owner:  secult
  secult@…               |     Status:  new
         Type:  Bug      |    Version:  1.6
    Component:           |   Keywords:  migration permission creation
  contrib.auth           |  signal bug
     Severity:  Normal   |  Has patch:  0
 Triage Stage:           |      UI/UX:  0
  Unreviewed             |
Easy pickings:  0        |
-------------------------+-------------------------------------------------
 A DataError raises while permissions are created.
 I think there is a problem because of the long model names - the
 Permission model, while saved, is not validated against the db fields-
 mainly:
 {{{
 name models.CharField(_('name'), max_length=50)
 }}}
 that is easy to reach.

 Traceback:
 {{{
 Running migrations for accounting:
  - Migrating forwards to
 0053_auto__add_taxdecfirstattachmentmodel__add_taxdecsecondattachmentmodel_.
  >
 
accounting:0053_auto__add_taxdecfirstattachmentmodel__add_taxdecsecondattachmentmodel_
 Traceback (most recent call last):
   File "./manage.py", line 10, in <module>
     execute_from_command_line(sys.argv)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 399, in
 execute_from_command_line
     utility.execute()
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/core/management/__init__.py", line 392, in execute
     self.fetch_command(subcommand).run_from_argv(self.argv)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/core/management/base.py", line 242, in run_from_argv
     self.execute(*args, **options.__dict__)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/core/management/base.py", line 285, in execute
     output = self.handle(*args, **options)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/south/management/commands/migrate.py", line 111, in handle
     ignore_ghosts = ignore_ghosts,
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/south/migration/__init__.py", line 220, in migrate_app
     success = migrator.migrate_many(target, workplan, database)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/south/migration/migrators.py", line 254, in migrate_many
     result = migrator.__class__.migrate_many(migrator, target, migrations,
 database)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/south/migration/migrators.py", line 335, in migrate_many
     interactive=self.interactive)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/south/db/generic.py", line 1030, in send_pending_create_signals
     interactive=interactive)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/south/db/generic.py", line 1076, in really_send_create_signal
     db=self.db_alias,
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/dispatch/dispatcher.py", line 185, in send
     response = receiver(signal=self, sender=sender, **named)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/contrib/auth/management/__init__.py", line 101, in
 create_permissions
     auth_app.Permission.objects.using(db).bulk_create(perms)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/db/models/query.py", line 356, in bulk_create
     self._batched_insert(objs_without_pk, fields, batch_size)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/db/models/query.py", line 835, in _batched_insert
     using=self.db)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/db/models/manager.py", line 232, in _insert
     return insert_query(self.model, objs, fields, **kwargs)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/db/models/query.py", line 1511, in insert_query
     return query.get_compiler(using=using).execute_sql(return_id)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/db/models/sql/compiler.py", line 898, in execute_sql
     cursor.execute(sql, params)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/db/backends/util.py", line 69, in execute
     return super(CursorDebugWrapper, self).execute(sql, params)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/db/backends/util.py", line 53, in execute
     return self.cursor.execute(sql, params)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/db/utils.py", line 99, in __exit__
     six.reraise(dj_exc_type, dj_exc_value, traceback)
   File "/data/jedna_sest/local/lib/python2.7/site-
 packages/django/db/backends/util.py", line 53, in execute
     return self.cursor.execute(sql, params)
 django.db.utils.DataError: value too long for type character varying(50)
 }}}
 (Using South 0.8.4 but thats not important)

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22304>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/059.56b10e3d44e251ac0f65703abaf036bd%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to