Hi Michael,
Thanks for the reply.
And sorry for the dumb question
Sometimes I can't see what is just in front of my nose.
Regards,
François
On Jan 13, 10:46 am, Michael Bayer <[email protected]> wrote:
> you're using methods which have been removed (which were also
> deprecated throughout 0.4). Check out the third bulletpoint here:
>
> http://www.sqlalchemy.org/trac/wiki/05Migration#SchemaTypes
>
> On Jan 12, 2009, at 10:29 PM, fw wrote:
>
> > class IntString(sa.types.TypeDecorator):
> > """A string type converted between string and integer"""
>
> > impl = sa.types.String
> > def convert_bind_param(self, value, engine):
> > """Convert from int to string"""
> > if value is None:
> > return None
> > return str(value)
> > def convert_result_value(self, value, engine):
> > """Convert from string to int"""
> > #return unicode(value,"utf8")
> > if value is None:
> > return None
> > return int(value.strip())
>
> > class PaddedIntString(IntString):
> > """A string type converted between string and integer with some
> > padding"""
>
> > def __init__(self, length=None, convert_unicode=False,padding='0'):
> > if length is None:
> > raise Exception("Use IntString instead")
>
> > self.pat="%%%s%dd"%(padding,length)
> > self.padding=padding
> > IntString.__init__(self,length,convert_unicode)
>
> > def convert_bind_param(self, value, engine):
> > """Convert from int to string"""
> > if value is None:
> > return None
> > print "Converting %d to string"%value
> > return self.pat%(value)
>
> > def convert_result_value(self, value, engine):
> > """Convert from string to int"""
> > #return unicode(value,"utf8")
> > if value is None:
> > return None
> > print "Returning %s as int"%value
> > return int(value.strip())
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---