Beispiel #1
0
def pitz_add_person():

    p = setup_options()
    p.add_option('-t', '--title', help='Person title')

    options, args = p.parse_args()

    if options.version:
        print_version()
        return

    pitzdir = Project.find_pitzdir(options.pitzdir)

    proj = Project.from_pitzdir(pitzdir)
    proj.find_me()

    person = Person(
        proj,
        title=options.title or raw_input("Person title: ").strip(),
        description=clepy.edit_with_editor('# Person description goes here'),
    )

    proj.append(person)
    print("Added %s to the project." % person.summarized_view)
    proj.save_entities_to_yaml_files()

    if raw_input("Should I identify you as %(title)s? (y/N)" % person)\
    .strip().lower().startswith('y'):

        person.save_as_me_yaml()
        print("OK, I'll recognize you as %(title)s from now on.")
Beispiel #2
0
    def test_11(self):
        matt = Person.by_title('matt')

        self.mk_request('/by_frag/%s/my_todo' % matt.frag,
            '',
            'text/plain',
            '200 OK',
            str(matt.my_todo))

        self.mk_request('/by_frag/%s/my_todo/summarized_view' % matt.frag,
            '',
            'text/plain',
            '200 OK',
            str(matt.my_todo.summarized_view))

        self.mk_request('/by_frag/%s/my_todo/detailed_view' % matt.frag,
            '',
            'text/plain',
            '200 OK',
            str(matt.my_todo.detailed_view))
Beispiel #3
0
def pitz_assign_task():
    """
    Add this task to somebody's to-do list
    """

    script_name = 'pitz-assign-task'

    p = setup_options()
    p.set_usage("%prog task [person]")

    options, args = p.parse_args()

    if not args:
        p.print_usage()
        return

    if options.version:
        print_version()
        return

    pitzdir = Project.find_pitzdir(options.pitzdir)

    proj = Project.from_pitzdir(pitzdir)
    proj.find_me()

    t = proj[args[0]]

    if len(args) == 2:
        person = proj[args[1]]

    else:
        person = Person.choose_from_already_instantiated()

        if not person:
            print("Pick somebody!")
            return

    t.assign(person)
    proj.save_entities_to_yaml_files()
Beispiel #4
0
def pitz_me():
    """
    Pick a Person or make a new one, then save a me.yaml file.
    """

    p = setup_options()

    options, args = p.parse_args()

    if options.version:
        print_version()
        return

    pitzdir = Project.find_pitzdir(options.pitzdir)

    proj = Project.from_pitzdir(pitzdir)
    proj.find_me()

    if proj.me:
        print("You are %(title)s." % proj.me)
        print("Delete this file if you want to be somebody else:")
        print(os.path.join(proj.pathname, 'me.yaml'))
        return

    if Person.already_instantiated:
        print("You may already be in pitz:")
        choice = Person.choose_from_already_instantiated()
        if choice:
            person = choice
            person.save_as_me_yaml()

            print("OK, I'll recognize you as %(title)s from now on."
                % person)

            return

    print("I'll add you to pitz.")
    pitz_add_person()
Beispiel #5
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)
Beispiel #6
0
 def test_8(self):
     self.mk_request('/Person/by_title/matt/my_todo/summarized_view',
         '', 'text/plain',
         '200 OK',
         Person.by_title('matt').my_todo.summarized_view)
Beispiel #7
0
 def test_7(self):
     self.mk_request('/Person/by_title/matt/my_todo', '',
         'text/plain',
         '200 OK',
         Person.by_title('matt').my_todo.detailed_view)