/[papo]/gnue/forms/src/GFObjects/GFBlock.py
ViewVC logotype

Diff of /gnue/forms/src/GFObjects/GFBlock.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10.2.3 by apronotti, Tue Apr 15 20:55:44 2003 UTC revision 1.10.2.4 by apronotti, Fri May 9 22:23:09 2003 UTC
# Line 92  class GFBlock(GFObj, GFEventAware): Line 92  class GFBlock(GFObj, GFEventAware):
92                              'initQuery':{'function':self.initQuery},                              'initQuery':{'function':self.initQuery},
93                              'processQuery':{'function':self.processQuery},                                                          'processQuery':{'function':self.processQuery},                            
94                              'commit':{'function':self.commit},                              'commit':{'function':self.commit},
95                              'processRollback':{'function':self.processRollback},                              'reset':{'function':self.reset},
96                                'clear':{'function':self.clear},
97                                'postChanges':{'function':self.postChanges},
98                              }                              }
99    
100    def __getitem__(self, index):    def __getitem__(self, index):
# Line 101  class GFBlock(GFObj, GFEventAware): Line 103  class GFBlock(GFObj, GFEventAware):
103      if index > cnt:      if index > cnt:
104        raise IndexError        raise IndexError
105    
106      print "GFBlock", index      #print "GFBlock", index
107      self.jumpRecord(index)      self.jumpRecord(index)
108    
109      if cnt == index and self.isEmpty():      if cnt == index and self.isEmpty():
110        print "Bad, bad, bad"        #print "Bad, bad, bad"
111        raise IndexError        raise IndexError
112    
113      return self      return self
# Line 269  class GFBlock(GFObj, GFEventAware): Line 271  class GFBlock(GFObj, GFEventAware):
271      self._currentRecord = self._resultSet.getRecordNumber()      self._currentRecord = self._resultSet.getRecordNumber()
272      self.switchRecord(jump)      self.switchRecord(jump)
273    
274      def postChanges(self):
275        self.getForm().changeFocus(self)    
276        self.getForm().postChanges(self)
277    
278    def commit(self):    def commit(self):
279      self.getForm().changeFocus(self)          self.getForm().changeFocus(self)    
280      self.getForm().commit()      self.getForm().commit(self)
281    
282    def getForm(self):    def getForm(self):
283      return self._form      return self._form
# Line 299  class GFBlock(GFObj, GFEventAware): Line 305  class GFBlock(GFObj, GFEventAware):
305    
306      self.mode='normal'      self.mode='normal'
307    
308      #
309      # processPostChanges
310      #
311      def processPostChanges(self):
312        GDebug.printMesg(1, "processing post changes on block %s"%self.name,1)
313        self.mode='commit'
314    
315        self._resultSet.setRecord(self._precommitRecord)
316    
317        if not self._dataSourceLink.hasMaster():
318          self._resultSet.post({},0)
319    
320        self._recordCount = self._resultSet.getRecordCount()
321    
322        # If all our records were deleted, create an empty record
323        if not self._recordCount:
324          self.newRecord()
325        else:
326          self.jumpRecord(self._resultSet.getRecordNumber())
327    
328        self.mode='normal'
329    
330    
331    #    #
332    # processClear    # processClear
# Line 314  class GFBlock(GFObj, GFEventAware): Line 342  class GFBlock(GFObj, GFEventAware):
342      self.switchRecord(0)      self.switchRecord(0)
343    
344    
345      def reset(self):
346        self.processRollback(1)
347    
348      def clear(self):
349        self.processClear()
350    
351    #    #
352    # processRollback    # processRollback
353    #    #
# Line 327  class GFBlock(GFObj, GFEventAware): Line 361  class GFBlock(GFObj, GFEventAware):
361        self._recordCount = 0        self._recordCount = 0
362        self._dataSourceLink.createEmptyResultSet()        self._dataSourceLink.createEmptyResultSet()
363      else:      else:
364        tmpRecord = self._dataSourceLink.getCurrentResultSet().getCurrentRecord()        cachedRecord = self._dataSourceLink.getCurrentResultSet().getCachedRecords()
365        if tmpRecord.isInserted():        for tmpRecord in cachedRecord:
366          tmpFields = tmpRecord.getFields()          if tmpRecord.isInserted():
367          for key in tmpFields.keys():            tmpFields = tmpRecord.getFields()
368            tmpFields[key] = ''            for key in tmpFields.keys():
369          tmpRecord._emptyFlag = 1              tmpFields[key] = ''
370        else:              tmpRecord._emptyFlag = 1
371          tmpRecord.getFields().update(tmpRecord.getInitialData())          else:  
372        tmpRecord.setUpdateFlag(0)            tmpRecord.getFields().update(tmpRecord.getInitialData())
373                  tmpRecord.setUpdateFlag(0)
374      self._dataSourceLink._dataObject.rollback()  
375        #self._dataSourceLink._dataObject.rollback()
376      self.switchRecord(0)      self.switchRecord(0)
377    
378    

Legend:
Removed from v.1.10.2.3  
changed lines
  Added in v.1.10.2.4

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26