Example #1
0
def get_issue_form(global_config, issue_id):
    global_config['logger'].debug( 'GET Issue Form, Issue: %s', issue_id )
        
    session = DbSession.open_db_session(global_config['issues_db_name'] + global_config['this_season'])
    users_session = DbSession.open_db_session(global_config['users_db_name'] + global_config['this_season'])

    issue_id = issue_id
    platform = issue_id.split('-')[0]
    issue = IssueTrackerDataModel.getIssue(session, issue_id)
    
    form = issueform()
    form[issue_id_label].value = issue_id
    form[issue_platform_label].value = platform
    form[issue_summary_label].value = issue.summary
    form[issue_status_label].value = issue.status
    form[issue_priority_label].value = issue.priority
    
    # TODO: can also extract the subgroup and taskgroup(component) lists from the 
    #       database and override the form with the contents
    #       IssueTrackerDataModel.getSubgroupList() and getTaskgroupList()
    form[issue_subgroup_label].value = issue.subgroup
    form[issue_component_label].value = issue.component
    
    # apply the valid list of user names to the dropdown 
    # for the owner field and the submitter field
    username_list = UsersDataModel.getDisplayNameList(users_session)
    form[issue_owner_label].args = username_list
    form[issue_submitter_label].args = username_list

    form[issue_owner_label].value = issue.owner
    form[issue_submitter_label].value = issue.submitter
    form[issue_description_label].value = issue.description

    return form
Example #2
0
def get_new_issue_form(global_config, platform_type=None):
    global_config['logger'].debug( 'GET New Issue Form' )
        
    users_session = DbSession.open_db_session(global_config['users_db_name'] + global_config['this_season'])

    form = new_issueform()

    # apply the valid list of user names to the dropdown 
    # for the owner field and the submitter field
    username_list = UsersDataModel.getDisplayNameList(users_session)
    form[issue_owner_label].args = username_list
    form[issue_submitter_label].args = username_list
    
    # if the platform type is specified, then constrain the platform to that value
    if platform_type != None:
        form[issue_platform_label].args = [ platform_type ]

    # TODO: can also extract the subgroup and taskgroup(component) lists from the 
    #       database and override the form with the contents
    #       IssueTrackerDataModel.getSubgroupList() and getTaskgroupList()
    
    return form
    Session = sessionmaker(bind=my_db)
    session = Session()

    # Create the database if it doesn't already exist
    if not os.path.exists('./' + db_name):    
        UsersDataModel.create_db_tables(my_db)

    users = user_definitions.get_definitions()
    for user, definition in users.iteritems():
        UsersDataModel.addUserFromAttributes(session, definition)
    
    session.commit()
    
    taskgroups = UsersDataModel.getTaskgroupList(session)
    print taskgroups
    for group in taskgroups:
        print group
        members = UsersDataModel.getTaskgroupMembers(session,group)
        print members
    
    subgroups = UsersDataModel.getSubgroupList(session)
    print subgroups
    
    users = UsersDataModel.getUserList(session)
    print users
    
    users = UsersDataModel.getDisplayNameList(session)
    print users