Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
5 # Taken from Paver's paver.options module.
7 class Bunch(dict):
8 """A dictionary that provides attribute-style access."""
10 def __repr__(self):
11 keys = self.keys()
12 keys.sort()
13 args = ', '.join(['%s=%r' % (key, self[key]) for key in keys])
14 return '%s(%s)' % (self.__class__.__name__, args)
16 def __getitem__(self, key):
17 item = dict.__getitem__(self, key)
18 if callable(item):
19 return item()
20 return item
22 def __getattr__(self, name):
23 try:
24 return self[name]
25 except KeyError:
26 raise AttributeError(name)
28 __setattr__ = dict.__setitem__
30 def __delattr__(self, name):
31 try:
32 del self[name]
33 except KeyError:
34 raise AttributeError(name)