Now I tried using only bnummer as the KeyField. The behaviour changed,
but it still doesn't work...

>>> b = self.getBizobj("tbl_matches")
>>> b.getDataSet()
>>> b.new()
>>> b.setFieldVal("bnummer", "1")
>>> b.setFieldVal("telefonval", "2")
>>> b.getDataSet()
({'project': u'reshn011', 'bnummer': u'1', 'telefonval': u'2'},)
>>> b.save()
c:\python24\lib\site-packages\dabo-0.8.3-py2.4.egg\dabo\db\dCursorMixin.
py:291: Warning: Some non-transactional changed tables couldn't be
rolled back
  res = self.superCursor.execute(self, sql)
Traceback (most recent call last):
  File "<input>", line 1, in ?
  File
"c:\python24\lib\site-packages\Dabo-0.8.3-py2.4.egg\dabo\biz\dBizobj.py"
, line 363, in save
    cursor.save()
  File
"c:\python24\lib\site-packages\Dabo-0.8.3-py2.4.egg\dabo\db\dCursorMixin
.py", line 1144, in save
    saverow(self.RowNumber)
  File
"c:\python24\lib\site-packages\Dabo-0.8.3-py2.4.egg\dabo\db\dCursorMixin
.py", line 1118, in saverow
    self.__saverow(row)
  File
"c:\python24\lib\site-packages\Dabo-0.8.3-py2.4.egg\dabo\db\dCursorMixin
.py", line 1226, in __saverow
    self.BackendObject.noResultsOnSave()
  File
"c:\python24\lib\site-packages\Dabo-0.8.3-py2.4.egg\dabo\db\dBackend.py"
, line 114, in noResultsOnSave
    raise dException.dException, _("No records updated")
dException: No records updated

>>> b.saveAll() # No message at all


When I used several primary fields, saveAll reported "Invalid row
specified" and save() reported nothing, but now it's about the
opposite...
I still have all the fields as primary in my database. Could this be the
problem?
Anyway, I still want to use several primary keys so I can get away with
only one table :) 

>From the APIDoc:
KeyField

Name of field that is the PK. If multiple fields make up the key,
separate the fields with commas. (str)



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of johnf
Sent: 10. januar 2008 08:42
To: Dabo Users list
Subject: Re: [dabo-users] Problem with BizObj save

On Wednesday 09 January 2008 11:06:55 pm Simen Haugen wrote:
> class MatchBiz(dbiz.dBizobj):
>     def beforeInit(self):
>         self.Caption = "Matches"
>         self.Encoding = "latin-1"
>         self.DataSource = "tbl_matches"
>         self.KeyField = "project,bnummer,telefonval"
>         self.AutoPopulatePK = False
>
> I bind this datasource to a grid. Calling bizobj.new() creates a new
> record. Editing in a grid reflects the values in the dataset. When
> calling save() I get no messages at all. Calling saveAll() gives me an
> exception, "Invalid row specified".
> Even if I answer No or Cancel when asking to save to data I get this
> error.
>
> isChanged() shows False, isAnyChanged() shows True.
>
>

Please try testing without the composite primary key.  If that works
then we 
can determine the best way to support your composite primary key.  Like
maybe 
using beforeSave() to set the proper values.  It might even be possible
to 
setup a routine in the bizObj.validateField to support your composite
key.  I 
have been able to play some tricks in validateField to support foreign
keys 
(FK) in my primary bizObject.

-- 
John Fabiani


[excessive quoting removed by server]

_______________________________________________
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]

Reply via email to