Jason R. Coombs avatar 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.

Comments (0)

Files changed (3)

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

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(

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())
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.