Skip to content

Commit

Permalink
Remove __slots__ to make it possible to inherit from Options classes.
Browse files Browse the repository at this point in the history
  • Loading branch information
cortesi committed Mar 2, 2013
1 parent 75b5c97 commit e608d10
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions libmproxy/console/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ def delete_flow(self, f):


class Options(object):
__slots__ = [
attributes = [
"anticache",
"anticomp",
"client_replay",
Expand All @@ -352,7 +352,7 @@ class Options(object):
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
for i in self.__slots__:
for i in self.attributes:
if not hasattr(self, i):
setattr(self, i, None)

Expand Down
4 changes: 2 additions & 2 deletions libmproxy/dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class DumpError(Exception): pass


class Options(object):
__slots__ = [
attributes = [
"anticache",
"anticomp",
"client_replay",
Expand All @@ -45,7 +45,7 @@ class Options(object):
def __init__(self, **kwargs):
for k, v in kwargs.items():
setattr(self, k, v)
for i in self.__slots__:
for i in self.attributes:
if not hasattr(self, i):
setattr(self, i, None)

Expand Down
1 change: 0 additions & 1 deletion test/test_dump.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,6 @@ def test_read(self):
def test_options(self):
o = dump.Options(verbosity = 2)
assert o.verbosity == 2
libpry.raises(AttributeError, dump.Options, nonexistent = 2)

def test_filter(self):
assert not "GET" in self._dummy_cycle(1, "~u foo", "", verbosity=1)
Expand Down
1 change: 0 additions & 1 deletion test/test_proxy.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,4 +146,3 @@ def test_simple(self):
d.start_slave()
d.shutdown()


0 comments on commit e608d10

Please sign in to comment.