Unified try-except-finally only works with python-2.5
authorMarius Mauch <genone@gentoo.org>
Thu, 18 Jan 2007 20:06:50 +0000 (20:06 -0000)
committerMarius Mauch <genone@gentoo.org>
Thu, 18 Jan 2007 20:06:50 +0000 (20:06 -0000)
svn path=/main/trunk/; revision=5711

pym/portage_news.py

index d3e5ea4f73a5be392a25fac52df9031b34353ff6..26d2607c743eafa38c17b8671ba05487f0627955 100644 (file)
@@ -123,17 +123,18 @@ class NewsManager(object):
                
                unreadfile = os.path.join( self.UNREAD_PATH, "news-"+ repoid +".unread" )
                try:
-                       unread_lock = lockfile(unreadfile)
-                       # Set correct permissions on the news-repoid.unread file
-                       apply_permissions( filename=unreadfile,
-                               uid=int(self.config["PORTAGE_INST_UID"]), gid=portage_gid, mode=0664 )
-                               
-                       if os.path.exists( unreadfile ):
-                               unread = open( unreadfile ).readlines()
-                               if len(unread):
-                                       return len(unread)
-               except FileNotFound:
-                       pass # unread file may not exist
+                       try;
+                               unread_lock = lockfile(unreadfile)
+                               # Set correct permissions on the news-repoid.unread file
+                               apply_permissions( filename=unreadfile,
+                                       uid=int(self.config["PORTAGE_INST_UID"]), gid=portage_gid, mode=0664 )
+                                       
+                               if os.path.exists( unreadfile ):
+                                       unread = open( unreadfile ).readlines()
+                                       if len(unread):
+                                               return len(unread)
+                       except FileNotFound:
+                               pass # unread file may not exist
                finally:
                        if unread_lock:
                                unlockfile(unread_lock)