#13227: Query cloning fails with models having Lock as instance member
------------------------------------------+---------------------------------
 Reporter:  claudep                       |       Owner:  nobody    
   Status:  new                           |   Milestone:            
Component:  Database layer (models, ORM)  |     Version:  1.2-beta  
 Keywords:                                |       Stage:  Unreviewed
Has_patch:  0                             |  
------------------------------------------+---------------------------------
 Here is a basic test case:
 {{{
 import threading
 from django.db import models

 class BaseObject(models.Model):
     status      = models.CharField(max_length=10)
     foreign     = models.ForeignKey('MyModel')

 class MyModel(models.Model):
     name = models.CharField(max_length=10)

     def __init__(self, *args, **kwargs):
         super(MyModel, self).__init__(*args, **kwargs)
         self.checkout_lock = threading.Lock()
 }}}
 Now as soon as a query with MyModel instance has to be cloned, this fails.
 {{{
 from testapp.models import MyModel, BaseObject
 mm = MyModel(name='Test1')
 mm.save()
 bo = BaseObject(status='a',foreign=mm)
 bo.save()

 print BaseObject.objects.filter(foreign=mm).order_by('foreign__name')
 (full traceback here)
 Error: un(deep)copyable object of type <type 'thread.lock'>
 }}}

-- 
Ticket URL: <http://code.djangoproject.com/ticket/13227>
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-upda...@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