Mercurial > p > roundup > code
comparison roundup/init.py @ 4895:c86bc9646652
Revert changes in commit 785bd25371
The use of 'with open()' was only introduced in python v2.6. To maintain
compatibility with python v2.5 the change needs to be reverted.
| author | John Kristensen <john@jerrykan.com> |
|---|---|
| date | Fri, 09 May 2014 16:54:27 +1000 |
| parents | edb171528a7d |
| children | 3b632a25b1b3 |
comparison
equal
deleted
inserted
replaced
| 4894:1484893daeff | 4895:c86bc9646652 |
|---|---|
| 136 "\tcontains old-style template - ignored" | 136 "\tcontains old-style template - ignored" |
| 137 ) % os.path.abspath(path) | 137 ) % os.path.abspath(path) |
| 138 return None | 138 return None |
| 139 | 139 |
| 140 # load up the template's information | 140 # load up the template's information |
| 141 with open(tif) as f: | 141 try: |
| 142 f = open(tif) | |
| 142 m = email.parser.Parser().parse(f, True) | 143 m = email.parser.Parser().parse(f, True) |
| 143 ti = {} | 144 ti = {} |
| 144 ti['name'] = m['name'] | 145 ti['name'] = m['name'] |
| 145 ti['description'] = m['description'] | 146 ti['description'] = m['description'] |
| 146 ti['intended-for'] = m['intended-for'] | 147 ti['intended-for'] = m['intended-for'] |
| 147 ti['path'] = path | 148 ti['path'] = path |
| 149 finally: | |
| 150 f.close() | |
| 148 return ti | 151 return ti |
| 149 | 152 |
| 150 def writeHeader(name, value): | 153 def writeHeader(name, value): |
| 151 ''' Write an rfc822-compatible header line, making it wrap reasonably | 154 ''' Write an rfc822-compatible header line, making it wrap reasonably |
| 152 ''' | 155 ''' |
