Download Install Tutorial Docs FAQ Tools WikiLicense Team IRC Planet Involvement Shop Book

Changeset 555

Show
Ignore:
Timestamp:
08/26/05 02:43:07
Author:
fumanchu
Message:

All raised exceptions now conform to "raise Exception([arg])" syntax (no more "raise Exception" or "raise Exception, arg". See http://mail.python.org/pipermail/python-dev/2005-August/055687.html for Guido's pronouncement, which is now part of PEP 8.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/cherrypy/_cphttptools.py

    r549 r555  
    369369                cherrypy.response.body = ["HTTP/1.1 requires a 'Host' request header."] 
    370370                finalize() 
    371                 raise cherrypy.RequestHandled 
     371                raise cherrypy.RequestHandled() 
    372372        req.base = "%s://%s" % (req.scheme, req.headerMap.get('Host', '')) 
    373373        req.browserUrl = req.base + req.path 
     
    890890            serve_file(icofile) 
    891891            finalize() 
    892             raise cherrypy.RequestHandled 
     892            raise cherrypy.RequestHandled() 
    893893        else: 
    894894            # We didn't find anything 
  • trunk/cherrypy/_cputil.py

    r531 r555  
    360360        return Builder().build(getObj(s)) 
    361361    except: 
    362         raise #cherrypy.WrongUnreprValue, repr(s
     362        raise #cherrypy.WrongUnreprValue(repr(s)
    363363 
    364364def modules(modulePath): 
     
    367367        mod = sys.modules[modulePath] 
    368368        if mod is None: 
    369             raise KeyError 
     369            raise KeyError() 
    370370    except KeyError: 
    371371        # The last [''] is important. 
  • trunk/cherrypy/config.py

    r526 r555  
    187187                msg = ("section: %s, option: %s, value: %s" % 
    188188                       (repr(section), repr(option), repr(value))) 
    189                 raise _cperror.WrongConfigValue, msg 
     189                raise _cperror.WrongConfigValue(msg) 
    190190            result[section][option] = value 
    191191    return result 
  • trunk/cherrypy/lib/cptools.py

    r521 r555  
    113113                except TypeError: 
    114114                    pass 
    115             raise cherrypy.NotFound, cherrypy.request.path 
     115            raise cherrypy.NotFound(cherrypy.request.path) 
    116116    default.exposed = True 
  • trunk/cherrypy/lib/filter/cachefilter.py

    r521 r555  
    152152                cherrypy.response.status, cherrypy.response.headers, body = obj 
    153153                cherrypy.response.body = body 
    154             raise cherrypy.RequestHandled 
     154            raise cherrypy.RequestHandled() 
    155155     
    156156    def onEndResource(self): 
  • trunk/cherrypy/lib/filter/sessionfilter/anydbadaptor.py

    r532 r555  
    6565            return self.__data[sessionKey] 
    6666        except KeyError: 
    67             raise SessionNotFoundError 
     67            raise SessionNotFoundError() 
    6868     
    6969    def saveSessionDict(self, sessionData): 
     
    7474            del self.__data[sessionKey] 
    7575        except KeyError: 
    76             raise SessionNotFoundError 
     76            raise SessionNotFoundError() 
    7777     
    7878    def _cleanUpOldSessions(self): 
  • trunk/cherrypy/lib/filter/sessionfilter/fileadaptor.py

    r541 r555  
    5454    def getSessionDict(self, sessionKey): 
    5555        if not sessionKey: 
    56             raise SessionNotFoundError 
     56            raise SessionNotFoundError() 
    5757         
    5858        storagePath = self.getSetting('storagePath') 
     
    7171            return sessionData 
    7272        else: 
    73             raise SessionNotFoundError 
     73            raise SessionNotFoundError() 
    7474     
    7575    def saveSessionDict(self, sessionData): 
  • trunk/cherrypy/lib/filter/sessionfilter/ramadaptor.py

    r532 r555  
    4848            return self.__data[sessionKey] 
    4949        except KeyError: 
    50             raise SessionNotFoundError 
     50            raise SessionNotFoundError() 
    5151     
    5252    def saveSessionDict(self, sessionData): 
     
    6161            del self.__data[sessionKey] 
    6262        except KeyError: 
    63             raise SessionNotFoundError 
     63            raise SessionNotFoundError() 
    6464     
    6565    def _cleanUpOldSessions(self): 
  • trunk/cherrypy/test/helper.py

    r546 r555  
    111111        if webtest.ServerError.on: 
    112112            self.tearDown() 
    113             raise webtest.ServerError 
     113            raise webtest.ServerError() 
    114114     
    115115    def tearDown(self): 
  • trunk/cherrypy/test/test_core.py

    r549 r555  
    154154     
    155155    def page_method(self): 
    156         raise ValueError 
     156        raise ValueError() 
    157157     
    158158    def page_yield(self): 
    159159        yield "hello" 
    160         raise ValueError 
     160        raise ValueError() 
    161161     
    162162    def page_http_1_1(self): 
     
    164164        def inner(): 
    165165            yield "hello" 
    166             raise ValueError 
     166            raise ValueError() 
    167167            yield "very oops" 
    168168        return inner() 
     
    433433        ignore.append(ValueError) 
    434434        try: 
    435             valerr = r'\n    raise ValueError\nValueError\n$' 
     435            valerr = r'\n    raise ValueError\(\)\nValueError\n$' 
    436436            self.getPage("/error/page_method") 
    437437            self.assertMatchesBody(valerr) 
  • trunk/cherrypy/test/test_gzip_filter.py

    r534 r555  
    3838        # Test for ticket #147, where yield showed no exceptions (content- 
    3939        # encoding was still gzip even though traceback wasn't zipped). 
    40         raise IndexError 
     40        raise IndexError() 
    4141        yield "Here be dragons" 
    4242    noshow.exposed = True 
  • trunk/cherrypy/test/webtest.py

    r537 r555  
    107107        if module is None: 
    108108            if not parts: 
    109                 raise ValueError, "incomplete test name: %s" % name 
     109                raise ValueError("incomplete test name: %s" % name) 
    110110            else: 
    111111                parts_copy = parts[:] 
     
    121121                        except ImportError: 
    122122                            del parts_copy[-1] 
    123                             if not parts_copy: raise 
     123                            if not parts_copy: 
     124                                raise 
    124125                parts = parts[1:] 
    125126        obj = module 
     
    138139            if not isinstance(test, TestCase) and \ 
    139140               not isinstance(test, TestSuite): 
    140                 raise ValueError, \ 
    141                       "calling %s returned %s, not a test" % (obj,test
     141                raise ValueError("calling %s returned %s, " 
     142                                 "not a test" % (obj,test)
    142143            return test 
    143144        else: 
    144             raise ValueError, "don't know how to make test from: %s" % obj 
     145            raise ValueError("don't know how to make test from: %s" % obj) 
    145146 
    146147 
     
    182183         
    183184        if ServerError.on: 
    184             raise ServerError 
     185            raise ServerError() 
    185186        return result 
    186187     
     
    190191    def _handlewebError(self, msg): 
    191192        if not self.interactive: 
    192             raise self.failureException, msg 
     193            raise self.failureException(msg) 
    193194         
    194195        print 
     
    222223                return 
    223224            elif i == "R": 
    224                 raise self.failureException, msg 
     225                raise self.failureException(msg) 
    225226            elif i == "X": 
    226227                sys.exit() 

Hosted by WebFaction

Log in as guest/cpguest to create tickets