summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris McDonough <chrism@plope.com>2012-01-14 11:42:49 -0800
committerChris McDonough <chrism@plope.com>2012-01-14 11:42:49 -0800
commitabb4e18f4026d90557d95dccd79303514b7c05db (patch)
tree6b0145eaa6cccb14ab73a24d1283579b78fcce9d
parent26484029f9d4d591e9541547f6d5e381ce3a0be2 (diff)
parent9eda1b90ecef88d7c079e24445cedd1a04e597f0 (diff)
downloadpyramid-abb4e18f4026d90557d95dccd79303514b7c05db.tar.gz
pyramid-abb4e18f4026d90557d95dccd79303514b7c05db.tar.bz2
pyramid-abb4e18f4026d90557d95dccd79303514b7c05db.zip
Merge pull request #401 from tseaver/master
Close the file we are reading, not the string read from it.
-rw-r--r--pyramid/fixers/fix_bfg_imports.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/pyramid/fixers/fix_bfg_imports.py b/pyramid/fixers/fix_bfg_imports.py
index d9a4a6dfb..0046aad30 100644
--- a/pyramid/fixers/fix_bfg_imports.py
+++ b/pyramid/fixers/fix_bfg_imports.py
@@ -190,7 +190,9 @@ def fix_zcml(path):
for file in files:
if file.endswith('.zcml'):
absfile = os.path.join(root, file)
- text = open(absfile, 'rb').read()
+ f = open(absfile, 'rb')
+ text = f.read()
+ f.close()
newt = NS.sub('xmlns="http://pylonshq.com/pyramid"', text)
newt = INCLUDE_ATTR.sub('pyramid_zcml', newt)
newt = ATTR.sub(replace, newt)
@@ -199,7 +201,6 @@ def fix_zcml(path):
newf.write(newt)
newf.flush()
newf.close()
- text.close()
for dir in dirs:
if dir.startswith('.'):