Re: Errors

2021-08-11 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
Please take this conversation elsewhere as per my previous post.

On Wed, 11 Aug 2021 at 13:33, Umar Farooq 
wrote:

> Sorry code screenshots
>
> On Wed, 11 Aug 2021, 5:27 PM Rana Zain,  wrote:
>
>> Okay I am sending screenshot.[image: erroits.PNG]
>>
>> On Tuesday, August 10, 2021 at 6:26:42 PM UTC+5 Adam Johnson wrote:
>>
>>> Hi!
>>>
>>> I think you've found the wrong mailing list for this post. This mailing
>>> list is for discussing the development of Django itself, not for support
>>> using Django. This means the discussions of bugs and features in Django
>>> itself, rather than in your code using it. People on this list are unlikely
>>> to answer your support query with their limited time and energy.
>>>
>>> For support, please follow the "Getting Help" page:
>>> https://docs.djangoproject.com/en/3.2/faq/help/ . This will help you
>>> find people who are willing to support you, and to ask your question in a
>>> way that makes it easy for them to answer.
>>>
>>> Thanks for your understanding and all the best,
>>>
>>> Adam
>>>
>>> On Tue, 10 Aug 2021 at 13:05, Rana Zain  wrote:
>>>
 I am facing this errors :

 > ',' or ')' expected
 > Unexpected indent
 > Statement expected, found Py:DEDENT

 for the last 2,3 days. Kindly help me out.

 --

>>> You received this message because you are subscribed to the Google
 Groups "Django developers (Contributions to Django itself)" group.
 To unsubscribe from this group and stop receiving emails from it, send
 an email to django-develop...@googlegroups.com.
 To view this discussion on the web visit
 https://groups.google.com/d/msgid/django-developers/89e0b61f-25c5-4438-9a7d-20ffb0de82fen%40googlegroups.com
 
 .

>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-developers+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-developers/fa42e3bf-a965-4c57-885f-383a75b1c86cn%40googlegroups.com
>> 
>> .
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/CAPpmBN_UP1nyz-Xig_LWnVwwHJFmUJxc4N22DnYF-GXuaiLjOw%40mail.gmail.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM3o9RkNHaFffVLLr0kA70kCCwYFLQrcYbcWGA%2BrHxD2rw%40mail.gmail.com.


Re: Errors

2021-08-11 Thread Kye Russell
As Adam has stated, this is not a forum to discuss issues with your code. 
Please see the links in his reply. 

Kye

> On 11 Aug 2021, at 8:35 pm, Umar Farooq  wrote:
> 
> 
> Sorry code screenshots
> 
>> On Wed, 11 Aug 2021, 5:27 PM Rana Zain,  wrote:
>> Okay I am sending screenshot.
>> 
>> 
>> 
>>> On Tuesday, August 10, 2021 at 6:26:42 PM UTC+5 Adam Johnson wrote:
>>> Hi!
>>> 
>>> I think you've found the wrong mailing list for this post. This mailing 
>>> list is for discussing the development of Django itself, not for support 
>>> using Django. This means the discussions of bugs and features in Django 
>>> itself, rather than in your code using it. People on this list are unlikely 
>>> to answer your support query with their limited time and energy.
>>> 
>>> For support, please follow the "Getting Help" page: 
>>> https://docs.djangoproject.com/en/3.2/faq/help/ . This will help you find 
>>> people who are willing to support you, and to ask your question in a way 
>>> that makes it easy for them to answer.
>>> 
>>> Thanks for your understanding and all the best,
>>> 
>>> Adam
>>> 
 On Tue, 10 Aug 2021 at 13:05, Rana Zain  wrote:
 I am facing this errors :
 
 > ',' or ')' expected
 > Unexpected indent
 > Statement expected, found Py:DEDENT
 
 for the last 2,3 days. Kindly help me out.
>>> 
 -- 
>>> 
 You received this message because you are subscribed to the Google Groups 
 "Django developers (Contributions to Django itself)" group.
 To unsubscribe from this group and stop receiving emails from it, send an 
 email to django-develop...@googlegroups.com.
 To view this discussion on the web visit 
 https://groups.google.com/d/msgid/django-developers/89e0b61f-25c5-4438-9a7d-20ffb0de82fen%40googlegroups.com.
>> 
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-developers+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/fa42e3bf-a965-4c57-885f-383a75b1c86cn%40googlegroups.com.
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/django-developers/CAPpmBN_UP1nyz-Xig_LWnVwwHJFmUJxc4N22DnYF-GXuaiLjOw%40mail.gmail.com.

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/373D10F8-6811-4884-9D51-7F01CAC82AC5%40kye.id.au.


Re: Errors

2021-08-11 Thread Umar Farooq
Sorry code screenshots

On Wed, 11 Aug 2021, 5:27 PM Rana Zain,  wrote:

> Okay I am sending screenshot.[image: erroits.PNG]
>
> On Tuesday, August 10, 2021 at 6:26:42 PM UTC+5 Adam Johnson wrote:
>
>> Hi!
>>
>> I think you've found the wrong mailing list for this post. This mailing
>> list is for discussing the development of Django itself, not for support
>> using Django. This means the discussions of bugs and features in Django
>> itself, rather than in your code using it. People on this list are unlikely
>> to answer your support query with their limited time and energy.
>>
>> For support, please follow the "Getting Help" page:
>> https://docs.djangoproject.com/en/3.2/faq/help/ . This will help you
>> find people who are willing to support you, and to ask your question in a
>> way that makes it easy for them to answer.
>>
>> Thanks for your understanding and all the best,
>>
>> Adam
>>
>> On Tue, 10 Aug 2021 at 13:05, Rana Zain  wrote:
>>
>>> I am facing this errors :
>>>
>>> > ',' or ')' expected
>>> > Unexpected indent
>>> > Statement expected, found Py:DEDENT
>>>
>>> for the last 2,3 days. Kindly help me out.
>>>
>>> --
>>>
>> You received this message because you are subscribed to the Google Groups
>>> "Django developers (Contributions to Django itself)" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an email to django-develop...@googlegroups.com.
>>> To view this discussion on the web visit
>>> https://groups.google.com/d/msgid/django-developers/89e0b61f-25c5-4438-9a7d-20ffb0de82fen%40googlegroups.com
>>> 
>>> .
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/fa42e3bf-a965-4c57-885f-383a75b1c86cn%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAPpmBN_UP1nyz-Xig_LWnVwwHJFmUJxc4N22DnYF-GXuaiLjOw%40mail.gmail.com.


Re: Errors

2021-08-11 Thread Rana Zain
Okay I am sending screenshot.[image: erroits.PNG]

On Tuesday, August 10, 2021 at 6:26:42 PM UTC+5 Adam Johnson wrote:

> Hi!
>
> I think you've found the wrong mailing list for this post. This mailing 
> list is for discussing the development of Django itself, not for support 
> using Django. This means the discussions of bugs and features in Django 
> itself, rather than in your code using it. People on this list are unlikely 
> to answer your support query with their limited time and energy.
>
> For support, please follow the "Getting Help" page: 
> https://docs.djangoproject.com/en/3.2/faq/help/ . This will help you find 
> people who are willing to support you, and to ask your question in a way 
> that makes it easy for them to answer.
>
> Thanks for your understanding and all the best,
>
> Adam
>
> On Tue, 10 Aug 2021 at 13:05, Rana Zain  wrote:
>
>> I am facing this errors :
>>
>> > ',' or ')' expected
>> > Unexpected indent
>> > Statement expected, found Py:DEDENT
>>
>> for the last 2,3 days. Kindly help me out.
>>
>> -- 
>>
> You received this message because you are subscribed to the Google Groups 
>> "Django developers (Contributions to Django itself)" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-develop...@googlegroups.com.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/89e0b61f-25c5-4438-9a7d-20ffb0de82fen%40googlegroups.com
>>  
>> 
>> .
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/fa42e3bf-a965-4c57-885f-383a75b1c86cn%40googlegroups.com.


Re: Errors

2021-08-10 Thread 'Adam Johnson' via Django developers (Contributions to Django itself)
Hi!

I think you've found the wrong mailing list for this post. This mailing
list is for discussing the development of Django itself, not for support
using Django. This means the discussions of bugs and features in Django
itself, rather than in your code using it. People on this list are unlikely
to answer your support query with their limited time and energy.

For support, please follow the "Getting Help" page:
https://docs.djangoproject.com/en/3.2/faq/help/ . This will help you find
people who are willing to support you, and to ask your question in a way
that makes it easy for them to answer.

Thanks for your understanding and all the best,

Adam

On Tue, 10 Aug 2021 at 13:05, Rana Zain  wrote:

> I am facing this errors :
>
> > ',' or ')' expected
> > Unexpected indent
> > Statement expected, found Py:DEDENT
>
> for the last 2,3 days. Kindly help me out.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/89e0b61f-25c5-4438-9a7d-20ffb0de82fen%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAMyDDM097ZTe2ZsgnOHYg%3DG%3DYjT2D9dVpbVQDnJmUFUBM-YJJQ%40mail.gmail.com.


Re: Errors

2021-08-10 Thread Umar Farooq
Can you send the screenshot

On Tue, 10 Aug 2021, 6:19 PM Rana Zain,  wrote:

> I am facing this errors :
>
> > ',' or ')' expected
> > Unexpected indent
> > Statement expected, found Py:DEDENT
>
> for the last 2,3 days. Kindly help me out.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django developers (Contributions to Django itself)" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-developers+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-developers/89e0b61f-25c5-4438-9a7d-20ffb0de82fen%40googlegroups.com
> 
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAPpmBN8pR4fnKhEBYBwv-8k2SDQ7NvYH1sc3FvOOuk0MzUTduA%40mail.gmail.com.


Re: Errors in tests

2012-04-11 Thread Anssi Kääriäinen
On Apr 11, 2:50 pm, Łukasz Rekucki  wrote:
 > As for the error, it's quite a puzzle. If update() tries to iterate
> thru value, it means it's a non-empty sequence that's not a subclass
> of dict, right? Did you manage to track what type of value it is?
> There must be a bug somewhere else too.

When you iterate through a Context instance, you are iterating through
the dictionaries in the context:
In [1]: from django.template import Context
In [2]: c = Context()
In [3]: for d in c:
   ...: print d
{}
In [4]: c.update({'fuu': 'bar'})
Out[4]: {'fuu': 'bar'}
In [5]: for d in c:
print d
{'fuu': 'bar'}
{}

There is some discussion at https://code.djangoproject.com/ticket/17229,
and the core problem is that you really should not set a context
instance as one of the context dictionaries. However this is done in
many places in our code base, and I suspect user code does this, too.

At this point it might make sense to just revert the commit and then
investigate what to do. I see two ways forward: either disallow
context instances completely, or flatten the context instance to a
Python dict and use that as the base dictionary. So, something like:
is isinstance(value, Context):
value = flatten_context_to_dict(value)
else:
value = {}
value.update(builtins)
self._dicts=[value]

