Why did you turn the if..else into a try..except ? On Thu, May 21, 2009 at 5:00 AM, Jorge Vargas <[email protected]> wrote: > I'm sorry I'm a git noob and I still don't know how it works... Why > can't it be more predictable like mercurial :p > > This is a tiny patch to provide a better implementation for > __getattr__ it will produce a more obvious error message. > > diff --git a/fabric/state.py b/fabric/state.py > index 270f56f..a1f3600 100644 > --- a/fabric/state.py > +++ b/fabric/state.py > @@ -58,10 +58,11 @@ class _AttributeDict(dict): > > """ > def __getattr__(self, key): > - if key in self: > + try: > return self[key] > - else: > - raise AttributeError # to conform with __getattr__ spec > + except KeyError: > + # to conform with __getattr__ spec > + raise AttributeError(key) > > def __setattr__(self, key, value): > self[key] = value > > Last thread for the day :p > > > _______________________________________________ > Fab-user mailing list > [email protected] > http://lists.nongnu.org/mailman/listinfo/fab-user >
-- Venlig hilsen / Kind regards, Christian Vest Hansen. _______________________________________________ Fab-user mailing list [email protected] http://lists.nongnu.org/mailman/listinfo/fab-user
