dimanche 19 juin 2016

how to color HTML rows?

I have the following code where I construct HTML rows,now when key is present in dict1 I want to color the row and when key is present in dict2 another color? how can I modify this code to color the rows?

for item in jiradb :
    MailBody = MailBody + "<tr>"
    MailBody = MailBody + "<td>" + str(icount) + "</td>"
    print get_field(item, 'key')
    key = item['key']
    key_after_none_check = get_field(item,'key');
    crashid_link = "https://company.com/data/browse/" + key;
    key_present_in_anr_tombstone = False;
    if ((key in dict1) and (dict1[key] !=0)):
        key_present_in_anr_tombstone = True
        #MailBody "<a href="" + crashid_link + "">" + str(get_field(item,'key ')) + "</a>;
        MailBody = MailBody + "<td>" + "<a href="" + crashid_link + "">" + str(key_after_none_check) + "</a>" + "(" + "x" + str(dict1[key]) + ")" +  "</td>"
    if ((key in dict2) and (dict2[key] !=0)):
        key_present_in_anr_tombstone = True
        MailBody = MailBody + "<td>" + "<a href="" + crashid_link + "">" + str(key_after_none_check) + "</a>" + "(" + "x" + str(dict2[key]) + ")" +  "</td>"
    if key_present_in_anr_tombstone == False:
        MailBody = MailBody + "<td>" + "<a href="" + crashid_link + "">" + str(key_after_none_check) + "</a>" + "</td>"
    MailBody = MailBody + "<td style="width:100%">" + get_field(item,'summary') + "</td>"
    MailBody = MailBody + "<td style="width:100%">" + get_field(item,'Resolution') + "</td>"
    icount = icount + 1

MailBody = MailBody + "</tr>"

Aucun commentaire:

Enregistrer un commentaire