Hoping someone might be able to shed some light on what is wrong with
this. I am storing a list of 5 Objects in my datastore as a pickle in
a blob field and then trying to unpickle them and loop over them in my
template.

In my model I have declared a field:
negative_pages = db.Blob

Then I write my data to the field with:
self.negative_pages = pickle.dumps(self.pages.order('score').fetch(5))

And finally I declared a property to unpickle the data for use in the
template:
def display_negative_pages(self):
        return pickle.loads(str(self.negative_pages))

In my template I am using {% for page in object.display_negative_pages
%} to loop over the objects

When I test it out using the shell everything works as I want it to
perfectly. However when I try and view the template one of two things
happens. If I try and load the pickle with pickle.loads(str
(self.negative_pages)) I get an error "Caught an exception while
rendering: '<'" from the pickle load. If I use pickle.loads
(self.negative_pages) I get an empty list returned.

So the question is what should I be looking at to resolve this? Why
would it work in the shell and not the template? Something Unicode
related?

Thanks

Adam
-- 
You received this message because you are subscribed to the Google Groups 
"app-engine-patch" 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/app-engine-patch?hl=en.


Reply via email to