Skip to content

Commit

Permalink
Fix decorator in VersionPlistCommandDependency
Browse files Browse the repository at this point in the history
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 <module>
    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).
  • Loading branch information
Andrew Walker committed Jan 26, 2015
1 parent 1415621 commit 9bffbc2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions swc-installation-test-2.py
Original file line number Diff line number Diff line change
Expand Up @@ -504,11 +504,11 @@ def _get_parent(root, element):
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:
Expand Down

0 comments on commit 9bffbc2

Please sign in to comment.