The latter option seems better - it does not risk breaking user code.

 - Anssi

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Errors in tests

2012-04-11 Thread Łukasz Rekucki
On 11 April 2012 13:37, Vinay Sajip  wrote:
> The errors seem to be related to Aymeric's change in r17894. If I
> change
>
>    def _reset_dicts(self, value=None):
>        builtins = {'True': True, 'False': False, 'None': None}
>        if value:
>            builtins.update(value)
>        self.dicts = [builtins]
>
> to the seemingly equivalent
>
>    def _reset_dicts(self, value=None):
>        value = copy(value or {})
>        value.update({'True': True, 'False': False, 'None': None})
>        self.dicts = [value]
>
> then the errors no longer occur.

I think this is even more correct, as the previous function allowed
for overriding "True" to something else. Although, that might break
somebody's template :)

As for the error, it's quite a puzzle. If update() tries to iterate
thru value, it means it's a non-empty sequence that's not a subclass
of dict, right? Did you manage to track what type of value it is?
There must be a bug somewhere else too.

-- 
Łukasz Rekucki

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Errors in tests

2012-04-11 Thread Vinay Sajip
The errors seem to be related to Aymeric's change in r17894. If I
change

def _reset_dicts(self, value=None):
builtins = {'True': True, 'False': False, 'None': None}
if value:
builtins.update(value)
self.dicts = [builtins]

to the seemingly equivalent

def _reset_dicts(self, value=None):
value = copy(value or {})
value.update({'True': True, 'False': False, 'None': None})
self.dicts = [value]

then the errors no longer occur.

Ticket created: https://code.djangoproject.com/ticket/18103

Regards,

Vinay Sajip

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.



Re: Errors in django/tests/regressiontests/model_inheritance_regress/models.py

