def make_description(self, tasks=None): """ Returns the description of this project, in the context of the settings given. """ self.setup_config() if tasks is None: tasks = self.bind_tasks() out = StringIO() title = self.title or self.name title = '%s (%s)' % (title, self.project_name) print >> out, underline(title) doc = self.__doc__ if doc == Project.__doc__: doc = '[No project description set]' print >> out, dedent(doc) print >> out print >> out, indent(underline('Settings', '='), ' ') ns = self.create_namespace() if not self.settings: print >> out, indent('No settings', ' ') else: for setting in self.settings: try: setting_value = getattr(ns['config'], setting.name) except Exception, e: setting_value = 'Cannot calculate value: %s %s' % ( e.__class__.__name__, e) print >> out, indent(setting.description(value=setting_value), ' ')
def make_description(self, tasks=None): """ Returns the description of this project, in the context of the settings given. """ self.setup_config() if tasks is None: tasks = self.bind_tasks() out = StringIO() title = self.title or self.name title = '%s (%s)' % (title, self.project_name) print >> out, underline(title) doc = self.__doc__ if doc == Project.__doc__: doc = '[No project description set]' print >> out, dedent(doc) print >> out print >> out, indent(underline('Settings', '='), ' ') ns = self.create_namespace() if not self.settings: print >> out, indent('No settings', ' ') else: for setting in self.settings: try: setting_value = getattr(ns['config'], setting.name) except Exception, e: setting_value = 'Cannot calculate value: %s %s' % (e.__class__.__name__, e) print >> out, indent(setting.description(value=setting_value), ' ')
print >> out print >> out, indent(underline('Settings', '='), ' ') ns = self.create_namespace() if not self.settings: print >> out, indent('No settings', ' ') else: for setting in self.settings: try: setting_value = getattr(ns['config'], setting.name) except Exception, e: setting_value = 'Cannot calculate value: %s %s' % ( e.__class__.__name__, e) print >> out, indent(setting.description(value=setting_value), ' ') print >> out print >> out, indent(underline('Tasks', '='), ' ') for task in tasks: desc = str(task) print >> out, indent(underline(task.title, '-'), ' ') print >> out, indent(desc, ' ') print >> out if self.depends_on_projects: print >> out, indent(underline('Dependencies', '='), ' ') for project in self.depends_on_projects: print >> out, indent('* %s' % project, ' ') return out.getvalue() def interpolate(self, string, stacklevel=1, name=None): """ Interpolate a string in the context of the project namespace. """
doc = '[No project description set]' print >> out, dedent(doc) print >> out print >> out, indent(underline('Settings', '='), ' ') ns = self.create_namespace() if not self.settings: print >> out, indent('No settings', ' ') else: for setting in self.settings: try: setting_value = getattr(ns['config'], setting.name) except Exception, e: setting_value = 'Cannot calculate value: %s %s' % (e.__class__.__name__, e) print >> out, indent(setting.description(value=setting_value), ' ') print >> out print >> out, indent(underline('Tasks', '='), ' ') for task in tasks: desc = str(task) print >> out, indent(underline(task.title, '-'), ' ') print >> out, indent(desc, ' ') print >> out if self.depends_on_projects: print >> out, indent(underline('Dependencies', '='), ' ') for project in self.depends_on_projects: print >> out, indent('* %s' % project, ' ') return out.getvalue() def interpolate(self, string, stacklevel=1, name=None): """ Interpolate a string in the context of the project namespace. """