dirtywords

portable text interface framework  https://pypi.python.org/pypi/dirtywords
git clone https://git.ce9e.org/dirtywords.git

commit
c3e3a42be4c3b1a37622792fade73f4b64bfc9d4
parent
331bb30ca529d40e9eac6dae25b779272627efe5
Author
Tobias Bengfort <tobias.bengfort@gmx.net>
Date
2014-10-07 19:52
Fix: TypeError on invalid attr in AttrString

Diffstat

M dirtywords/base.py 5 ++++-

1 files changed, 4 insertions, 1 deletions


diff --git a/dirtywords/base.py b/dirtywords/base.py

@@ -48,7 +48,6 @@ class AttrString(unicode):
   48    48     """
   49    49 
   50    50     def __new__(cls, s, **kwargs):
   51    -1         # TODO: there should be a TypeError on invalid kwarg
   52    51         self = super(AttrString, cls).__new__(cls, s)
   53    52         self.set_attrs(s, **kwargs)
   54    53         return self
@@ -62,6 +61,10 @@ class AttrString(unicode):
   62    61             'bg_color': (0, 0, 0),
   63    62         }
   64    63 
   -1    64         for attr in kwargs:
   -1    65             if attr not in defaults:
   -1    66                 raise TypeError('No such attribute: %s' % attr)
   -1    67 
   65    68         for attr in defaults.iterkeys():
   66    69             if attr in kwargs:
   67    70                 value = kwargs[attr]