On 12/3/10 4:08 AM, Jacek Kałucki wrote:
> Użytkownik Paul McNett napisał:
>> dabo Commit
>> Revision 6233
>> Date: 2010-12-02 16:18:51 -0800 (Thu, 02 Dec 2010)
>> Author: Paul
>> Trac: http://trac.dabodev.com/changeset/6233
>>
>> Changed:
>> U   trunk/dabo/biz/dBizobj.py
>> U   trunk/dabo/db/__init__.py
>> U   trunk/dabo/db/dCursorMixin.py
>>
>> Log:
>> Refactored CursorRecord out of dabo.db.dCursorMixin into dabo.db. Now
>> both dCursorMixin and dBizobj can use the class to instantiate their
>> own Record instances. This effectively means that assigning to
>> biz.Record.field no longer calls cur.setFieldVal() directly but
>> instead calls biz.setFieldVal(), allowing easy interference to be
>> run by appdev code.
>>
>> Added biz.afterSetFieldVal() hook method.
>>
>> Refactored biz.setFieldVal() to do away with the ret value, as dCursor
>> doesn't return anything but None anyway.
>>
>>
>>
>>
>>
>> Diff:
>> Modified: trunk/dabo/biz/dBizobj.py
>> ===================================================================
>> --- trunk/dabo/biz/dBizobj.py        2010-12-01 13:18:34 UTC (rev 6232)
>> +++ trunk/dabo/biz/dBizobj.py        2010-12-03 00:18:51 UTC (rev 6233)
>> @@ -989,6 +989,8 @@
>>              except dException.NoRecordsException:
>>                      currPK = None
>>
>> +            oldDataStructure = self.DataStructure
>> +
>>              # run the requery
>>              uiException = None
>>              cursor = self._CurrentCursor
>> @@ -1015,11 +1017,17 @@
>>                      self.requeryAllChildren()
>>              except dException.NoRecordsException:
>>                      pass
>> +
>>              self.afterRequery()
>> +
>>              if uiException:
>>                      raise uiException
>>
>> +            if self.DataStructure != oldDataStructure:
>> +                    ## The Record object must be reinstantiated to reflect 
>> the new structure:
>> +                    del(self._cursorRecord)
>>
>
> Hi,
>
> I see, you verify DataStructure changes in requery() method to reset
> _cursorRecord.
> I didn't know that it could change here, and why?

The cursor requery is precisely where the datastructure would change.

> I would rather expect that you add this check in _setDataStructure()
> and _setVirtualFields() methods.

I should probably do it in those too, thanks.


> You also could add AttributeError exception check
> around del(self._cursorRecord) code.

Good, thanks.

Want to make a commit of those things or wait for me?

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]

Reply via email to