On Sun, 2008-04-27 at 05:45 -0700, Julien wrote:
> Thanks Malcolm, I turned the queryset into a list, and it worked:
> sidebar["countries"] = [country for country in
> Country.objects.exclude(id=1).order_by('name')]
list(Country.objects.exclude(id=1).order_by('name') will be faster and
less code to write.
>
> Now, just out of curiosity, why didn't I get an error before using
> queryset refactor. I can't be sure that the caching actually happened,
> but there was no exception raised.
It's actually the Query class inside the QuerySet that is causing the
problem (partly because of the connection to the database backend, which
we have to not pickle); that contains a lot of stuff that didn't exist
before. There are also subtleties in the current implementation because
there's a lot more internal state to manage and once you unpickle a
queryset it's reasonable to expect you can still use it to further
filter the results, which means getting the internal state right on
unpickling.
Malcolm
--
Save the whales. Collect the whole set.
http://www.pointy-stick.com/blog/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---