Index: roundup/backends/blobfiles.py =================================================================== --- roundup/backends/blobfiles.py (revision 4128) +++ roundup/backends/blobfiles.py (working copy) @@ -15,7 +15,6 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -#$Id: blobfiles.py,v 1.24 2008-02-07 00:57:59 richard Exp $ '''This module exports file storage for roundup backends. Files are stored into a directory hierarchy. ''' @@ -232,6 +231,20 @@ return filename + self.tempext + def _editInProgress(self, classname, nodeid, property): + """Return true if the file indicated is being edited. + + returns -- True if the current transaction includes an edit to + the file indicated.""" + + for method, args in self.transactions: + if (method == self.doStoreFile and + args == (classname, nodeid, property)): + return True + + return False + + def filename(self, classname, nodeid, property=None, create=0): '''Determine what the filename for the given node and optionally property is. @@ -252,13 +265,10 @@ # If an edit to this file is in progress, then return the name # of the temporary file containing the edited content. - for method, args in self.transactions: - if (method == self.doStoreFile and - args == (classname, nodeid, property)): - # There is an edit in progress for this file. - if not os.path.exists(tempfile): - raise IOError('content file for %s not found'%tempfile) - return tempfile + if self._editInProgress(classname, nodeid, property): + if not os.path.exists(tempfile): + raise IOError('content file for %s not found'%tempfile) + return tempfile if os.path.exists(filename): return filename @@ -310,7 +320,7 @@ name = self._tempfile(name) # make sure we don't register the rename action more than once - if not os.path.exists(name): + if not self._editInProgress(classname, nodeid, property): # save off the rename action self.transactions.append((self.doStoreFile, (classname, nodeid, property)))