On Tuesday 08 January 2008 04:42:47 am Simen Haugen wrote:
> I just cannot understand why this won't work, but I don't use much
> bizobjs, so its probably my fault :)
>
> All three fields are primary keys.
Would this be one primary field and two unique fields?
>
> If I use bizobj.new() and uses a grid to edit the values, then
> saveAll(), the changed rows is [None, None, None]... And of course gives
> an error when trying to move thru the rows.
>
> Some other tests:
>
> # Try to save
>
> >>> b = self.getBizobj()
> >>> b.getDataSet()
>
> ()
>
> >>> b.new()
> >>> b.getDataSet()
>
> ({'project': u'reshn011', 'bnummer': u'', 'telefonval': u''},)
>
> >>> b.save() # Hmmm.. no error at least
Did you check the database to see if your data was saved?
> >>> b.saveAll()
save() calls saveAll() on your primary bizObject.
> Traceback (most recent call last):
> File "c:\Documents and Settings\simen\My
> Documents\Projects\resh011\trunk\src\<string>", line 1, in ?
> File
> "c:\Python24\Lib\site-packages\Dabo-0.8.3-py2.4.egg\dabo\biz\dBizobj.py"
> , line 327, in saveAll
> startTransaction=False)
> File
> "c:\Python24\Lib\site-packages\Dabo-0.8.3-py2.4.egg\dabo\biz\dBizobj.py"
> , line 715, in scanChangedRows
> self._moveToRowNum(row)
> File
> "c:\Python24\Lib\site-packages\Dabo-0.8.3-py2.4.egg\dabo\biz\dBizobj.py"
> , line 978, in _moveToRowNum
> self._CurrentCursor.moveToRowNum(rownum)
> File
> "c:\Python24\Lib\site-packages\Dabo-0.8.3-py2.4.egg\dabo\db\dCursorMixin
> .py", line 1521, in moveToRowNum
> raise dException.dException, _("Invalid row specified.")
> dException: Invalid row specified.
>
> # It seems this problem can be because I don't have SaveNewUnchanged set
> to True. This should not try to update anything at all I would have
> thought, but it tries to update with the rows [None] instead.
>
>
>
> # Try to delete
> # First we create a couple of records
>
> >>> b = self.getBizobj()
> >>> b.getDataSet()
>
> ()
>
> >>> b.new()
> >>> b.getDataSet()
>
> ({'project': u'reshn011', 'bnummer': u'', 'telefonval': u''},)
>
> >>> b.new()
> >>> b.getDataSet()
>
> ({'project': u'reshn011', 'bnummer': u'', 'telefonval': u''},
> {'project': u'reshn011', 'bnummer': u'', 'telefonval': u''})
>
Please change the data in the second set of data and tell me what happens.
> # Then we try to delete them. Deleting the first works, but the second
> fails
>
> >>> b.delete()
> >>> b.getDataSet()
>
> ({'project': u'reshn011', 'bnummer': u'', 'telefonval': u''},)
>
> >>> b.delete()
>
> Traceback (most recent call last):
> File "c:\Documents and Settings\simen\My
> Documents\Projects\resh011\trunk\src\<string>", line 1, in ?
> File
> "c:\Python24\Lib\site-packages\Dabo-0.8.3-py2.4.egg\dabo\biz\dBizobj.py"
> , line 530, in delete
> raise StandardError, e
> dException: No records deleted
>
> >>> b.first()
> >>> b.delete()
>
> Traceback (most recent call last):
> File "c:\Documents and Settings\simen\My
> Documents\Projects\resh011\trunk\src\<string>", line 1, in ?
> File
> "c:\Python24\Lib\site-packages\Dabo-0.8.3-py2.4.egg\dabo\biz\dBizobj.py"
> , line 530, in delete
> raise StandardError, e
> dException: No records deleted
What database are you using? I'm not positive but it looks like your database
maybe raising errors. I'm having no troubles of any sort with save() and
delete().
I would like to see the code for createBizobjs(). Also please provide the
code for the grid.
--
John Fabiani
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/dabo-users/[EMAIL PROTECTED]