python snippet du jour

Michael Hudson michael.hudson at canonical.com
Wed Dec 16 07:56:45 GMT 2009


Martin Pool wrote:
> I hope this amuses you as much as it did me:
> 
>          """Return the .bzrdir style format present in a directory."""
>          try:
>              format_string = transport.get_bytes(".bzr/branch-format")
> -        except errors.NoSuchFile:
> +        except errors.NoSuchFile, errors.TransportNotPossible:
>              raise errors.NotBranchError(path=transport.base)
> 
>          try:
> 

That sort of thing can lead to some pretty incomprehensible behaviour,
to be sure!

Cheers,
mwh



More information about the bazaar mailing list