consider it fixed. On Sat, Jun 6, 2009 at 6:07 PM, mdipierro<mdipie...@cs.depaul.edu> wrote: > > I think this is now fixed but I have not tried. Can you please try it? > > On Jun 5, 12:49 pm, Hans Donner <hans.don...@pobox.com> wrote: >> appreciate that, still learning python so I'm looking forward what I >> can learn from your fix. >> >> On Thu, Jun 4, 2009 at 11:16 PM, mdipierro<mdipie...@cs.depaul.edu> wrote: >> >> > I know what to do. I will fix it. >> >> > On Jun 4, 3:27 pm, HansD <hans.don...@pobox.com> wrote: >> >> not yet sure how to fix this, but fields of this type results in: >> >> >> class="<gluon.sql.SQLCustomType instance at 0x0990DC10>" >> >> >> On 25 mei, 07:17, mdipierro <mdipie...@cs.depaul.edu> wrote: >> >> >> > I do not know if this is a good idea and I'd like to hear your >> >> > opinions: >> >> > I have added in trunk to define custom column types >> >> >> > Here is an example of usage: >> >> >> > import cPickle >> >> > from gluon.sql importSQLCustomType >> >> > from decimal import Decimal >> >> >> > decimal =SQLCustomType(native='NUMERIC(10,2)',decoder=(lambda x: >> >> > Decimal(str(x)))) >> >> >> > pickable =SQLCustomType(type='text',encoder=(lambda x: >> >> > "'%s'"%cPickle.dumps(x).replace("'","''")),decoder=(lambda x: >> >> > cPickle.loads(x))) >> >> >> > db.define_table('test', >> >> > SQLField('my_decimal',type=decimal), >> >> > SQLField('my_pickle',type=pickable)) >> >> >> > theSQLCustomTypeconstructor takes the following arguments: >> >> > - type indicates how web2py sqlform should treat this field >> >> > - native indicates how the database should treat this field >> >> > - encoder indicates how to represent (and escape) a value in SQL >> >> > - decoder indicates how to process the value once it is extracted from >> >> > the database >> >> >> > It seems to work well with migrations. Of course using native=.... >> >> > makes the custom table not portable across databases. >> >> >> > The implementation is not very clean but can be improved. >> >> >> > Is this a good idea? >> >> >> > Massimo >> >> > > >
--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---