Use a simpler approach instead of implementing NewsItem.__getattr__().
authorZac Medico <zmedico@gentoo.org>
Wed, 12 Nov 2008 21:58:44 +0000 (21:58 -0000)
committerZac Medico <zmedico@gentoo.org>
Wed, 12 Nov 2008 21:58:44 +0000 (21:58 -0000)
svn path=/main/trunk/; revision=11867

pym/portage/news.py

index d590ae46da587caacce80640b01a8795aeaad5ec..6c0712d3a0a66744a1b63a2bd5d9f66bbfbac72a 100644 (file)
@@ -188,6 +188,9 @@ class NewsItem(object):
                or raise a ValueError exception if the required object is not present.
                """
 
+               if not self._parsed:
+                       self.parse()
+
                if not len(self.restrictions):
                        return True # no restrictions to match means everyone should see it
                
@@ -237,11 +240,6 @@ class NewsItem(object):
 
                self._parsed = True
 
-       def __getattr__(self, attr):
-               if not self._parsed:
-                       self.parse()
-               return self.__dict__[attr]
-
 class DisplayRestriction(object):
        """
        A base restriction object representing a restriction of display.