Re: Getting lists/dictionaries out of the database

2008-10-18 Thread Eric Abrahamsen
On Oct 18, 2008, at 7:48 PM, Ned Batchelder wrote: > One advantage of the Python literal over pickles: in a pinch, you > can use ad-hoc SQL queries to find stuff in Python literals, ugly as > it is. With pickles, the data is completely opaque until > unpickled. I'm not saying you'd use WH

Re: Getting lists/dictionaries out of the database

2008-10-18 Thread Ned Batchelder
One advantage of the Python literal over pickles: in a pinch, you can use ad-hoc SQL queries to find stuff in Python literals, ugly as it is. With pickles, the data is completely opaque until unpickled. I'm not saying you'd use WHERE python_literal LIKE '%image_type%' in production code, but

Re: Getting lists/dictionaries out of the database

2008-10-17 Thread Eric Abrahamsen
On Oct 18, 2008, at 4:38 AM, timc3 wrote: > > Thanks for the help. Yeah, my terminology is quite often wrong, to > much context switching with other things. > > Unfortunately I am never sure what will go in to that field, just data > that's sourced from various types of media, and populated from

Re: Getting lists/dictionaries out of the database

2008-10-17 Thread Ned Batchelder
If you are going to use eval, and the data comes from somewhere else, you should try safe_eval (http://code.activestate.com/recipes/364469/) as a way to get the convenience of unpacking Python literals, but without the danger of full evaluation. If a malicious user could get data into that fi

Re: Getting lists/dictionaries out of the database

2008-10-17 Thread timc3
Thanks for the help. Yeah, my terminology is quite often wrong, to much context switching with other things. Unfortunately I am never sure what will go in to that field, just data that's sourced from various types of media, and populated from another system. I do know that it will almost always p

Re: Getting lists/dictionaries out of the database

2008-10-17 Thread Steve Holden
timc3 wrote: > I am having a problem with getting lists/dictionaries out of the > database. > > If I have for instance this in a field of my database: > > [['Image format', 'JPEG'], ['Image mode', 'RGB'], ['Image size', > '1440x900'], ['Compression', '21.0 times']] > This is a single field? That's