No problem... As you say since I change the model definition by hand and it's coming from the database... it is not a web2py issue.
Thank to taking care. Richard On Tue, Jul 5, 2011 at 11:31 AM, Massimo Di Pierro < [email protected]> wrote: > I do not think this is a web2py issue. You are defining a table > manually and the database is doing padding of the fields. It is not > web2py's doing, it is the database. You can make custom web2py > validators that remove the spaces in forms when data is extracted but > it is not always obvious you want to remove straining spaces when data > comes from database. > > On Jul 5, 9:20 am, Richard Vézina <[email protected]> wrote: > > Ok, I found the problem... It does not seems to come from web2py... > > > > It happens with Postgres as backend when the not using web2py to create > the > > database schema. > > > > Look at this example : > > > > Web2py model : > > > > db.define_table('table1', > > Field('field1','string',length=25), > > Field('field2','string',length=50)) > > > > Give this Postgres table : > > > > CREATE TABLE table1 > > ( > > id serial NOT NULL, > > field1 character varying(25), > > field2 character varying(50), > > CONSTRAINT table1_pkey PRIMARY KEY (id) > > ) > > WITH ( > > OIDS=FALSE > > ); > > ALTER TABLE table1 OWNER TO richard; > > > > If you define this table like I did like this : > > > > -- Table: table1 > > > > -- DROP TABLE table1; > > > > CREATE TABLE table1 > > ( > > id serial NOT NULL, > > field1 character(25), > > field2 character(50), > > CONSTRAINT table1_pkey PRIMARY KEY (id) > > ) > > WITH ( > > OIDS=FALSE > > ); > > ALTER TABLE table1 OWNER TO richard; > > > > You will get trailling space to occure in web2py form... > > > > I attach little app. > > > > So it not exactly a web2py issue. But maybe it could be wise to prevent > this > > to happen... > > > > Richard > > > > On Tue, Jul 5, 2011 at 2:30 AM, Massimo Di Pierro < > > > > > > > > > > > > > > > > [email protected]> wrote: > > > Please provide an example. > > > > > Massimo > > > > > On Jul 4, 2:55 pm, Richard Vézina <[email protected]> wrote: > > > > Hello, > > > > > > Is Web2py suppose to follow SQL standard on trailling space for > string > > > type > > > > field on crud.update?? > > > > > > If I update a record containing field with string type, I got > trailling > > > > space "restored" from the database in my field form... On submit it > cause > > > > problem since I transform to int() for validation purpose... > > > > > > Why is crud.update restore trailing space? > > > > > > Does it liked to be like that or it is just a mistake or something > > > > > > Could it breaks anything to change this behavior? > > > > > > Richard > > > > > > > > web2py.app.trainling_space.w2p > > 167KViewDownload

