From: Andrew Walker Date: Mon, 26 Jan 2015 18:52:04 +0000 (+0000) Subject: Fix decorator in VersionPlistCommandDependency X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=9bffbc22f007bd7c88e1a246043983fcf53a6528;p=swc-setup-installation-test.git Fix decorator in VersionPlistCommandDependency This class includes a static method that calls a static method and this fails with: $ ./swc-installation-test-2.py safari check Safari (safari)... Traceback (most recent call last): File "./swc-installation-test-2.py", line 1007, in passed = check(args) File "./swc-installation-test-2.py", line 243, in check version = checker.check() File "./swc-installation-test-2.py", line 298, in check return self._check() File "./swc-installation-test-2.py", line 340, in _check version = self._get_version() File "./swc-installation-test-2.py", line 536, in _get_version return self._get_version_from_plist(path=path) File "./swc-installation-test-2.py", line 527, in _get_version_from_plist value = self._get_next(root=tree, element=key) File "./swc-installation-test-2.py", line 511, in _get_next parent = self._get_parent(root=root, element=element) NameError: global name 'self' is not defined Change the static method _get_next (which is not passed self when called) to a class method (which is passed the class object) so that we can call the _get_parent static method (whatever the class is called). --- diff --git a/swc-installation-test-2.py b/swc-installation-test-2.py index 54e5250..053bab6 100755 --- a/swc-installation-test-2.py +++ b/swc-installation-test-2.py @@ -504,11 +504,11 @@ class VersionPlistCommandDependency (CommandDependency): return node raise ValueError((root, element)) - @staticmethod - def _get_next(root, element): + @classmethod + def _get_next(cls, root, element): """Returns the following sibling of this element or None """ - parent = self._get_parent(root=root, element=element) + parent = cls._get_parent(root=root, element=element) siblings = iter(parent) for node in siblings: if node == element: