1. fanstatic
  2. fanstatic
  3. fanstatic
  4. Issues
Issue #66 resolved

String-base depends lists breaks Resource creation

Boaz Leskes
created an issue

The Resource object documentation states the following for the depends param: {{{

!python

:param depends: optionally, a list of resources that this resource
  depends on. Entries in the list can be :py:class:`Resource`
  instances, or, as a shortcut, strings that are paths to
  resources. If a string is given, a :py:class:`Resource` instance
  is constructed that has the same library as this resource.

}}}

If I interpret this correctly one can construct a resource with a string based depends list:

{{{

!python

Resource(library,"somefile",depends=["some_other_file"])

}}}

The following code raises an exception: {{{

!python

File "/Users/boaz/src/Narrowcast/eggs/fanstatic-0.11.2-py2.7.egg/fanstatic/core.py", line 327, in init depends = normalize_groups(depends) File "/Users/boaz/src/Narrowcast/eggs/fanstatic-0.11.2-py2.7.egg/fanstatic/core.py", line 464, in normalize_groups result.extend(resource.depends) AttributeError: 'str' object has no attribute 'depends' }}}

Comments (2)

  1. Jan-Jaap Driessen

    Looks like you are right: Contrary to what the documentation says, there is no test for declaring a Resource with a list of strings as dependencies. Do you have such a use case?

    I'll update the docs on the trunk.

  2. Boaz Leskes reporter

    Hi,

    I don't really have a use case on fanstatic level. Main is reason is that you are required to create resource objects and therefore may very well use them in your depends.

    I was using it as a shortcut in a utility function I'm working on (for django-fanstatic, if the group aproves) which allows you to declare you resources as a python dictionary. It came handy as it saved me some resolving. It was easy to do the resolving my self - which is how I worked around it.

    I agree that as this point, fixing the docs is what makes the most sense.

    Cheers, Boaz

  3. Log in to comment