Re: [web2py] is bug? sqlform.factory

2013-01-21 Thread Bruno Rocha
IS it SQLITE?

Sqlite dos not implements ALTER TABLE for column properties, if you created
the model with n length and so changed it later, sqlite does not respect
this.

It is a sqlite problem.


*if another database, so can be a dal problem

On Mon, Jan 21, 2013 at 11:43 AM, www.diazluis.com
wrote:

> when implemented the following code, I notice that the system does not
> respect
> the length of the field in the database.
>
> if the user enters a name of more than one (1) character the system stores
> ..
>
> wonder: is this a bug?
>
> to the following model:
>
> auth_user_id = (auth.user and auth.user.id) or None
>
> db.define_table('table_x',
> Field('name', 'string', length=1, requires= IS_UPPER()),
> Field('auth_user', db.auth_user, default=auth_user_id,
> writable=False, Readable=False),
> )
>
> using the controller:
>
> def index ():
> form = SQLFORM.factory(
> Field('name', 'string', length=3, requires=IS_UPPER()),
> )
>
>  if form.accepts (request.vars):
>  db(db.table_x.auth_user==auth_user_id).update(name=
> request.vars.name)
>
>  return dict (form = form)
>
> --
>
>
>
>

-- 





[web2py] is bug? sqlform.factory

2013-01-21 Thread www.diazluis.com
when implemented the following code, I notice that the system does not 
respect
the length of the field in the database.

if the user enters a name of more than one (1) character the system stores 
..

wonder: is this a bug?

to the following model:

auth_user_id = (auth.user and auth.user.id) or None

db.define_table('table_x',
Field('name', 'string', length=1, requires= IS_UPPER()),
Field('auth_user', db.auth_user, default=auth_user_id, 
writable=False, Readable=False),
)

using the controller:

def index ():
form = SQLFORM.factory(
Field('name', 'string', length=3, requires=IS_UPPER()),
)

 if form.accepts (request.vars):

 db(db.table_x.auth_user==auth_user_id).update(name=request.vars.name)

 return dict (form = form)

--