Browse files

Issue-766 Add name attribute to tasks without one.

New-style Task subclass objects which do not define a name attribute end
up with the default = 'undefined' from Task.  When the tasks
are extracted from a loaded fabfile, should be set to the name
of the instance variable, since is used internally by fabric in
some circumstances, e.g. when `execute()` is called.  This commit sets
` = name` for task objects without a name, or with an undefined
  • Loading branch information...
1 parent b602fe6 commit ae42d4d37f5068aae68e1ab4a48be8ba43c494f3 Todd DeLuca committed with bitprophet Nov 1, 2012
Showing with 2 additions and 0 deletions.
  1. +1 −0 fabric/
  2. +1 −0 tests/
@@ -214,6 +214,7 @@ def extract_tasks(imported_vars):
if and != 'undefined':
new_style_tasks[] = obj
+ = name
new_style_tasks[name] = obj
# Handle aliasing
if obj.aliases is not None:
@@ -455,6 +455,7 @@ def test_class_based_tasks_are_found_with_variable_name(self):
docs, funcs = load_fabfile(module)
eq_(len(funcs), 1)
ok_('foo' in funcs)
+ eq_(funcs['foo'].name, 'foo')
def test_recursion_steps_into_nontask_modules(self):

0 comments on commit ae42d4d

Please sign in to comment.