Changeset 388

Show
Ignore:
Timestamp:
Mon Dec 17 07:56:12 2007
Author:
naufraghi
Message:

Use a specific exception for Owners

Files:

Legend:

Unmodified
Added
Removed
Modified
  • branches/python2.5/iu.py

    r387 r388  
    45 45 STRINGTYPE = type('')  
    46 46  
      47 class OwnerError(IOError):  
      48     def __init__(self, msg):  
      49         self.msg = msg  
      50     def __str__(self):  
      51         return "<OwnerError %s>" % self.msg  
      52  
    47 53 class Owner:  
    48 54     def __init__(self, path):  
     
    57 63             path = _os_getcwd()  
    58 64         if not pathisdir(path):  
    59               raise ValueError, "%s is not a directory" % path  
      65             raise OwnerError("%s is not a directory" % path)  
    59 65         Owner.__init__(self, path)  
    60 66     def getmod(self, nm, getsuffixes=imp.get_suffixes, loadco=marshal.loads, newmod=imp.new_module):  
     
    229 235                 # hence the protection  
    230 236                 owner = klass(path)  
    231               except Exception, e:  
    232                   print "FIXME: klass Exception %s, '%s'" % (e, path)  
      237             except OwnerError, e:  
      238                 pass  
    233 239             else:  
    234 240                 break  
  • branches/python2.5/archive.py

    r43 r388  
    368 368 class PYZOwner(iu.Owner):  
    369 369     def __init__(self, path):  
    370           self.pyz = ZlibArchive(path)  
      370         try:  
      371             self.pyz = ZlibArchive(path)  
      372         except IOError, e:  
      373             assert e.errno == 21, e.errno # [Errno 21] Is a directory  
      374             raise iu.OwnerError("'%s' is a directory")  
    371 375         iu.Owner.__init__(self, path)  
    372 376     def getmod(self, nm, newmod=imp.new_module):