Trying to get fixtures working - problem with Site

2007-03-12 Thread Chris Moffitt

I've been trying to get the fixtures working in order to beef up the unit
tests with my app.  I'm running into an issue and wonder if anyone else
has seen this.

I can serialize the data just fin.  When I try to load the data, I get the
error below.  I've tried this with the XML and brand new PyYaml serializer
and get the same error:


Installing xml fixture 'initial_data' from '/full/path/shop/fixtures'.
Problem installing fixture '/full/path/shop/fixtures/initial_data.xml':
Invalid value: 'site' should be a  instance, not a 


Has anyone else seen this?

I can not use the JSON serializer because it chokes on decimal types.  I
don't think this is a model issue - it seems to be a problem with the
serialized handling sites properly.

-Chris

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~--~~~~--~~--~--~---



Re: Trying to get fixtures working - problem with Site

2007-03-12 Thread Russell Keith-Magee

On 3/12/07, Chris Moffitt <[EMAIL PROTECTED]> wrote:
>
> Installing xml fixture 'initial_data' from '/full/path/shop/fixtures'.
> Problem installing fixture '/full/path/shop/fixtures/initial_data.xml':
> Invalid value: 'site' should be a  'django.contrib.sites.models.Site'> instance, not a 
>
> Has anyone else seen this?

Yes, and I'm in the process of fixing it right now. I'm guessing you
have a non-integer primary key in the model that you are deserializing
(a OneToOneField is the most common example). I'm adding some fixes,
and a big whopping unit test to fix this kind of problem.

> I can not use the JSON serializer because it chokes on decimal types.  I
> don't think this is a model issue - it seems to be a problem with the
> serialized handling sites properly.

Can you provide a specific example? Like I said, I'm adding a unit
test to cover all the edge cases of serialization - if you have a
specific example that is failing, I'd like to make sure that your
example is covered in the test.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~--~~~~--~~--~--~---



Re: Trying to get fixtures working - problem with Site

2007-03-12 Thread Chris Moffitt

Russell Keith-Magee wrote:
> Can you provide a specific example? Like I said, I'm adding a unit
> test to cover all the edge cases of serialization - if you have a
> specific example that is failing, I'd like to make sure that your
> example is covered in the test.
>
>   
You hit it.  It was a One to One field that was causing the problem.

Now, I'm moving on to another problem when I try to load the data.  I 
have a place where it thinks there is a Null value but I don't know 
where it is having problems.  I'd suggest that it display a little more 
info about where the problem is, instead of this somewhat vague error-

 ['This field cannot be null.']

Since I have quite a few fields, it would be helpful if it told me what 
field or atleast which model it was getting stuck on.

Thanks,
Chris

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~--~~~~--~~--~--~---



Re: Trying to get fixtures working - problem with Site

2007-03-12 Thread Russell Keith-Magee

On 3/13/07, Chris Moffitt <[EMAIL PROTECTED]> wrote:
>
> Russell Keith-Magee wrote:
> > Can you provide a specific example? Like I said, I'm adding a unit
> > test to cover all the edge cases of serialization - if you have a
> > specific example that is failing, I'd like to make sure that your
> > example is covered in the test.
> >
> >
> You hit it.  It was a One to One field that was causing the problem.
>
> Now, I'm moving on to another problem when I try to load the data.  I
> have a place where it thinks there is a Null value but I don't know
> where it is having problems.  I'd suggest that it display a little more
> info about where the problem is, instead of this somewhat vague error-
>
>  ['This field cannot be null.']
>
> Since I have quite a few fields, it would be helpful if it told me what
> field or atleast which model it was getting stuck on.

Hrm. The test case checks Null values for every data field, so that
shouldn't be a problem. The only simple reason I can think of is a
required field that doesn't have a representation in your data file.

How are you producing your data file? Is this failure caused by a data
file produced by dump, or is it manually created? Can you provide a
small fixture file (and model) that exhibits the problem?

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~--~~~~--~~--~--~---



Re: Trying to get fixtures working - problem with Site

2007-03-13 Thread Chris Moffitt


> Hrm. The test case checks Null values for every data field, so that
> shouldn't be a problem. The only simple reason I can think of is a
> required field that doesn't have a representation in your data file.
>
> How are you producing your data file? Is this failure caused by a data
> file produced by dump, or is it manually created? Can you provide a
> small fixture file (and model) that exhibits the problem?

I created my application, then did a dumpdata and am trying to load it as
part of a testing fixture.

I imagine you're right that there could be an issue with data not being
represented in the file.  The trick is figuring out where it is.  I can
try to dig into it some more later this evening and see if I can narrow it
down.  Do you have any hints on how to figure out which field or model is
causing the exception.

Thanks,
Chris

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~--~~~~--~~--~--~---



Re: Trying to get fixtures working - problem with Site

2007-03-13 Thread Russell Keith-Magee

On 3/13/07, Chris Moffitt <[EMAIL PROTECTED]> wrote:
>
> > How are you producing your data file? Is this failure caused by a data
> > file produced by dump, or is it manually created? Can you provide a
> > small fixture file (and model) that exhibits the problem?
>
> I created my application, then did a dumpdata and am trying to load it as
> part of a testing fixture.
>
> I imagine you're right that there could be an issue with data not being
> represented in the file.  The trick is figuring out where it is.  I can
> try to dig into it some more later this evening and see if I can narrow it
> down.  Do you have any hints on how to figure out which field or model is
> causing the exception.

No specific hints. The only debugging advice I can think of is the
obvious - tear the model down to the minimum, and build it back up one
field at a time until it stops working.

Yours,
Russ Magee %-)

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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-users?hl=en
-~--~~~~--~~--~--~---