2008-06-19 Thread Pim Van Heuven
The lack of boolean type coercion is more serious than it looks like at 
first glance.
(starting from the example at http://code.djangoproject.com/ticket/7190)

In [1]: import django.newforms as forms
In [2]: from django.newforms.models import model_to_dict
In [3]: from simple.models import Simple
In [4]: simple_false = Simple.objects.create(b=False)
In [5]: simple_false_2 = Simple.objects.get(pk=simple_false.pk)

In [6]: class SimpleForm(forms.ModelForm):
   ...: b = forms.BooleanField(widget=forms.HiddenInput)
   ...: class Meta:
   ...: model = Simple
   ...:

In [7]: SimpleForm(data = model_to_dict(simple_false)).as_p()
Out[7]: u''

In [8]: SimpleForm(data = model_to_dict(simple_false_2)).as_p()
Out[8]: u''

When you POST the Out[8] form the value becomes bool("0") = True.
So when you save simple_false_2 based on the form the value is inverted 
from False
to True.
Seems like a critical error...

The mysql.patch solves this issue too.


Pim.


Michael Glassford wrote:
> Your patch works, thanks. Perhaps you could add it to 
> http://code.djangoproject.com/ticket/7190; I tried the patch there, but 
> it doesn't work in this case.
>
> Mike
>
>
> Pim Van Heuven wrote:
>   
>> Hi Michael,
>>
>> Can you apply this patch and run the tests again?
>> I have been running Django with this patch for a long time but never
>> got around to submitting it.
>>
>> Pim.
>>
>>
>>
>> Michael Glassford wrote:
>> 
>>> I'm still trying to run the Django unit tests for the first time. I've 
>>> worked through most of the errors--all of them so far proved to be 
>>> caused by the MySQL/InnoDB ordering problem when deserializing objects 
>>> that I asked about in another thread. However, I have one more set of 
>>> errors that appear to have a different cause: it appears that, at least 
>>> when fetching values using Model.objects.values(), a BooleanField isn't 
>>> converting the value 1 to True. Is this a familiar problem? Hopefully it 
>>> won't be another MySQL limitation!
>>>
>>> The errors are below:
>>>
>>>
>>>   
>>>   
 $ python runtests.py --settings=django_regression_settings 
 model_inheritance_regress
 ==
 FAIL: Doctest: 
 regressiontests.model_inheritance_regress.models.__test__.API_TESTS
 --
 Traceback (most recent call last):
   File 
 "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/test/_doctest.py",
  line 2180, in runTest
 raise self.failureException(self.format_failure(new.getvalue()))
 AssertionError: Failed doctest test for 
 regressiontests.model_inheritance_regress.models.__test__.API_TESTS
   File 
 "/develop/django/tests/regressiontests/model_inheritance_regress/models.py",
  line unknown line number, in API_TESTS

 --
 File 
 "/develop/django/tests/regressiontests/model_inheritance_regress/models.py",
  line ?, in 
 regressiontests.model_inheritance_regress.models.__test__.API_TESTS
 Failed example:
 [sorted(d.items()) for d in dicts]
 Expected:
 [[('name', u"Guido's House of Pasta"), ('serves_hot_dogs', True)]]
 Got:
 [[('name', u"Guido's House of Pasta"), ('serves_hot_dogs', 1)]]
 --
 File 
 "/develop/django/tests/regressiontests/model_inheritance_regress/models.py",
  line ?, in 
 regressiontests.model_inheritance_regress.models.__test__.API_TESTS
 Failed example:
 [sorted(d.items()) for d in dicts]
 Expected:
 [[('name', u"Guido's House of Pasta"), ('serves_gnocchi', True), 
 ('serves_hot_dogs', True)]]
 Got:
 [[('name', u"Guido's House of Pasta"), ('serves_gnocchi', 1), 
 ('serves_hot_dogs', 1)]]
 --
 File 
 "/develop/django/tests/regressiontests/model_inheritance_regress/models.py",
  line ?, in 
 regressiontests.model_inheritance_regress.models.__test__.API_TESTS
 Failed example:
 [sorted(d.items()) for d in dicts]
 Expected:
 [[('name', u"Guido's All New House of Pasta"), ('serves_hot_dogs', 
 False)]]
 Got:
 [[('name', u"Guido's All New House of Pasta"), ('serves_hot_dogs', 0)]]
 --
 File 
 "/develop/django/tests/regressiontests/model_inheritance_regress/models.py",
  line ?, in 
 regressiontests.model_inheritance_regress.models.__test__.API_TESTS
 Failed example:
 [sorted(d.items()) for d in dicts]
 Expected:
 [[('name', u"Guido's All New House of Pasta"), ('serves_gnocchi', 
 False), ('serves_hot_dogs', False)]]
 Got:
  

Re: Errors in django/tests/regressiontests/views/fixtures/testdata.json?

2008-06-19 Thread Jason Davies

On Jun 19, 3:04 pm, Steve Holden <[EMAIL PROTECTED]> wrote:

> Well I guess the obvious (time consuming, painful) way would be to
> validate the semantic integrity from Django in the back end. That could,
> if automated, get horrendously time-consuming for even quite small
> changes to the database.
>
> Would there be any way to analyze which constraints could be affected by
> the SQL executed while checks were disabled, so automated checks could
> be limited to those?

I'd be in favour of doing something like this, even if it was slow.
After all, slow is better than it not working at all!

Jason
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Errors in django/tests/regressiontests/model_inheritance_regress/models.py

2008-06-19 Thread Michael Glassford

Your patch works, thanks. Perhaps you could add it to 
http://code.djangoproject.com/ticket/7190; I tried the patch there, but 
it doesn't work in this case.

Mike


Pim Van Heuven wrote:
> Hi Michael,
> 
> Can you apply this patch and run the tests again?
> I have been running Django with this patch for a long time but never
> got around to submitting it.
> 
> Pim.
> 
> 
> 
> Michael Glassford wrote:
>> I'm still trying to run the Django unit tests for the first time. I've 
>> worked through most of the errors--all of them so far proved to be 
>> caused by the MySQL/InnoDB ordering problem when deserializing objects 
>> that I asked about in another thread. However, I have one more set of 
>> errors that appear to have a different cause: it appears that, at least 
>> when fetching values using Model.objects.values(), a BooleanField isn't 
>> converting the value 1 to True. Is this a familiar problem? Hopefully it 
>> won't be another MySQL limitation!
>>
>> The errors are below:
>>
>>
>>   
>>> $ python runtests.py --settings=django_regression_settings 
>>> model_inheritance_regress
>>> ==
>>> FAIL: Doctest: 
>>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>>> --
>>> Traceback (most recent call last):
>>>   File 
>>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/test/_doctest.py",
>>>  line 2180, in runTest
>>> raise self.failureException(self.format_failure(new.getvalue()))
>>> AssertionError: Failed doctest test for 
>>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>>>   File 
>>> "/develop/django/tests/regressiontests/model_inheritance_regress/models.py",
>>>  line unknown line number, in API_TESTS
>>>
>>> --
>>> File 
>>> "/develop/django/tests/regressiontests/model_inheritance_regress/models.py",
>>>  line ?, in 
>>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>>> Failed example:
>>> [sorted(d.items()) for d in dicts]
>>> Expected:
>>> [[('name', u"Guido's House of Pasta"), ('serves_hot_dogs', True)]]
>>> Got:
>>> [[('name', u"Guido's House of Pasta"), ('serves_hot_dogs', 1)]]
>>> --
>>> File 
>>> "/develop/django/tests/regressiontests/model_inheritance_regress/models.py",
>>>  line ?, in 
>>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>>> Failed example:
>>> [sorted(d.items()) for d in dicts]
>>> Expected:
>>> [[('name', u"Guido's House of Pasta"), ('serves_gnocchi', True), 
>>> ('serves_hot_dogs', True)]]
>>> Got:
>>> [[('name', u"Guido's House of Pasta"), ('serves_gnocchi', 1), 
>>> ('serves_hot_dogs', 1)]]
>>> --
>>> File 
>>> "/develop/django/tests/regressiontests/model_inheritance_regress/models.py",
>>>  line ?, in 
>>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>>> Failed example:
>>> [sorted(d.items()) for d in dicts]
>>> Expected:
>>> [[('name', u"Guido's All New House of Pasta"), ('serves_hot_dogs', 
>>> False)]]
>>> Got:
>>> [[('name', u"Guido's All New House of Pasta"), ('serves_hot_dogs', 0)]]
>>> --
>>> File 
>>> "/develop/django/tests/regressiontests/model_inheritance_regress/models.py",
>>>  line ?, in 
>>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>>> Failed example:
>>> [sorted(d.items()) for d in dicts]
>>> Expected:
>>> [[('name', u"Guido's All New House of Pasta"), ('serves_gnocchi', 
>>> False), ('serves_hot_dogs', False)]]
>>> Got:
>>> [[('name', u"Guido's All New House of Pasta"), ('serves_gnocchi', 0), 
>>> ('serves_hot_dogs', 0)]]
>>> --
>>> File 
>>> "/develop/django/tests/regressiontests/model_inheritance_regress/models.py",
>>>  line ?, in 
>>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>>> Failed example:
>>> [sorted(d.items()) for d in dicts]
>>> Expected:
>>> [[('name', u"Guido's All New House of Pasta"), ('serves_gnocchi', 
>>> False), ('serves_hot_dogs', False)]]
>>> Got:
>>> [[('name', u"Guido's All New House of Pasta"), ('serves_gnocchi', 0), 
>>> ('serves_hot_dogs', 0)]]
>>>
>>>
>>> --
>>> Ran 1 test in 0.057s
>>> 
>>
>>
>> Mike
>>
>>
>>
>>
>>   
> 
> 
> > 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more

Re: Errors in django/tests/regressiontests/model_inheritance_regress/models.py

2008-06-19 Thread Pim Van Heuven
Hi Michael,

Can you apply this patch and run the tests again?
I have been running Django with this patch for a long time but never
got around to submitting it.

Pim.



Michael Glassford wrote:
> I'm still trying to run the Django unit tests for the first time. I've 
> worked through most of the errors--all of them so far proved to be 
> caused by the MySQL/InnoDB ordering problem when deserializing objects 
> that I asked about in another thread. However, I have one more set of 
> errors that appear to have a different cause: it appears that, at least 
> when fetching values using Model.objects.values(), a BooleanField isn't 
> converting the value 1 to True. Is this a familiar problem? Hopefully it 
> won't be another MySQL limitation!
>
> The errors are below:
>
>
>   
>> $ python runtests.py --settings=django_regression_settings 
>> model_inheritance_regress
>> ==
>> FAIL: Doctest: 
>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>> --
>> Traceback (most recent call last):
>>   File 
>> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/django/test/_doctest.py",
>>  line 2180, in runTest
>> raise self.failureException(self.format_failure(new.getvalue()))
>> AssertionError: Failed doctest test for 
>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>>   File 
>> "/develop/django/tests/regressiontests/model_inheritance_regress/models.py", 
>> line unknown line number, in API_TESTS
>>
>> --
>> File 
>> "/develop/django/tests/regressiontests/model_inheritance_regress/models.py", 
>> line ?, in 
>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>> Failed example:
>> [sorted(d.items()) for d in dicts]
>> Expected:
>> [[('name', u"Guido's House of Pasta"), ('serves_hot_dogs', True)]]
>> Got:
>> [[('name', u"Guido's House of Pasta"), ('serves_hot_dogs', 1)]]
>> --
>> File 
>> "/develop/django/tests/regressiontests/model_inheritance_regress/models.py", 
>> line ?, in 
>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>> Failed example:
>> [sorted(d.items()) for d in dicts]
>> Expected:
>> [[('name', u"Guido's House of Pasta"), ('serves_gnocchi', True), 
>> ('serves_hot_dogs', True)]]
>> Got:
>> [[('name', u"Guido's House of Pasta"), ('serves_gnocchi', 1), 
>> ('serves_hot_dogs', 1)]]
>> --
>> File 
>> "/develop/django/tests/regressiontests/model_inheritance_regress/models.py", 
>> line ?, in 
>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>> Failed example:
>> [sorted(d.items()) for d in dicts]
>> Expected:
>> [[('name', u"Guido's All New House of Pasta"), ('serves_hot_dogs', 
>> False)]]
>> Got:
>> [[('name', u"Guido's All New House of Pasta"), ('serves_hot_dogs', 0)]]
>> --
>> File 
>> "/develop/django/tests/regressiontests/model_inheritance_regress/models.py", 
>> line ?, in 
>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>> Failed example:
>> [sorted(d.items()) for d in dicts]
>> Expected:
>> [[('name', u"Guido's All New House of Pasta"), ('serves_gnocchi', 
>> False), ('serves_hot_dogs', False)]]
>> Got:
>> [[('name', u"Guido's All New House of Pasta"), ('serves_gnocchi', 0), 
>> ('serves_hot_dogs', 0)]]
>> --
>> File 
>> "/develop/django/tests/regressiontests/model_inheritance_regress/models.py", 
>> line ?, in 
>> regressiontests.model_inheritance_regress.models.__test__.API_TESTS
>> Failed example:
>> [sorted(d.items()) for d in dicts]
>> Expected:
>> [[('name', u"Guido's All New House of Pasta"), ('serves_gnocchi', 
>> False), ('serves_hot_dogs', False)]]
>> Got:
>> [[('name', u"Guido's All New House of Pasta"), ('serves_gnocchi', 0), 
>> ('serves_hot_dogs', 0)]]
>>
>>
>> --
>> Ran 1 test in 0.057s
>> 
>
>
> Mike
>
>
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---

diff -ur -x.svn -x.mo -x'*.pyc' /home/pim/software/newforms/newforms-admin-7684/django/db/backends/mysql/base.py django/db/backends/mysql/base.py
--- /home/pim/software/newforms/newfor

Re: Errors in django/tests/regressiontests/model_inheritance_regress/models.py

2008-06-19 Thread Karen Tracey
On Thu, Jun 19, 2008 at 9:57 AM, Michael Glassford <[EMAIL PROTECTED]>
wrote:

>
> I'm still trying to run the Django unit tests for the first time. I've
> worked through most of the errors--all of them so far proved to be
> caused by the MySQL/InnoDB ordering problem when deserializing objects
> that I asked about in another thread. However, I have one more set of
> errors that appear to have a different cause: it appears that, at least
> when fetching values using Model.objects.values(), a BooleanField isn't
> converting the value 1 to True. Is this a familiar problem? Hopefully it
> won't be another MySQL limitation!
>

It is:

http://code.djangoproject.com/ticket/7190

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Errors in django/tests/regressiontests/views/fixtures/testdata.json?

2008-06-19 Thread Steve Holden

Russell Keith-Magee wrote:
> On Thu, Jun 19, 2008 at 9:04 PM, Peter Melvyn <[EMAIL PROTECTED]> wrote:
>   
>> On 6/19/08, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
>>
>> 
>>>  (2) provide a way to manually disable and re-enable integrity checks. If
>>>  someone with more MySQL-fu than me knows how to do either of these
>>>   
>> It should work:
>>
>> SET FOREIGN_KEY_CHECKS = 0;
>> 
>
> Yes - the ticket for this problem (#3615) already has a patch that
> uses this technique.
>
> However, I was under the impression that this has the effect of
> disabling, not just deferring key checks - that is, if you disable
> checks, load bad data, then re-enable checks, no errors will be
> raised. We don't want to be responsible for breaking the referential
> integrity of a database, so this isn't a viable solution.
>
> If I've misunderstood the behaviour of SET FOREIGN_KEY_CHECKS, or you
> have any other suggestions, let me know - I'd very much like to put
> this bug behind us.
>   
Well I guess the obvious (time consuming, painful) way would be to 
validate the semantic integrity from Django in the back end. That could, 
if automated, get horrendously time-consuming for even quite small 
changes to the database.

Would there be any way to analyze which constraints could be affected by 
the SQL executed while checks were disabled, so automated checks could 
be limited to those?

Otherwise I'd guess you end up saying "Tough, MySQL is currently 
broken/less capable". Maybe we could talk to Ted Leung about that?

regards
 Steve


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Errors in django/tests/regressiontests/views/fixtures/testdata.json?

2008-06-19 Thread Karen Tracey
On Thu, Jun 19, 2008 at 9:21 AM, Russell Keith-Magee <[EMAIL PROTECTED]>
wrote:

>
> On Thu, Jun 19, 2008 at 9:04 PM, Peter Melvyn <[EMAIL PROTECTED]>
> wrote:
> >
> > On 6/19/08, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
> >
> >>  (2) provide a way to manually disable and re-enable integrity checks.
> If
> >>  someone with more MySQL-fu than me knows how to do either of these
> >
> > It should work:
> >
> > SET FOREIGN_KEY_CHECKS = 0;
>
> Yes - the ticket for this problem (#3615) already has a patch that
> uses this technique.
>
> However, I was under the impression that this has the effect of
> disabling, not just deferring key checks - that is, if you disable
> checks, load bad data, then re-enable checks, no errors will be
> raised. We don't want to be responsible for breaking the referential
> integrity of a database, so this isn't a viable solution.
>
> If I've misunderstood the behaviour of SET FOREIGN_KEY_CHECKS, or you
> have any other suggestions, let me know - I'd very much like to put
> this bug behind us.
>

You are correct about how SET FOREIGN_KEY_CHECKS works, there is a note in
the doc (http://dev.mysql.com/doc/refman/5.0/en/set-option.html) that
mentions this:

Setting FOREIGN_KEY_CHECKS to 1 does not trigger a scan of the existing
table data. Therefore, rows added to the table while
FOREIGN_KEY_CHECKS=0will not be verified for consistency.
Here's a tool I found that checks for violated foreign key constraints that
may have been introduced while FOREIGN_KEY_CHECKS was set to 0:

http://forge.mysql.com/tools/tool.php?id=11

Maybe someone could take a look at that and get some ideas about beefing up
the patch for #3615 to include a foreign key check/scan after re-enabling
the checking.

Karen

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Errors in django/tests/regressiontests/views/fixtures/testdata.json?

2008-06-19 Thread Peter Melvyn

On 6/19/08, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:

>  However, I was under the impression that this has the effect of
>  disabling, not just deferring key checks - that is, if you disable
>  checks, load bad data, then re-enable checks, no errors will be
>  raised. We don't want to be responsible for breaking the referential
>  integrity of a database, so this isn't a viable solution.

Yes, you are right. Cite:

Deviation from SQL standards: Like MySQL in general, in an SQL
statement that inserts, deletes, or updates many rows, InnoDB checks
UNIQUE and FOREIGN KEY constraints row-by-row. According to the SQL
standard, the default behavior should be deferred checking. That is,
constraints are only checked after the entire SQL statement has been
processed. Until InnoDB implements deferred constraint checking, some
things will be impossible, such as deleting a record that refers to
itself via a foreign key.

Peter

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Errors in django/tests/regressiontests/views/fixtures/testdata.json?

2008-06-19 Thread Russell Keith-Magee

On Thu, Jun 19, 2008 at 9:23 PM, Michael Glassford <[EMAIL PROTECTED]> wrote:
>
> Russell Keith-Magee wrote:
>> Yes, it is. Unfortunately, the best way to fix this is for MySQL to
>> either (1) implement transaction level key integrity checks, or (2)
>> provide a way to manually disable and re-enable integrity checks. If
>> someone with more MySQL-fu than me knows how to do either of these
>> things, let me know and we can put this bug to bed.
>
> Maybe I'm missing something, but isn't the SET FOREIGN_KEY_CHECKS = 0
> used by http://code.djangoproject.com/ticket/3615, which you mentioned
> in another message in the django.user list earlier today, the same as
> #2? Or is there some problem with that statement that makes it unsuitable?

Our replies appear to have crossed in the mail - I just responded to
this exact point in a message to Peter Melvyn.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Errors in django/tests/regressiontests/views/fixtures/testdata.json?

2008-06-19 Thread Michael Glassford

Russell Keith-Magee wrote:
> On Thu, Jun 19, 2008 at 3:44 AM, Michael Glassford <[EMAIL PROTECTED]> wrote:
> 
>>> from what that says I'd guess you are using the InnoDB MySQL storage 
>>> backend,
>> Right you are. That limitation is a bit of a pain.
> 
> Yes, it is. Unfortunately, the best way to fix this is for MySQL to
> either (1) implement transaction level key integrity checks, or (2)
> provide a way to manually disable and re-enable integrity checks. If
> someone with more MySQL-fu than me knows how to do either of these
> things, let me know and we can put this bug to bed.

Maybe I'm missing something, but isn't the SET FOREIGN_KEY_CHECKS = 0 
used by http://code.djangoproject.com/ticket/3615, which you mentioned 
in another message in the django.user list earlier today, the same as 
#2? Or is there some problem with that statement that makes it unsuitable?

> There is one thing _we_ could do - drop all the constraints before
> loading a fixture, then re-create the constraints after loading the
> fixture. However, this would require a lot of work to implement. I'm
> not particularly interested in doing this work myself (it's an itch I
> just don't have), but if someone else wants to take the lead, they
> would be warmly received.
> 
> Yours,
> Russ Magee %-)
> 
> > 
> 


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Errors in django/tests/regressiontests/views/fixtures/testdata.json?

2008-06-19 Thread Russell Keith-Magee

On Thu, Jun 19, 2008 at 9:04 PM, Peter Melvyn <[EMAIL PROTECTED]> wrote:
>
> On 6/19/08, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:
>
>>  (2) provide a way to manually disable and re-enable integrity checks. If
>>  someone with more MySQL-fu than me knows how to do either of these
>
> It should work:
>
> SET FOREIGN_KEY_CHECKS = 0;

Yes - the ticket for this problem (#3615) already has a patch that
uses this technique.

However, I was under the impression that this has the effect of
disabling, not just deferring key checks - that is, if you disable
checks, load bad data, then re-enable checks, no errors will be
raised. We don't want to be responsible for breaking the referential
integrity of a database, so this isn't a viable solution.

If I've misunderstood the behaviour of SET FOREIGN_KEY_CHECKS, or you
have any other suggestions, let me know - I'd very much like to put
this bug behind us.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Errors in django/tests/regressiontests/views/fixtures/testdata.json?

2008-06-19 Thread Peter Melvyn

On 6/19/08, Russell Keith-Magee <[EMAIL PROTECTED]> wrote:

>  (2) provide a way to manually disable and re-enable integrity checks. If
>  someone with more MySQL-fu than me knows how to do either of these

It should work:

SET FOREIGN_KEY_CHECKS = 0;

... imported data ...

mysql> SET FOREIGN_KEY_CHECKS = 1;

###

Cite: This allows you to import the tables in any order if the dump
file contains tables that are not correctly ordered for foreign keys.
It also speeds up the import operation. Setting FOREIGN_KEY_CHECKS to
0 can also be useful for ignoring foreign key constraints during LOAD
DATA and ALTER TABLE operations. However, even if
FOREIGN_KEY_CHECKS=0, InnoDB does not allow the creation of a foreign
key constraint where a column references a non-matching column type.

Peter

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Errors in django/tests/regressiontests/views/fixtures/testdata.json?

2008-06-18 Thread Russell Keith-Magee

On Thu, Jun 19, 2008 at 3:44 AM, Michael Glassford <[EMAIL PROTECTED]> wrote:

>> from what that says I'd guess you are using the InnoDB MySQL storage backend,
>
> Right you are. That limitation is a bit of a pain.

Yes, it is. Unfortunately, the best way to fix this is for MySQL to
either (1) implement transaction level key integrity checks, or (2)
provide a way to manually disable and re-enable integrity checks. If
someone with more MySQL-fu than me knows how to do either of these
things, let me know and we can put this bug to bed.

There is one thing _we_ could do - drop all the constraints before
loading a fixture, then re-create the constraints after loading the
fixture. However, this would require a lot of work to implement. I'm
not particularly interested in doing this work myself (it's an itch I
just don't have), but if someone else wants to take the lead, they
would be warmly received.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Errors in django/tests/regressiontests/views/fixtures/testdata.json?

2008-06-18 Thread Michael Glassford

Ramiro Morales wrote:
> On Wed, Jun 18, 2008 at 3:51 PM, Michael Glassford <[EMAIL PROTECTED]> wrote:
>> I'm trying to run the Django unit tests for the first time using
>> runtests.py and I'm getting a lot of errors like this:

[snip]

> This could be related to the "MySQL and Fixtures" note contained
> (admittedly, a bit too deeply buried) in the Django documentation at
> 
> http://www.djangoproject.com/documentation/django-admin/#loaddata-fixture-fixture
> 
> quoting:
> 
> "
> Unfortunately, MySQL isn't capable of completely supporting all the
> features of Django fixtures. If you use MyISAM tables, MySQL doesn't
> support transactions or constraints, so you won't get a rollback if
> multiple transaction files are found, or validation of fixture data.
> If you use InnoDB tables, you won't be able to have any forward
> references in your data files - MySQL doesn't provide a mechanism to
> defer checking of row constraints until a transaction is committed.
> "
> 
> from what that says I'd guess you are using the InnoDB MySQL storage backend,

Right you are. That limitation is a bit of a pain.

Thanks for the help.

Mike


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: Errors in django/tests/regressiontests/views/fixtures/testdata.json?

2008-06-18 Thread Ramiro Morales

On Wed, Jun 18, 2008 at 3:51 PM, Michael Glassford <[EMAIL PROTECTED]> wrote:
>
> I'm trying to run the Django unit tests for the first time using
> runtests.py and I'm getting a lot of errors like this:
>
> [...]
> "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/site-packages/MySQL_python-1.2.2-py2.5-macosx-10.3-fat.egg/MySQLdb/connections.py",
> line 35, in defaulterrorhandler
>  > raise errorclass, errorvalue
>  > IntegrityError: (1452, 'Cannot add or update a child row: a foreign
> key constraint fails (`test_django_regression/views_article`, CONSTRAINT
> `author_id_refs_id_559385ef` FOREIGN KEY (`author_id`) REFERENCES
> `views_author` (`id`))')
>
>
> As far as I can see, the errors are legitimate because
> regressiontests/views/fixtures/testdata.json defines several
> views.article items before it defines the views.author item that they
> refer to. If I move
>
>  > {
>  > "pk": 1, "model": "views.author", "fields": {
>  > "name": "Boris"
>  > }
>  > },
>
> to the top of the testdata.json, instead of near the bottom where it
> currently is, the errors disappear. However, testdata.json has been
> defined this way from the time it was created, leading me to wonder why
> others haven't been having the same problem.
>
> Note that the errors I mention above don't actually occur as unit test
> failures (though they do cause other failures to occur): instead, they
> appear in the progress information while the unit tests are running.
>

This could be related to the "MySQL and Fixtures" note contained
(admittedly, a bit too deeply buried) in the Django documentation at

http://www.djangoproject.com/documentation/django-admin/#loaddata-fixture-fixture

quoting:

"
Unfortunately, MySQL isn't capable of completely supporting all the
features of Django fixtures. If you use MyISAM tables, MySQL doesn't
support transactions or constraints, so you won't get a rollback if
multiple transaction files are found, or validation of fixture data.
If you use InnoDB tables, you won't be able to have any forward
references in your data files - MySQL doesn't provide a mechanism to
defer checking of row constraints until a transaction is committed.
"

from what that says I'd guess you are using the InnoDB MySQL storage backend,

Also, see

http://www.djangoproject.com/documentation/databases/#mysql-notes

-- 
 Ramiro Morales

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~--~~~~--~~--~--~---



Re: errors vs. "advisories"

2006-06-07 Thread Michael Radziej
Hey Adrian,

Adrian Holovaty wrote:
> Michael, you have stumbled upon an idea that I've coincidentally also
> wanted to do since before Django was open-sourced! See

Very Nice ;-)

But have you checked how I'm doing this different?

- Since data that does not pass tese "advisory tests" can get into the 
database, you'll want
  to show the warnings not only at POST, but when the user initially displays 
the data by GET.

- Therefore, these "advisory functions" need to be called at a differnt time 
than validators.

I came to this solution:

- "advisory functions" aren't added by validator_list=[...], but by 
advisor_list=[...] in FormField

- "advisory functions" raise validators.ValidationError, just like validators. 
This makes it possible to use a validator as advisory function or vice versa, 
just as needed. (I suspect that they might change their side after some 
demonstration ...)

I'm not sure if my terminology is so well.

To put this actually into Django, I'll need to patch the generic views, 
FormField, FormFieldWrapper, FormWrapper, and probably else.

Can you comment if this is what you think about? I don't want to patch all 
around Django and then there's no way to get it in.

I've attached a preliminary patch to show where I'm heading. It's kind of 
working, but with some restrictions, working slightly different than I want it 
to work, and the "advisory.py" is within my project. I don't really like it. 
Just avoiding too much patching.


Michael



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~--~~~~--~~--~--~---
from django import forms
from django.core import validators

class AdvisoryFieldMixin:
def __init__(self):
self.advisors = []

def create_advisors(self):
try:
self.advisors
except AttributeError:
self.advisors=[]

def add_advisors(self, advisors):
self.create_advisors()
self.advisors.extend(advisors)
return self

def get_advisories(self, field_data, all_data):
self.create_advisors()
advisories = []
for fn in self.advisors:
try:
fn(field_data, all_data)
except validators.ValidationError, err:
advisories.extend(err.messages)
return advisories

class FormField(forms.FormField, AdvisoryFieldMixin):
def __init__(self):
AdvisoryFieldMixin.__init__(self)

--- a/django/forms/__init__.py
+++ b/django/forms/__init__.py
@@ -179,6 +179,9 @@ class FormFieldWrapper:
 else:
 return ''
 
+def advisories(self):
+return self.formfield.get_advisories(self.data, None)
+
 def get_id(self):
 return self.formfield.get_id()
 


Re: errors vs. "advisories"

2006-06-07 Thread Adrian Holovaty

On 6/7/06, Michael Radziej <[EMAIL PROTECTED]> wrote:
> Now, is there interest in having such a thing in Django? Currently, I try to 
> keep the
> patching minimal, but I don't see how I could avoid it. If this would go into 
> Django
> eventually, it could be solved cleaner and easier. For example, currently I 
> have a
> separate AdvisoryFieldMixin, and fields that have advisories use this mixin 
> as a second
> superclass (after django.forms.FormField)

Michael, you have stumbled upon an idea that I've coincidentally also
wanted to do since before Django was open-sourced! See
http://code.djangoproject.com/ticket/23 , in which I call it
"ValidationWarning" instead of "advisory," but the concept is the
same.

A patch would be very welcome...

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers
-~--~~~~--~~--~--~---