From e608d10f455550b8afd09217f0ecf344a0bdc814 Mon Sep 17 00:00:00 2001 From: Aldo Cortesi Date: Sun, 3 Mar 2013 12:26:20 +1300 Subject: [PATCH] Remove __slots__ to make it possible to inherit from Options classes. --- libmproxy/console/__init__.py | 4 ++-- libmproxy/dump.py | 4 ++-- test/test_dump.py | 1 - test/test_proxy.py | 1 - 4 files changed, 4 insertions(+), 6 deletions(-) diff --git a/libmproxy/console/__init__.py b/libmproxy/console/__init__.py index 4e4080124..4b5d12743 100644 --- a/libmproxy/console/__init__.py +++ b/libmproxy/console/__init__.py @@ -325,7 +325,7 @@ class ConsoleState(flow.State): class Options(object): - __slots__ = [ + attributes = [ "anticache", "anticomp", "client_replay", @@ -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) diff --git a/libmproxy/dump.py b/libmproxy/dump.py index 3c7eee718..3a315409b 100644 --- a/libmproxy/dump.py +++ b/libmproxy/dump.py @@ -21,7 +21,7 @@ class DumpError(Exception): pass class Options(object): - __slots__ = [ + attributes = [ "anticache", "anticomp", "client_replay", @@ -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) diff --git a/test/test_dump.py b/test/test_dump.py index 5d3f91336..1b434f81b 100644 --- a/test/test_dump.py +++ b/test/test_dump.py @@ -101,7 +101,6 @@ class TestDumpMaster: 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) diff --git a/test/test_proxy.py b/test/test_proxy.py index 13feaeada..5828d0777 100644 --- a/test/test_proxy.py +++ b/test/test_proxy.py @@ -146,4 +146,3 @@ class TestDummyServer: d.start_slave() d.shutdown() -