On Tue, 2007-05-15 at 13:59 -0700, [EMAIL PROTECTED] wrote:
> Someone /has/ to be doing this. I've got a dictionary, that I want to
> pickle and store in a field in one of my Model classes. What is the
> optimal solution for this situation? All the solutions I can think of
> equate to jiggery-hacky and having to know if the field is in the
> pickled or unpickled state.

One  solution would be that the model field only stores the pickled
value. Then you have a property or method on the model that returns the
unpickled value (since properties can have getters and setters, you can
use this to store new values as well). You wouldn't have to unpickle the
value every time it's accessed, either: you could store the unpickled
value in a cache attribute on the model and invalidate or update it
every time the setter changes the field value.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to