Home
Reading
Searching
Subscribe
Sponsors
Statistics
Posting
Contact
Spam
Lists
Links
About
Hosting
Filtering
Features Download
Marketing
Archives
FAQ
Blog
 
Gmane
From: Oleg Broytmann <phd <at> phd.pp.ru>
Subject: Re: Compression and other Column "filters"
Newsgroups: gmane.comp.python.sqlobject
Date: Monday 16th April 2007 19:06:51 UTC (over 9 years ago)
On Mon, Apr 16, 2007 at 03:59:11PM -0300, Leandro Lucarella wrote:
> > class GzipFilter(validators.Validator):
> >    def from_python(self, value, state):
> >       return compress(value)
> > 
> >    def to_python(self, value, state):
> >       return decompress(value)
> > 
> > class MyTable(SQLObject):
> >    bob = PickleCol(validator=GzipFilter())
> 
> There you go, this is great! =)

   That's untested schematic code, of course.

> I didn't know you can add validators to a Column this way...

   SQLObject has a lot of hidden gems...

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            [email protected]
           Programmers don't die, they just GOSUB without RETURN.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
 
CD: 19ms