From fafa45bd22aed63d35d2c12a2eac21653b068d81 Mon Sep 17 00:00:00 2001 From: Jeff Forcier Date: Tue, 28 Feb 2012 21:42:15 -0800 Subject: [PATCH] Fix files.first to use correct files.exists sig. Fixes #499. --- docs/changelog.rst | 3 +++ fabric/contrib/files.py | 10 +++------- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/docs/changelog.rst b/docs/changelog.rst index 651bbee9f9..780a5c2a09 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -25,6 +25,9 @@ would have also been included in the 1.2 line. Changelog ========= +* :bug:`499` `contrib.files.first ` used an + outdated function signature in its wrapped `~fabric.contrib.files.exists` + call. This has been fixed. Thanks to Massimiliano Torromeo for catch & patch. * :bug:`551` :option:`--list <-l>` output now detects terminal window size and truncates (or doesn't truncate) accordingly. Thanks to Horacio G. de Oro for the initial pull request. diff --git a/fabric/contrib/files.py b/fabric/contrib/files.py index d251b4519f..ab7b0a8d00 100644 --- a/fabric/contrib/files.py +++ b/fabric/contrib/files.py @@ -38,15 +38,11 @@ def exists(path, use_sudo=False, verbose=False): def first(*args, **kwargs): """ Given one or more file paths, returns first one found, or None if none - exist. May specify ``use_sudo`` which is passed to `exists`. + exist. May specify ``use_sudo`` and ``verbose`` which are passed to `exists`. """ for directory in args: - if not kwargs.get('use_sudo'): - if exists(directory, sudo=False): - return directory - else: - if exists(directory): - return directory + if exists(directory, **kwargs): + return directory def upload_template(filename, destination, context=None, use_jinja=False,