~fginther/kanban-tracker/add-org-teams

« back to all changes in this revision

Viewing changes to collect

  • Committer: timo.jyrinki at canonical
  • Date: 2012-06-27 08:16:52 UTC
  • Revision ID: timo.jyrinki@canonical.com-20120627081652-cyetivtvfgfwd6sp
more error catching, and a project naming change

Show diffs side-by-side

added added

removed removed

Lines of Context:
750
750
        workitem.priority = data['PriorityText']
751
751
        workitem.blueprint_name = blueprint.name
752
752
        if ("AssignedUsers" in data):
753
 
            person = collector.store.find(Person, Person.display_name==data['AssignedUserName']).any()
 
753
            try:
 
754
                person = collector.store.find(Person, Person.display_name==data['AssignedUserName']).any()
 
755
            except:
 
756
                print "Error with person data"
 
757
                person = None
754
758
            if person is not None:
755
759
                workitem.assignee_name = person.name
756
760
                # Only add people to teams as participants when they have at least one card assigned
787
791
    print "Fetching board list from the server"
788
792
 
789
793
    allboards = kanban.getBoards()
 
794
    visitedboards = ''
790
795
 
791
796
    for project_name in project_names:
792
797
        print ""
888
893
                print "No board found!"
889
894
                continue
890
895
 
891
 
            collector.store_team_structure(
892
 
                 unicode(board.title), unicode(kanban_superteam))
893
 
            kanban_person_cache(collector, board, board.title, people_cache)
 
896
            if board_name not in visitedboards:
 
897
                print board_name + " not yet in visited boards, adding"
 
898
                visitedboards += board_name
 
899
                collector.store_team_structure(
 
900
                     unicode(board.title), unicode(kanban_superteam))
 
901
                kanban_person_cache(collector, board, board.title, people_cache)
894
902
            print(board.id)
895
903
    
896
904
            # Create a blueprint for this board
897
905
            name = board.title
898
906
            blueprint = Blueprint()
899
 
            blueprint.name = unicode(board.title)
 
907
            blueprint.name = unicode(project_name) + u' (' + unicode(board.title) + u')'
900
908
            blueprint.milestone_name = milestone.name
901
909
            blueprint.url = (
902
910
                unicode(kanban_project_url) + unicode(board.id))
903
911
            blueprint.priority = u'Medium'
904
912
            blueprint.implementation = u'Unknown'
905
 
            blueprint.team = unicode(board.title)
 
913
            blueprint.team = unicode(project_name)
906
914
            blueprint.status = unicode(project_description)
907
915
            print "Storing blueprint"
908
916
            collector.store_blueprint(blueprint)
911
919
            # page overview. This is the "topic" blueprint group.
912
920
            innerblueprintgroup = BlueprintGroup()
913
921
            # The key difference:
914
 
            innerblueprintgroup.name = unicode(board.title)
 
922
            innerblueprintgroup.name = unicode(project_name) + u' (' + unicode(board.title) + u')'
915
923
            innerblueprintgroup.milestone_name = milestone.name
916
924
            innerblueprintgroup.milestone = milestone
917
925
            # Area == the section/project
974
982
                        #print ("Assigned User Id" + str(data['AssignedUserId']))
975
983
                        #print ("Assigned User Name" + data['AssignedUserName'])
976
984
                        #print "Searching for %s" % data['AssignedUserName']
977
 
                        person = collector.store.find(Person, Person.display_name == data['AssignedUserName']).any()
 
985
                        try:
 
986
                            person = collector.store.find(Person, Person.display_name == data['AssignedUserName']).any()
 
987
                        except:
 
988
                            print "Error with person data"
 
989
                            person = None
978
990
                        if person is not None:
979
991
                            #print "Assigning"
980
992
                            workitem.assignee_name = person.name