Exemple #1
0
    def handle_proj(self, p, options, args, proj):

        default_milestone = Milestone(proj, title='unscheduled')
        default_estimate = Estimate(proj, title='not estimated')
        default_owner = Person(proj, title='no owner')
        default_tags = list()

        t = Task(

            proj,

            title=options.title or raw_input("Task title: ").strip(),

            description=(
                '' if options.no_description
                else clepy.edit_with_editor('# Task description goes here')),

            status=Status(proj, title='unstarted'),

            milestone=default_milestone if options.use_defaults \
            else Milestone.choose_from_already_instantiated(
                default_milestone,
                predicate=lambda m: not m.reached),

            estimate=default_estimate if options.use_defaults \
            else Estimate.choose_from_already_instantiated(default_estimate),

            owner=default_owner if options.use_defaults \
            else Person.choose_from_already_instantiated(default_owner),

            tags=default_tags if options.use_defaults \
            else Tag.choose_many_from_already_instantiated(),

        )

        proj.append(t)

        print("Added %r to the project." % t)