Ed,
Revision 4533 has broken my app. Can you take a look as you are familiar with
the changes made? Here's the traceback I'm getting:
{{{
Traceback (most recent call last):
File "/home/pmcnett/dabo-full/trunk/dabo/ui/uiwx/dMenuItem.py", line 55, in
__onWxHit
self.raiseEvent(dEvents.Hit, evt)
File "/home/pmcnett/dabo-full/trunk/dabo/ui/uiwx/dPemMixin.py", line 923, in
raiseEvent
super(dPemMixin, self).raiseEvent(eventClass, nativeEvent, *args, **kwargs)
File "/home/pmcnett/dabo-full/trunk/dabo/lib/eventMixin.py", line 92, in
raiseEvent
bindingFunction(event)
File "/home/pmcnett/dabo-full/trunk/dabo/lib/datanav2/Form.py", line 512, in
onNew
self.pageFrame.newByDataSource(self.getBizobj().DataSource)
File "/home/pmcnett/dabo-full/trunk/dabo/lib/datanav2/PageFrame.py", line 59,
in newByDataSource
self.Form.new(ds)
File
"/home/pmcnett/py/sbs/shutter_studio/trunk/clients/shutter_studio/ui/FrmProductionOrders.py",
line 41, in new
self.newProductionOrder()
File
"/home/pmcnett/py/sbs/shutter_studio/trunk/clients/shutter_studio/ui/FrmProductionOrders.py",
line 60, in newProductionOrder
self.getBizobj("production_orders").new(dlg.Fields)
File
"/home/pmcnett/py/sbs/shutter_studio/trunk/clients/shutter_studio/biz/orders.py",
line 141, in new
self.save()
File "/home/pmcnett/dabo-full/trunk/dabo/biz/dBizobj.py", line 417, in save
raise dException.DBQueryException, e
dabo.dException.DBQueryException: column id is not unique
SQL: insert into production_orders (prod_cust_id, internal_notes,
ship_to_address1, ship_to_address2, ship_to_zip, id, material_type_id,
bill_to_name, sidemark, is_quote, ship_to_name, target_date, ship_to_state,
bill_to_city, bill_to_zip, estimated_panels, bill_to_state, status_id,
bill_to_address1, bill_to_address2, confirmation_comments,
special_instructions, cust_id, order_date, ship_to_city, cust_po_number,
order_number) values ('77bbceac-7136-4136-ba71-2152bcf52392', '', '', '', '',
'aaba515c-1052-4a7b-a514-80059d52a724', 'poly', 'Paul', 'ttt', 0, 'Paul',
'2008-10-20', '', '', '', 0, '', 10, '', '', '', '',
'681deb45-dbce-4493-b68f-317b72efe7c7', '2008-10-10', '', '', 1011)
}}}
My bizobj uses DefaultValues to call a function to get the pk. Here's that code:
{{{
3 from dabo.lib import getRandomUUID
4 import dabo.lib.datanav2 as datanav
5
6 class Base(datanav.Bizobj):
7
8 def afterInit(self):
9 self.super()
10 self.setBaseSQL()
11
12
13 def initProperties(self):
14 self.AutoQuoteNames = False
15 self.AutoPopulatePK = False
16 self.DefaultValues["id"] = getRandomUUID
17 self.SaveNewUnchanged = True
18
19
}}}
For review, here's the log and diff for 4533:
{{{
[EMAIL PROTECTED]:~/dabo$ svn log -r 4533
------------------------------------------------------------------------
r4533 | ed | 2008-09-27 06:54:48 -0700 (Sat, 27 Sep 2008) | 4 lines
Fixed the bug that failed to discern that a new record with a
manually-populated PK was in fact new. Thanks to Dr. Sibylle Koczian for
reporting this and working with me to help track it down.
Also fixed a rare bug that would only occur when the SqlManager property
referred to an object other than the cursor itself. Setting the Table property
could result in the two being out of sync.
------------------------------------------------------------------------
[EMAIL PROTECTED]:~/dabo$ svn diff -r 4532:4533
Index: dabo/db/dCursorMixin.py
===================================================================
--- dabo/db/dCursorMixin.py (revision 4532)
+++ dabo/db/dCursorMixin.py (revision 4533)
@@ -362,7 +362,6 @@
_newQuery=_newQuery)
self._records = dDataSet(_records)
-
if self.RowCount > 0:
self.RowNumber = max(0, self.RowNumber)
maxrow = max(0, (self.RowCount-1) )
@@ -733,9 +732,12 @@
cursor.genTempAutoPK()
cursor.setNewFlag()
"""
+ pk = None
if self.KeyField:
pk = self.getPK()
self._newRecords[pk] = None
+ # Add the 'new record' flag
+ self._records[self.RowNumber][kons.CURSOR_TMPKEY_FIELD] = pk
def genTempAutoPK(self):
@@ -1166,7 +1168,7 @@
def __saverow(self, row):
rec = self._records[row]
recKey = self.pkExpression(rec)
- newrec = self._newRecords.has_key(recKey)
+ newrec = kons.CURSOR_TMPKEY_FIELD in rec
newPKVal = None
if newrec and self.AutoPopulatePK:
# Some backends do not provide a means to retrieve
@@ -2352,8 +2354,8 @@
return self._table
def _setTable(self, table):
- self._table = self.AuxCursor._table = str(table)
- if not self._keyFieldSet:
+ self._table = self.AuxCursor._table = self.sqlManager._table =
"%s" % table
+ if table and not self._keyFieldSet:
# Get the PK field, if any
try:
self._keyField = [fld[0] for fld in
self.getFields(table)
}}}
Thanks!
Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]