On 3/11/08, Ed Leafe <[EMAIL PROTECTED]> wrote:
> On Mar 11, 2008, at 2:21 AM, Nate Lowrie wrote:
>
> > Ok, so I have a bizobj with some fields that I need to include in
> > NonUpdateFields.
> >
> > This applies if I set the NonUpdateFields property in:
> >   - afterInit
> >   - initProperties
> >   - constructor
> >
> > Code in question: dBizobj.py Lines 347-351
>
>        Here's what that section of code looks like (with line numbers):

Sorry, my editor was being rather funky with the line numbers and
cutting off the and part of the 8.  Actual lines are 1847-1851.

>
>  335   def save(self, startTransaction=True):
>  336           """Save any changes that have been made in the current row.
>  337
>  338           If the save is successful, the saveAll() of all child bizobjs
> will be
>  339           called as well.
>  340           """
>  341           cursor = self._CurrentCursor
>  342           errMsg = self.beforeSave()
>  343           if errMsg:
>  344                   raise dException.BusinessRuleViolation, errMsg
>  345
>  346           if self.KeyField is None:
>  347                   raise dException.MissingPKException, _("No key field 
> defined
> for table: ") + self.DataSource
>  348
>  349           # Validate any changes to the data. If there is data that fails
>  350           # validation, an Exception will be raised.
>  351           self._validate()
>  352
>  353           isTransactionManager = False
>  354           if startTransaction:
>  355                   isTransactionManager = self._getTransactionToken()
>  356                   if isTransactionManager:
>  357                           cursor.beginTransaction()
>
>
>        I don't see where NonUpdateFields comes into play here.
>
> > The variable self._nonUpdateFields is being set properly.  It contains
> > the correct information.  However, the function _syncWithCursors is
> > not passing the correct information as the
> > self._CurrentCursor.getNonUpdateFields() returns []
>
>        Setting the property (and the self._nonUpdateFields att) should be
> done *before* _syncWithCursors() is called. And _syncWithCursors()
> does not get info from the cursors; it only sets it. So could you
> explain a bit more where the problem is, and what it is that you're
> seeing?

Sorry about the confusion.  Typing when you are half asleep doesn't
really help.

I set the Property using self.NonUpdateFields = ["someField", "anotherField"].
When I do that, the method _setNonUpdateFields is called.
In that method, the variable self._nonUpdateFields is set properly (line 1844)
Then, the next line calls self._syncWithCursors().  However, the
fields are not added to the cursor.
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
                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.  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?

Nate L.


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

Reply via email to