/[papo]/gnue/common/src/GDataObjects.py
ViewVC logotype

Diff of /gnue/common/src/GDataObjects.py

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

revision 1.6 by apronotti, Tue Nov 5 20:14:41 2002 UTC revision 1.6.2.1 by apronotti, Fri May 9 22:23:09 2003 UTC
# Line 35  import string Line 35  import string
35    
36  class Error(StandardError):  class Error(StandardError):
37    # Base exception    # Base exception
38    pass    value = ""
39      def __init__(self, value):
40        self.value = value
41      def __str__(self):
42        return self.value
43    
44  class LoginError(Error):  class LoginError(Error):
45    # Raised when invalid login user/pass was provided    # Raised when invalid login user/pass was provided
# Line 436  class ResultSet: Line 440  class ResultSet:
440    
441    
442    # Post changes to the database    # Post changes to the database
443    def post(self, foreign_keys={}):    def post(self, foreign_keys={},autoCommit=1):
444      # post our changes      # post our changes
445      self._update_cursor = self._dataObject._dataConnection.cursor()      self._update_cursor = self._dataObject._dataConnection.cursor()
446    
# Line 468  class ResultSet: Line 472  class ResultSet:
472          self._cachedRecords.pop(recordPosition)          self._cachedRecords.pop(recordPosition)
473          self._recordCount -= 1          self._recordCount -= 1
474    
475        record.post()        record.post(autoCommit)
476    
477      # Move to record 0 if all preceding records were deleted      # Move to record 0 if all preceding records were deleted
478      # (or set to -1 if all records were deleted)      # (or set to -1 if all records were deleted)
# Line 660  class RecordSet: Line 664  class RecordSet:
664    
665    
666    # Posts changes to database    # Posts changes to database
667    def post(self):    def post(self,autoCommit=1):
668      # Should a post() to a read only datasource cause a ReadOnlyError?      # Should a post() to a read only datasource cause a ReadOnlyError?
669      # It does no harm to attempt to post since nothing will be posted,      # It does no harm to attempt to post since nothing will be posted,
670      # But does this allow sloppy programming?      # But does this allow sloppy programming?
# Line 685  class RecordSet: Line 689  class RecordSet:
689      # start from the beginning and run the triggers again.      # start from the beginning and run the triggers again.
690      #      #
691      if status != (self._insertFlag, self._deleteFlag, self._updateFlag):      if status != (self._insertFlag, self._deleteFlag, self._updateFlag):
692        self.post()        self.post(autoCommit)
693        return        return
694    
695    
# Line 693  class RecordSet: Line 697  class RecordSet:
697        GDebug.printMesg(5,'Posting datasource %s' % self._parent._dataObject.name)        GDebug.printMesg(5,'Posting datasource %s' % self._parent._dataObject.name)
698    
699        if self.isPending():        if self.isPending():
700          self._postChanges()          self._postChanges(autoCommit)
701    
702    
703      # Post all detail records      # Post all detail records
# Line 704  class RecordSet: Line 708  class RecordSet:
708        for i in range(len(c._masterfields)):        for i in range(len(c._masterfields)):
709          fk[c._detailfields[i]] = self.getField(c._masterfields[i])          fk[c._detailfields[i]] = self.getField(c._masterfields[i])
710    
711        self._cachedDetailResultSets[child].post(foreign_keys=fk)        self._cachedDetailResultSets[child].post(foreign_keys=fk,autoCommit=autoCommit)
712    
713    
714    # Sets the ResultSet associated with this master record    # Sets the ResultSet associated with this master record
# Line 717  class RecordSet: Line 721  class RecordSet:
721    ###    ###
722    
723    # Post any changes to database    # Post any changes to database
724    def _postChanges(self):    def _postChanges(self,autoCommit=1):
725      return 1      return 1
726    
727    

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.6.2.1

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