Re: [web2py] Re: issue with field name id

2011-06-06 Thread Richard Vézina
GONE!

Thanks Massimo!

I appreciate.

Richard

On Mon, Jun 6, 2011 at 5:16 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> Try again please. If this is fix, please close the thread. If not,
> let'a take this private and report when fixed.
>
> On Jun 6, 4:10 pm, Richard Vézina  wrote:
> > We progress...
> >
> > Traceback (most recent call last):
> >   File "/trunk/web2py/gluon/restricted.py", line 184, in restricted
> > exec ccode in environment
> >   File "/trunk/web2py/applications/sgddms/controllers/test.py", line
> > 1334, in 
> >   File "/trunk/web2py/gluon/globals.py", line 137, in 
> > self._caller = lambda f: f()
> >   File "/trunk/web2py/gluon/tools.py", line 2444, in f
> > return action(*a, **b)
> >   File "/trunk/web2py/applications/sgddms/controllers/test.py", line
> > 173, in read
> > request.args[1])
> >   File "/trunk/web2py/gluon/tools.py", line 3134, in read
> > formstyle=self.settings.formstyle
> >   File "/trunk/web2py/gluon/sqlhtml.py", line 793, in __init__
> > inp = field.represent(default)
> >   File "/trunk/web2py/gluon/dal.py", line 3634, in list_ref_repr
> > return (refs and ', '.join(str(f(r,ref._id)) for ref in refs) or '')
> >   File "/trunk/web2py/gluon/dal.py", line 3634, in 
> > return (refs and ', '.join(str(f(r,ref._id)) for ref in refs) or '')
> >   File "/trunk/web2py/gluon/dal.py", line 3691, in __getattr__
> > return self[key]
> >   File "/trunk/web2py/gluon/dal.py", line 3682, in __getitem__
> > return dict.__getitem__(self, key)
> > KeyError: '_id'
> >
> > Now it submit... But my read function not working...
> >
> > I found this after send the issue... My select function also not
> > functionning...
> >
> > It seems all to be related...
> >
> > Richard
> >
> > On Mon, Jun 6, 2011 at 5:00 PM, Massimo Di Pierro <
> >
> >
> >
> >
> >
> >
> >
> > massimo.dipie...@gmail.com> wrote:
> > > can you please try once more...
> >
> > > P.S. I keep answering posts by my messages do not show up. :-(
> >
> > > On Jun 6, 3:43 pm, Richard Vézina  wrote:
> > > > Traceback (most recent call last):
> > > >   File "/trunk/web2py/gluon/restricted.py", line 184, in restricted
> > > > exec ccode in environment
> > > >   File "/trunk/web2py/applications/sgddms/controllers/test.py", line
> > > 1334,
> > > > in 
> > > >   File "/trunk/web2py/gluon/globals.py", line 137, in 
> > > > self._caller = lambda f: f()
> > > >   File "/trunk/web2py/gluon/tools.py", line 2444, in f
> > > > return action(*a, **b)
> > > >   File "/trunk/web2py/applications/sgddms/controllers/test.py", line
> 461,
> > > in
> > > > update
> > > > if form.accepts(request.vars, session):
> > > >   File "/trunk/web2py/gluon/sqlhtml.py", line 1203, in accepts
> > > > self.table._db(self.table._id == self.record.id
> ).update(**fields)
> > > >   File "/trunk/web2py/gluon/dal.py", line 5369, in update
> > > > fields = self.db[tablename]._listify(update_fields,update=True)
> > > >   File "/trunk/web2py/gluon/dal.py", line 4656, in _listify
> > > > raise SyntaxError, 'Field %s does not belong to the table' % name
> > > > SyntaxError: Field id does not belong to the table
> >
> > > > 1198.
> > > > 1199.
> > > > 1200.
> > > > 1201.
> > > > 1202.
> > > > 1203.
> >
> > > > 1204.
> > > > 1205.
> > > > 1206.
> > > > 1207.
> >
> > > > ret = False
> > > > else:
> > > > if record_id:
> > > > self.vars.id = self.record.id
> > > > if fields:
> > > > self.table._db(self.table._id ==
> > > > self.record.id).update(**fields)
> >
> > > > else:
> > > > self.vars.id = self.table.insert(**fields)
> > > > return ret
> >
> > > > Is what you need?
> >
> > > > Richard
> >
> > > > On Mon, Jun 6, 2011 at 4:34 PM, Massimo Di Pierro <
> >
> > > > massimo.dipie...@gmail.com> wrote:
> > > > > please re-send me the traceback sine that line in sqlhtml is not
> > > > > there.
> >
> > > > > On Jun 6, 3:04 pm, Richard Vézina 
> wrote:
> > > > > > Still there : Version 1.96.3 (2011-06-06 14:35:14)
> >
> > > > > > Richard
> >
> > > > > > On Mon, Jun 6, 2011 at 3:49 PM, Richard Vézina
> > > > > > wrote:
> >
> > > > > > > It does the problem on update... My create form work well,
> deletion
> > > > > also
> > > > > > > works.
> >
> > > > > > > Richard
> >
> > > > > > > On Mon, Jun 6, 2011 at 3:29 PM, Richard Vézina <
> > > > > > > ml.richard.vez...@gmail.com> wrote:
> >
> > > > > > >> Nop! Still there...
> >
> > > > > > >> Maybe I have wrong build :
> > > > > > >> Version 1.96.3 (2011-06-06 13:58:28)
> >
> > > > > > >> Richard
> >
> > > > > > >> On Mon, Jun 6, 2011 at 3:04 PM, Massimo Di Pierro <
> > > > > > >> massimo.dipie...@gmail.com> wrote:
> >
> > > > > > >>> I think I fixed this in trunk. Can you please check it?
> >
> > > > > > >>> On Jun 6, 1:03 pm, Richard Vézina <
> ml.richard.vez...@gmail.com>
> > > > > wrote:
> > > > 

Re: [web2py] Re: issue with field name id

2011-06-06 Thread Richard Vézina
Traceback (most recent call last):
  File "/trunk/web2py/gluon/restricted.py", line 184, in restricted
exec ccode in environment
  File "/trunk/web2py/applications/sgddms/controllers/test.py", line 1334,
in 
  File "/trunk/web2py/gluon/globals.py", line 137, in 
self._caller = lambda f: f()
  File "/trunk/web2py/gluon/tools.py", line 2444, in f
return action(*a, **b)
  File "/trunk/web2py/applications/sgddms/controllers/test.py", line 461, in
update
if form.accepts(request.vars, session):
  File "/trunk/web2py/gluon/sqlhtml.py", line 1203, in accepts
self.table._db(self.table._id == self.record.id).update(**fields)
  File "/trunk/web2py/gluon/dal.py", line 5369, in update
fields = self.db[tablename]._listify(update_fields,update=True)
  File "/trunk/web2py/gluon/dal.py", line 4656, in _listify
raise SyntaxError, 'Field %s does not belong to the table' % name
SyntaxError: Field id does not belong to the table


1198.
1199.
1200.
1201.
1202.
1203.

1204.
1205.
1206.
1207.

ret = False
else:
if record_id:
self.vars.id = self.record.id
if fields:
self.table._db(self.table._id ==
self.record.id).update(**fields)

else:
self.vars.id = self.table.insert(**fields)
return ret


Is what you need?

Richard

On Mon, Jun 6, 2011 at 4:34 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> please re-send me the traceback sine that line in sqlhtml is not
> there.
>
> On Jun 6, 3:04 pm, Richard Vézina  wrote:
> > Still there : Version 1.96.3 (2011-06-06 14:35:14)
> >
> > Richard
> >
> > On Mon, Jun 6, 2011 at 3:49 PM, Richard Vézina
> > wrote:
> >
> >
> >
> >
> >
> >
> >
> > > It does the problem on update... My create form work well, deletion
> also
> > > works.
> >
> > > Richard
> >
> > > On Mon, Jun 6, 2011 at 3:29 PM, Richard Vézina <
> > > ml.richard.vez...@gmail.com> wrote:
> >
> > >> Nop! Still there...
> >
> > >> Maybe I have wrong build :
> > >> Version 1.96.3 (2011-06-06 13:58:28)
> >
> > >> Richard
> >
> > >> On Mon, Jun 6, 2011 at 3:04 PM, Massimo Di Pierro <
> > >> massimo.dipie...@gmail.com> wrote:
> >
> > >>> I think I fixed this in trunk. Can you please check it?
> >
> > >>> On Jun 6, 1:03 pm, Richard Vézina 
> wrote:
> > >>> > Hello,
> >
> > >>> > I just try my app with the 1.96.3 and I got a strange error :
> >
> > >>> > Traceback (most recent call last):
> > >>> >   File "/version_196-3/web2py/gluon/restricted.py", line 184, in
> > >>> restricted
> > >>> > exec ccode in environment
> > >>> >   File
> "/version_196-3/web2py/applications/sgddms/controllers/test.py",
> > >>> line
> > >>> > 1334, in 
> > >>> >   File "/version_196-3/web2py/gluon/globals.py", line 137, in
> 
> > >>> > self._caller = lambda f: f()
> > >>> >   File "/version_196-3/web2py/gluon/tools.py", line 2452, in f
> > >>> > return action(*a, **b)
> > >>> >   File
> "/version_196-3/web2py/applications/sgddms/controllers/test.py",
> > >>> line
> > >>> > 654, in verify
> > >>> > if form.accepts(request.vars, session):
> > >>> >   File "/version_196-3/web2py/gluon/sqlhtml.py", line 1203, in
> accepts
> > >>> > self.table._db(self.table.id == self.record.id
> ).update(**fields)
> > >>> >   File "/version_196-3/web2py/gluon/dal.py", line 5369, in update
> > >>> > fields = self.db[tablename]._listify(update_fields,update=True)
> > >>> >   File "/version_196-3/web2py/gluon/dal.py", line 4656, in _listify
> > >>> > raise SyntaxError, 'Field %s does not belong to the table' %
> name
> > >>> > SyntaxError: Field id does not belong to the table
> >
> > >>> >   def _listify(self,fields,update=False):
> > >>> > new_fields = []
> > >>> > new_fields_names = []
> > >>> > for name in fields:
> > >>> > if not name in self.fields:
> > >>> > raise SyntaxError, 'Field %s does not belong to the
> > >>> > table' % name
> >
> > >>> > new_fields.append((self[name],fields[name]))
> > >>> > new_fields_names.append(name)
> > >>> > for ofield in self:
> > >>> > if not ofield.name in new_fields_names:
> >
> > >>> > *I use a old app and a feature for Postgres that Massimo added in
> the
> > >>> > pass that never been documented and i don't think it was official
> :*
> >
> > >>> > *
> > >>> > *
> >
> > >>> > *MODEL :*
> >
> > >>> > *Field('table_id','id'), # My legacy database used the same name as
> PK
> > >>> > and FK so I had to define them in the model like this*
> >
> > >>> > *sequence_name='test_activity_activity_id_seq' # Postgres has it on
> > >>> > automation rule to create the sequence name base on the PK name and
> > >>> > because I where using legacy database PK name I had also to define
> the
> > >>> > sequence name in my model...*
> >
> > >>> > *
> > >>> > *
> >
> > >>> > *Not sure if there is a link.*
> >
> > >>> > *
> > >>> > *
> >
> > >>>

Re: [web2py] Re: issue with field name id

2011-06-06 Thread Richard Vézina
Still there : Version 1.96.3 (2011-06-06 14:35:14)

Richard

On Mon, Jun 6, 2011 at 3:49 PM, Richard Vézina
wrote:

> It does the problem on update... My create form work well, deletion also
> works.
>
> Richard
>
>
> On Mon, Jun 6, 2011 at 3:29 PM, Richard Vézina <
> ml.richard.vez...@gmail.com> wrote:
>
>> Nop! Still there...
>>
>> Maybe I have wrong build :
>> Version 1.96.3 (2011-06-06 13:58:28)
>>
>> Richard
>>
>>
>> On Mon, Jun 6, 2011 at 3:04 PM, Massimo Di Pierro <
>> massimo.dipie...@gmail.com> wrote:
>>
>>> I think I fixed this in trunk. Can you please check it?
>>>
>>> On Jun 6, 1:03 pm, Richard Vézina  wrote:
>>> > Hello,
>>> >
>>> > I just try my app with the 1.96.3 and I got a strange error :
>>> >
>>> > Traceback (most recent call last):
>>> >   File "/version_196-3/web2py/gluon/restricted.py", line 184, in
>>> restricted
>>> > exec ccode in environment
>>> >   File "/version_196-3/web2py/applications/sgddms/controllers/test.py",
>>> line
>>> > 1334, in 
>>> >   File "/version_196-3/web2py/gluon/globals.py", line 137, in 
>>> > self._caller = lambda f: f()
>>> >   File "/version_196-3/web2py/gluon/tools.py", line 2452, in f
>>> > return action(*a, **b)
>>> >   File "/version_196-3/web2py/applications/sgddms/controllers/test.py",
>>> line
>>> > 654, in verify
>>> > if form.accepts(request.vars, session):
>>> >   File "/version_196-3/web2py/gluon/sqlhtml.py", line 1203, in accepts
>>> > self.table._db(self.table.id == self.record.id).update(**fields)
>>> >   File "/version_196-3/web2py/gluon/dal.py", line 5369, in update
>>> > fields = self.db[tablename]._listify(update_fields,update=True)
>>> >   File "/version_196-3/web2py/gluon/dal.py", line 4656, in _listify
>>> > raise SyntaxError, 'Field %s does not belong to the table' % name
>>> > SyntaxError: Field id does not belong to the table
>>> >
>>> >   def _listify(self,fields,update=False):
>>> > new_fields = []
>>> > new_fields_names = []
>>> > for name in fields:
>>> > if not name in self.fields:
>>> > raise SyntaxError, 'Field %s does not belong to the
>>> > table' % name
>>> >
>>> > new_fields.append((self[name],fields[name]))
>>> > new_fields_names.append(name)
>>> > for ofield in self:
>>> > if not ofield.name in new_fields_names:
>>> >
>>> > *I use a old app and a feature for Postgres that Massimo added in the
>>> > pass that never been documented and i don't think it was official :*
>>> >
>>> > *
>>> > *
>>> >
>>> > *MODEL :*
>>> >
>>> > *Field('table_id','id'), # My legacy database used the same name as PK
>>> > and FK so I had to define them in the model like this*
>>> >
>>> > *sequence_name='test_activity_activity_id_seq' # Postgres has it on
>>> > automation rule to create the sequence name base on the PK name and
>>> > because I where using legacy database PK name I had also to define the
>>> > sequence name in my model...*
>>> >
>>> > *
>>> > *
>>> >
>>> > *Not sure if there is a link.*
>>> >
>>> > *
>>> > *
>>> >
>>> > *Thanks*
>>> >
>>> > *
>>> > *
>>> >
>>> > *Richard*
>>> >
>>> > *
>>> > *
>>> >
>>> > *
>>> > *
>>
>>
>>
>


Re: [web2py] Re: issue with field name id

2011-06-06 Thread Richard Vézina
It does the problem on update... My create form work well, deletion also
works.

Richard

On Mon, Jun 6, 2011 at 3:29 PM, Richard Vézina
wrote:

> Nop! Still there...
>
> Maybe I have wrong build :
> Version 1.96.3 (2011-06-06 13:58:28)
>
> Richard
>
>
> On Mon, Jun 6, 2011 at 3:04 PM, Massimo Di Pierro <
> massimo.dipie...@gmail.com> wrote:
>
>> I think I fixed this in trunk. Can you please check it?
>>
>> On Jun 6, 1:03 pm, Richard Vézina  wrote:
>> > Hello,
>> >
>> > I just try my app with the 1.96.3 and I got a strange error :
>> >
>> > Traceback (most recent call last):
>> >   File "/version_196-3/web2py/gluon/restricted.py", line 184, in
>> restricted
>> > exec ccode in environment
>> >   File "/version_196-3/web2py/applications/sgddms/controllers/test.py",
>> line
>> > 1334, in 
>> >   File "/version_196-3/web2py/gluon/globals.py", line 137, in 
>> > self._caller = lambda f: f()
>> >   File "/version_196-3/web2py/gluon/tools.py", line 2452, in f
>> > return action(*a, **b)
>> >   File "/version_196-3/web2py/applications/sgddms/controllers/test.py",
>> line
>> > 654, in verify
>> > if form.accepts(request.vars, session):
>> >   File "/version_196-3/web2py/gluon/sqlhtml.py", line 1203, in accepts
>> > self.table._db(self.table.id == self.record.id).update(**fields)
>> >   File "/version_196-3/web2py/gluon/dal.py", line 5369, in update
>> > fields = self.db[tablename]._listify(update_fields,update=True)
>> >   File "/version_196-3/web2py/gluon/dal.py", line 4656, in _listify
>> > raise SyntaxError, 'Field %s does not belong to the table' % name
>> > SyntaxError: Field id does not belong to the table
>> >
>> >   def _listify(self,fields,update=False):
>> > new_fields = []
>> > new_fields_names = []
>> > for name in fields:
>> > if not name in self.fields:
>> > raise SyntaxError, 'Field %s does not belong to the
>> > table' % name
>> >
>> > new_fields.append((self[name],fields[name]))
>> > new_fields_names.append(name)
>> > for ofield in self:
>> > if not ofield.name in new_fields_names:
>> >
>> > *I use a old app and a feature for Postgres that Massimo added in the
>> > pass that never been documented and i don't think it was official :*
>> >
>> > *
>> > *
>> >
>> > *MODEL :*
>> >
>> > *Field('table_id','id'), # My legacy database used the same name as PK
>> > and FK so I had to define them in the model like this*
>> >
>> > *sequence_name='test_activity_activity_id_seq' # Postgres has it on
>> > automation rule to create the sequence name base on the PK name and
>> > because I where using legacy database PK name I had also to define the
>> > sequence name in my model...*
>> >
>> > *
>> > *
>> >
>> > *Not sure if there is a link.*
>> >
>> > *
>> > *
>> >
>> > *Thanks*
>> >
>> > *
>> > *
>> >
>> > *Richard*
>> >
>> > *
>> > *
>> >
>> > *
>> > *
>
>
>


Re: [web2py] Re: issue with field name id

2011-06-06 Thread Richard Vézina
Nop! Still there...

Maybe I have wrong build :
Version 1.96.3 (2011-06-06 13:58:28)

Richard

On Mon, Jun 6, 2011 at 3:04 PM, Massimo Di Pierro <
massimo.dipie...@gmail.com> wrote:

> I think I fixed this in trunk. Can you please check it?
>
> On Jun 6, 1:03 pm, Richard Vézina  wrote:
> > Hello,
> >
> > I just try my app with the 1.96.3 and I got a strange error :
> >
> > Traceback (most recent call last):
> >   File "/version_196-3/web2py/gluon/restricted.py", line 184, in
> restricted
> > exec ccode in environment
> >   File "/version_196-3/web2py/applications/sgddms/controllers/test.py",
> line
> > 1334, in 
> >   File "/version_196-3/web2py/gluon/globals.py", line 137, in 
> > self._caller = lambda f: f()
> >   File "/version_196-3/web2py/gluon/tools.py", line 2452, in f
> > return action(*a, **b)
> >   File "/version_196-3/web2py/applications/sgddms/controllers/test.py",
> line
> > 654, in verify
> > if form.accepts(request.vars, session):
> >   File "/version_196-3/web2py/gluon/sqlhtml.py", line 1203, in accepts
> > self.table._db(self.table.id == self.record.id).update(**fields)
> >   File "/version_196-3/web2py/gluon/dal.py", line 5369, in update
> > fields = self.db[tablename]._listify(update_fields,update=True)
> >   File "/version_196-3/web2py/gluon/dal.py", line 4656, in _listify
> > raise SyntaxError, 'Field %s does not belong to the table' % name
> > SyntaxError: Field id does not belong to the table
> >
> >   def _listify(self,fields,update=False):
> > new_fields = []
> > new_fields_names = []
> > for name in fields:
> > if not name in self.fields:
> > raise SyntaxError, 'Field %s does not belong to the
> > table' % name
> >
> > new_fields.append((self[name],fields[name]))
> > new_fields_names.append(name)
> > for ofield in self:
> > if not ofield.name in new_fields_names:
> >
> > *I use a old app and a feature for Postgres that Massimo added in the
> > pass that never been documented and i don't think it was official :*
> >
> > *
> > *
> >
> > *MODEL :*
> >
> > *Field('table_id','id'), # My legacy database used the same name as PK
> > and FK so I had to define them in the model like this*
> >
> > *sequence_name='test_activity_activity_id_seq' # Postgres has it on
> > automation rule to create the sequence name base on the PK name and
> > because I where using legacy database PK name I had also to define the
> > sequence name in my model...*
> >
> > *
> > *
> >
> > *Not sure if there is a link.*
> >
> > *
> > *
> >
> > *Thanks*
> >
> > *
> > *
> >
> > *Richard*
> >
> > *
> > *
> >
> > *
> > *