From: Zac Medico Date: Fri, 27 Oct 2006 21:45:29 +0000 (-0000) Subject: Add backward compatibility code for cache modules that override has_key instead of... X-Git-Tag: v2.1.2~536 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=fe1afa72b10a516c48281278ccec3c3d33a5f24a;p=portage.git Add backward compatibility code for cache modules that override has_key instead of __contains__. svn path=/main/trunk/; revision=4855 --- diff --git a/pym/cache/template.py b/pym/cache/template.py index a628b1161..4ffd9b9ef 100644 --- a/pym/cache/template.py +++ b/pym/cache/template.py @@ -114,7 +114,14 @@ class database(object): raise NotImplementedError def __contains__(self, cpv): - raise NotImplementedError + """This method should always be overridden. It is provided only for + backward compatibility with modules that override has_key instead. It + will automatically raise a NotImplementedError if has_key has not been + overridden.""" + if self.has_key is database.has_key: + # prevent a possible recursive loop + raise NotImplementedError + return self.has_key(cpv) def get(self, k, x=None): try: