Ed Leafe wrote:
> On Mar 11, 2008, at 11:24 AM, Nate Lowrie wrote:
>
>> To check, I did the following modifications:
>>
>> def _getNonUpdateFields(self):
>> return self._CurrentCursor.getNonUpdateFields()
>>
>> def _setNonUpdateFields(self, fldList=None):
>> print fldList
>> if fldList is None:
>> fldList = []
>> self._nonUpdateFields = fldList
>> print self._nonUpdateFields
>
> Add this line: print "CURSORS:", len(self.__cursors)
>
> I'll bet it's zero.
>
>> self._syncWithCursors()
>> print self._CurrentCursor.getNonUpdateFields()
>>
>> Result is:
>>
>> ["someField", "anotherField"]
>> ["someField", "anotherField"]
>> []
>>
>> So, this tells me that _syncWithCursors is not setting the
>> NonUpdateFields on current cursor properly.
>
> Or that there is no _CurrentCursor.
>
>> This behavior occurs when
>> NonUpdateFields is passed in the constructor, set in initProperties,
>> or set in afterInit. If I set it after the afterInit function has
>> run, it is fine.
>>
>> Does this clear things up? Thoughts?
>
>
> Referencing self._CurrentCursor will create a new, empty cursor
> object if there are no existing cursors. I think that that's what's
> happening here. Perhaps we need to do a sync as soon as the cursor is
> created.
Or perhaps the idiom that we use in the ui layer to smooth out wx's
idiosyncrasies:
def _setNonUpdateFields(self, val):
if self._constructed():
# do it for real...
else:
self._properties["NonUpdateFields"] = val
A different problem is that NonUpdateFields is a mutable object. So
setting self.NonUpdateFields = [blah, blah] will call the setter, but
doing self.NonUpdateFields.append(blah) will not. So if we are relying
on stuff to happen when NonUpdateFields changes, we may want to consider
making it a tuple or a set instead of a list.
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/dabo-dev/[EMAIL PROTECTED]