[CalendarServer-changes] [12894] twext/trunk/twext/who/xml.py

source_changes at macosforge.org source_changes at macosforge.org
Thu Mar 13 11:59:21 PDT 2014


Revision: 12894
          http://trac.calendarserver.org//changeset/12894
Author:   wsanchez at apple.com
Date:     2014-03-13 11:59:21 -0700 (Thu, 13 Mar 2014)
Log Message:
-----------
The try/finally:close clause should follow, not preceed, open().

Modified Paths:
--------------
    twext/trunk/twext/who/xml.py

Modified: twext/trunk/twext/who/xml.py
===================================================================
--- twext/trunk/twext/who/xml.py	2014-03-13 18:21:52 UTC (rev 12893)
+++ twext/trunk/twext/who/xml.py	2014-03-13 18:59:21 UTC (rev 12894)
@@ -243,17 +243,14 @@
         #
         # Open and parse the file
         #
-        fh = None
+        fh = self.filePath.open()
         try:
-            fh = self.filePath.open()
-
             try:
                 etree = parseXML(fh)
             except XMLParseError as e:
                 raise ParseError(e)
         finally:
-            if fh is not None:
-                fh.close()
+            fh.close()
 
         #
         # Pull data from DOM
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/calendarserver-changes/attachments/20140313/97519f9e/attachment.html>


More information about the calendarserver-changes mailing list