#11936: Proxy models' names are too long for django.contrib.auth which causes 
weird
test failures
------------------------------------------+---------------------------------
 Reporter:  ryszard                       |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  1.1       
 Keywords:  test, only, deferred fields   |       Stage:  Unreviewed
Has_patch:  0                             |  
------------------------------------------+---------------------------------
 When you call `SomeModel.objects.only('somefield')`, then the generated
 deferred proxy model class name may be too long for
 django.contrib.auth.models.Permission, resulting in DB warnings which are
 raised as an exception.

 This manifests itself if you use `only` in your tests cases. The just
 created proxy model will still be floating among the normal models and
 contrib.auth.management.create_permissions will try to create Permission
 objects, resulting in queries like

     INSERT INTO `auth_permission` (`name`, `content_type_id`, `codename`)
 VALUES (Can add episode_
 
deferred_air_date_art_large_art_medium_art_small_created_description_duration_free_available_free_channel_free_video_url_info_modified_number_parental_rating_released_season_streaming_available_subscription_id,
 19,
 
add_episode_deferred_air_date_art_large_art_medium_art_small_created_description_duration_free_available_free_channel_free_video_url_info_modified_number_parental_rating_released_season_streaming_available_subscription_id)

 which will cause the NEXT test case to fail.

 I was able to reproduce this on Linux, with Python 2.6, MySQL_python
 1.2.3c1 and MySQL 5.0.51a (it may depend on how django reacts to MySQL
 warnings). I will attach a models.py and tests.py that allow to reproduce
 this bug.

 Potential solutions: django.db.models.get_models should not return proxies
 for deferred models, the deferred proxy models should have shorter names
 or their type some custom __repr__.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11936>
Django <http://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 post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to