<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def listFields(self, template):
 """List all the attributes to be rendered from the template file :param template: The template to render. The template is actually a file, which is usually generated by :class:`rtcclient.template.Templater.getTemplate` and can also be modified by user accordingly. :return: a :class:`set` contains all the needed attributes :rtype: set """


        try:
            temp_source = self.environment.loader.get_source(self.environment,
                                                             template)
            return self.listFieldsFromSource(temp_source)
        except AttributeError:
            err_msg = "Invalid value for 'template'"
            self.log.error(err_msg)
            raise exception.BadValue(err_msg)