aboutsummaryrefslogtreecommitdiff
path: root/torrc_templates
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2011-03-06 22:45:37 -0500
committerNick Mathewson <nickm@torproject.org>2011-03-06 22:45:37 -0500
commitbd1fb2b18af93270ded31238a839de244b04595d (patch)
treea35b6fa0876ea0fb6c73ae437c798aa74db3d1e5 /torrc_templates
parentafe1909d67661e14718a53d33cbc64056f49ea48 (diff)
downloadchutney-bd1fb2b18af93270ded31238a839de244b04595d.tar
chutney-bd1fb2b18af93270ded31238a839de244b04595d.tar.gz
Fix some critical bugs in our Environ class
The two big ones were: * we weren't passing the 'my' argument to our parents when looking up values: we were just saying self._parent[key] * The cache idea in Environ was broken: since computed values depend on self and 'my', we can't get away with calculating them once per Environ, since they will differ depending on the value of 'my'. This doctest example (also added) explains these bugs pretty well: >>> class Animal(Environ): ... def __init__(self, p=None, **kw): ... Environ.__init__(self, p, **kw) ... def _get_limbs(self, my): ... return my['legs'] + my['arms'] >>> a = Animal(legs=2,arms=2) >>> spider = Environ(a, legs=8,arms=0) >>> squid = Environ(a, legs=0,arms=10) >>> squid['limbs'] 10 >>> spider['limbs'] 8 If the first bug isn't fixed, both 'limbs' values say 4. If the first bug is fixed but the second is not, then both values say 10 (since the 10 gets cached.
Diffstat (limited to 'torrc_templates')
0 files changed, 0 insertions, 0 deletions