It was never evaled but I can see roblems with length being a
string. ;-)

On Jul 28, 3:49 am, Lionel Barret <lionel.bar...@gmail.com> wrote:
> Hi Massimo, I spent the night on this and I think I got it.
>
> The problem, it is indeed the length but with a twist.
>
> In the table I showed you (see above), the length is specified as a
> string :  length="128".
> But in the Field documentation, the length is an int.
>
> I suppose the length was eval'd before and is simply assigned now.
> Having a string as length override the default value, the value is not
> None but is still incorrect.
> Hence the strange behavior.
>
> I'll continue my tests more extensively.
> I'll package and send you the app if my hypothesis is wrong.
>
> Thank you very much for you help.
> L.
>
> On Jul 28, 6:45 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > Could you email me the app (confidentially)?
>
> > On Jul 27, 12:07 pm, Lionel Barret <lionel.bar...@gmail.com> wrote:
>
> > > In fact, I can update a row but I cannot add a new one.
>
> > > On Jul 27, 7:01 pm, Lionel Barret <lionel.bar...@gmail.com> wrote:
>
> > > > Sorry to be slow but I don't get it.
>
> > > > This is what I did :
> > > > * changed the sqldb to dal
> > > > * changed the sqlfield to field
> > > > * check that the params were good (the "text" type you mention).
>
> > > > tested on this table, defined in db.py :
> > > > --
> > > > db.define_table('product_pages',
> > > >                 Field('title', 'string', length="128"),
> > > >                 Field('text', 'text'))
>
> > > > db.product_pages.title.requires = IS_NOT_EMPTY()
> > > > db.product_pages.text.requires  = IS_NOT_EMPTY()
> > > > ---
> > > > I still get the error whe trying to update the table. I use the
> > > > appadmin.
>
> > > > What's wrong ?
>
> > > > L.
>
> > > > On Jul 27, 6:32 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > P.S. you problem is 2 years old. You may also want to replace SQLField
> > > > > with Field and SQLDB with DAL for aesthetic reasons.
>
> > > > > On Jul 27, 11:31 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > > > > One of your fields has a length=None. Change it to a value or 
> > > > > > (better)
> > > > > > set the type to 'text'.
>
> > > > > > Massimo
>
> > > > > > On Jul 27, 11:26 am, Lionel Barret <lionel.bar...@gmail.com> wrote:
>
> > > > > > > Hi all,
>
> > > > > > > We are moving our app from one host to the other.
>
> > > > > > > We used v1.44 on our old host, the new one use the current 
> > > > > > > version.
>
> > > > > > > And as I test the new host, I discovered our database cannot be
> > > > > > > updated/written to anymore.
>
> > > > > > > It can be read, though as the site does work, and the admin app 
> > > > > > > does
> > > > > > > display the db content.
>
> > > > > > > I tested with our app and the admin app.
>
> > > > > > > I get the same error in both case :
>
> > > > > > > Traceback (most recent call last):
> > > > > > >   File "gluon/restricted.py", line 178, in restricted
> > > > > > >     exec ccode in environment
> > > > > > >   File 
> > > > > > > "/srv/Web/www/web2py/applications/g2009_current/controllers/
> > > > > > > appadmin.py", line 281, in <module>
> > > > > > >   File "gluon/globals.py", line 96, in <lambda>
> > > > > > >     self._caller = lambda f: f()
> > > > > > >   File 
> > > > > > > "/srv/Web/www/web2py/applications/g2009_current/controllers/
> > > > > > > appadmin.py", line 103, in insert
> > > > > > >     if form.accepts(request.vars, session):
> > > > > > >   File "gluon/sqlhtml.py", line 1029, in accepts
> > > > > > >     self.vars.id = self.table.insert(**fields)
> > > > > > >   File "gluon/sql.py", line 1933, in insert
> > > > > > >     query = self._insert(**fields)
> > > > > > >   File "gluon/sql.py", line 1913, in _insert
> > > > > > >     value = value[:field.length]
> > > > > > > TypeError: slice indices must be integers or None or have an 
> > > > > > > __index__
> > > > > > > method
>
> > > > > > > Any ideas ? Massimo ?

Reply via email to