comparison roundup/backends/blobfiles.py @ 2762:638fc2dab5a1 maint-0.7

fixed editing of message contents
author Richard Jones <richard@users.sourceforge.net>
date Fri, 15 Oct 2004 01:10:22 +0000
parents 4d112730e02f
children 0fe0452338ba
comparison
equal deleted inserted replaced
2759:595f8bc5829a 2762:638fc2dab5a1
13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 13 # BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS" 14 # FOR A PARTICULAR PURPOSE. THE CODE PROVIDED HEREUNDER IS ON AN "AS IS"
15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, 15 # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE,
16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. 16 # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
17 # 17 #
18 #$Id: blobfiles.py,v 1.12.2.1 2004-06-24 07:14:48 richard Exp $ 18 #$Id: blobfiles.py,v 1.12.2.2 2004-10-15 01:10:22 richard Exp $
19 '''This module exports file storage for roundup backends. 19 '''This module exports file storage for roundup backends.
20 Files are stored into a directory hierarchy. 20 Files are stored into a directory hierarchy.
21 ''' 21 '''
22 __docformat__ = 'restructuredtext' 22 __docformat__ = 'restructuredtext'
23 23
77 if not os.path.exists(os.path.dirname(name)): 77 if not os.path.exists(os.path.dirname(name)):
78 os.makedirs(os.path.dirname(name)) 78 os.makedirs(os.path.dirname(name))
79 79
80 # save to a temp file 80 # save to a temp file
81 name = name + '.tmp' 81 name = name + '.tmp'
82 # make sure we don't register the rename action more than once 82
83 if not os.path.exists(name): 83 # save off the rename action
84 # save off the rename action 84 self.transactions.append((self.doStoreFile, (classname, nodeid,
85 self.transactions.append((self.doStoreFile, (classname, nodeid, 85 property)))
86 property))) 86
87 open(name, 'wb').write(content) 87 open(name, 'wb').write(content)
88 88
89 def getfile(self, classname, nodeid, property): 89 def getfile(self, classname, nodeid, property):
90 '''Get the content of the file in the database. 90 '''Get the content of the file in the database.
91 ''' 91 '''
115 '''Store the file as part of a transaction commit. 115 '''Store the file as part of a transaction commit.
116 ''' 116 '''
117 # determine the name of the file to write to 117 # determine the name of the file to write to
118 name = self.filename(classname, nodeid, property) 118 name = self.filename(classname, nodeid, property)
119 119
120 if not os.path.exists(name+".tmp"):
121 return
122
120 # content is being updated (and some platforms, eg. win32, won't 123 # content is being updated (and some platforms, eg. win32, won't
121 # let us rename over the top of the old file) 124 # let us rename over the top of the old file)
122 if os.path.exists(name): 125 if os.path.exists(name):
123 os.remove(name) 126 os.remove(name)
124 127

Roundup Issue Tracker: http://roundup-tracker.org/