I think I fixed it. please check.
On Nov 2, 4:29 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Are you sure this worked in 1.70 but not in 1.71?
>
> if you try
>
> x= Field('uuid',
> type=s3uuid,
> length=64,
> notnull=True,
> unique=True,
> readable=False,
> writable=False,
> default="")
> print x.type
>
> you get 'string' and not <instance SQLCustomType>.
> It is as if something is wrong in the Field constructor but I did not
> change that.
>
> Massimo
>
> On Nov 2, 3:15 pm, Fran <francisb...@googlemail.com> wrote:
>
> > We use UUIDs for database sync.
> > If we just include as a default=uuid.uuid4() then this doesn't work
> > when creating multiple records in the same transaction (as they all
> > have identical UUIDs)
>
> > We therefore created our own custom function as follows:
>
> > # Reusable UUID field (needed as part of database synchronization)
> > import uuid
> > from gluon.sql import SQLCustomType
> > s3uuid = SQLCustomType(
> > type ='string',
> > native ='string',
> > encoder = (lambda x: "'%s'" % (uuid.uuid4() if x==""
> > else x)),
> > decoder = (lambda x: x)
> > )
>
> > uuidstamp = db.Table(None, 'uuidstamp',
> > Field('uuid',
> > type=s3uuid,
> > length=64,
> > notnull=True,
> > unique=True,
> > readable=False,
> > writable=False,
> > default=""))
>
> > This was working fine up through 1.71.1.
> > Something since has broken it (I have reverted but good to get this
> > fixed before the next stable release)
>
> > Many thanks,
> > Fran.
>
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" 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
-~----------~----~----~----~------~----~------~--~---