Commits

Jason R. Coombs committed 3e9d2e8

Use 'is_valid' instead of simply 'valid' or 'check', which are less clear about the purpose of the method. Fixes AttributeError introduces in 0.9.2. Fixes #42.

  • Participants
  • Parent commits cd607e9
  • Tags 0.9.3

Comments (0)

Files changed (3)

 =======
 
 -----
+0.9.3
+-----
+
+* Issue #42: Fix new ``AttributeError`` introduced in last fix.
+
+-----
 0.9.2
 -----
 

File setuptools/package_index.py

         """
         return
 
-    def check(self):
+    def is_valid(self):
         """
         Check the hash. Return False if validation fails.
         """
     def feed(self, block):
         self.hash.update(block)
 
-    def check(self):
+    def is_valid(self):
         return self.hash.hexdigest() == self.expected
 
     def report(self, reporter, template):
         """
         checker.report(self.debug,
             "Validating %%s checksum for %s" % filename)
-        if not checker.valid():
+        if not checker.is_valid():
             tfp.close()
             os.unlink(filename)
             raise DistutilsError(

File setuptools/tests/test_packageindex.py

         checker.feed('You should probably not be using MD5'.encode('ascii'))
         self.assertEqual(checker.hash.hexdigest(),
             'f12895fdffbd45007040d2e44df98478')
-        self.assertTrue(checker.check())
+        self.assertTrue(checker.is_valid())
 
     def test_other_fragment(self):
         "Content checks should succeed silently if no hash is present"
         checker = setuptools.package_index.HashChecker.from_url(
             'http://foo/bar#something%20completely%20different')
         checker.feed('anything'.encode('ascii'))
-        self.assertTrue(checker.check())
+        self.assertTrue(checker.is_valid())
 
     def test_blank_md5(self):
         "Content checks should succeed if a hash is empty"
         checker = setuptools.package_index.HashChecker.from_url(
             'http://foo/bar#md5=')
         checker.feed('anything'.encode('ascii'))
-        self.assertTrue(checker.check())
+        self.assertTrue(checker.is_valid())