Skip to content

Commit

Permalink
Fix files.first to use correct files.exists sig.
Browse files Browse the repository at this point in the history
Fixes fabric#499.
  • Loading branch information
bitprophet committed Feb 29, 2012
1 parent 4c35743 commit fafa45b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
3 changes: 3 additions & 0 deletions docs/changelog.rst
Expand Up @@ -25,6 +25,9 @@ would have also been included in the 1.2 line.
Changelog
=========

* :bug:`499` `contrib.files.first <fabric.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.
Expand Down
10 changes: 3 additions & 7 deletions fabric/contrib/files.py
Expand Up @@ -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,
Expand Down

0 comments on commit fafa45b

Please sign in to comment.