#!/usr/bin/python

import jira

def debugOutput(name, param):
    print name
    print "===================="
    print param
    print "===================="


def getWikiLink(text, link):
    return "[" + text + "|" + link + "]"

def printIssue():
    print jira.getParticipants(jira.getIssue("FRWA-13618"))

#printIssue()

def getJiraTable(issues):
    wiki = "Type,Created,Key,Summary,Assignee,Reporter,Priority,Status,Resolution,Updated\n"

    for issue in issues:
#        jiraWikiLink = getWikiLink(issue.key, jira.getJiraLink(issue.key))
#           + '"' + jira.getParticipants(issue) + '",' \
#         participants=jira.getParticipants(issue)         

        row = '"' + jira.getType(issue.type) + '",' \
            + '"' + unicode(issue.created) + '",' \
            + '"' + issue.key + '",' \
            + '"' + issue.summary + '",' \
            + '"' + jira.getUser(issue.assignee) + '",' \
            + '"' + jira.getUser(issue.reporter) + '",' \
            + '"' + jira.getPriority(issue.priority) + '",' \
            + '"' + jira.getStatus(issue.status) + '",' \
            + '"' + jira.getResolution(issue.resolution) + '",' \
            + '"' + unicode(issue.updated) + '"' + "\n"
        wiki += row
    return wiki

#+ '"' + jira.getUser(issue.assignee) + '",' \            
#            + '"' + jira.getParticipants(issue) + '",' \

def generateConfluence(jql_query):
    wiki = getJiraTable(jira.getSpesialTasks(jql_query))
    print wiki

generateConfluence('assignee = mishin')

#generateConfluence('project = FRWA AND resolution in (Unresolved, Reopened) AND assignee = mishnik')
#generateConfluence()
#c/Python27/python.exe sl3.jira.py > sl3_2.csv
# /cygdrive/c/Python27/python.exe sl3.jira.py > sl3_2.csv;5~
#c:\Python27\python.exe sl3.jira.py > sl3_2.csv
Hosted by uCoz