comparison configuration/configuration.py @ 110:b9fdae6a536a

make python 2.4 compatible :(
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 10 May 2012 15:23:11 -0700
parents 09642528be02
children cbd0f0aea3e5
comparison
equal deleted inserted replaced
109:09642528be02 110:b9fdae6a536a
63 f = file(filename, 'w') 63 f = file(filename, 'w')
64 newfile = True 64 newfile = True
65 else: 65 else:
66 f = filename 66 f = filename
67 newfile = False 67 newfile = False
68 exception = None
68 try: 69 try:
69 self._write(f, config) 70 self._write(f, config)
70 finally: 71 except Exception, exception:
71 # XXX try: finally: works in python >= 2.5 72 pass
72 if newfile: 73 if newfile:
73 f.close() 74 f.close()
75 if exception:
76 raise exception
74 def _write(self, fp, config): 77 def _write(self, fp, config):
75 raise NotImplementedError("Abstract base class") 78 raise NotImplementedError("Abstract base class")
76 79
77 if json: 80 if json:
78 class JSON(ConfigurationProvider): 81 class JSON(ConfigurationProvider):