[Twisted-Python] Twisted 1.0.4 - Possible typo in twisted.web.vhost ?

For Twisted 1.0.4, file twisted/web/vhost.py, line 100 is: ----------------------------------------------------------------------> return self.hosts.get(host, self.default or error.NoResource("host %s not in vhost map" % repr(host))) ----------------------------------------------------------------------< Could it be (?) that this line should be written: ----------------------------------------------------------------------> return self.hosts.get(host, self.default) or error.NoResource("host %s not in vhost map" % repr(host)) ----------------------------------------------------------------------< or, to keep it under 80 columns: ----------------------------------------------------------------------> return (self.hosts.get(host, self.default) or error.NoResource("host %s not in vhost map" % repr(host))) ----------------------------------------------------------------------< If we can rely on Python 2.2, we could simplify it a bit more: ----------------------------------------------------------------------> return (self.hosts.get(host, self.default) or error.NoResource("host %r not in vhost map" % host)) ----------------------------------------------------------------------< -- François Pinard http://www.iro.umontreal.ca/~pinard

pinard@iro.umontreal.ca (François Pinard) writes:
return self.hosts.get(host, self.default or error.NoResource("host %s not in vhost map" % repr(host)))
Could it be (?) that this line should be written:
return (self.hosts.get(host, self.default) or error.NoResource("host %s not in vhost map" % repr(host)))
The two are actually logically the same, but I prefer yours because it puts off the creation of the NoResource error until it is really necessary. Fixed in CVS. thanks, -Brian

pinard@iro.umontreal.ca (François Pinard) writes:
return self.hosts.get(host, self.default or error.NoResource("host %s not in vhost map" % repr(host)))
Could it be (?) that this line should be written:
return (self.hosts.get(host, self.default) or error.NoResource("host %s not in vhost map" % repr(host)))
The two are actually logically the same, but I prefer yours because it puts off the creation of the NoResource error until it is really necessary. Fixed in CVS. thanks, -Brian
participants (2)
-
Brian Warner
-
pinard@iro.umontreal.ca