[ create a new paste ] login | about

Link: http://codepad.org/7gJQvyow    [ raw code | fork ]

Python, pasted on Oct 7:
def detail_replace(detail):
    result = []
    for key,val in detail.items():
        if key == 'user':
            temp_val = val.split(",")
            val_arr = []
            for temp_user in temp_val:
                val_arr.append('<a href="mailto:%s@hawaii.edu">%s</a>' %(temp_user,temp_user))
            detail[key] = ", ".join(val_arr)

        if '=' in val:
            if "http://" in val or "https://" in val:
                detail[key] = '<a href="%s" target="_blank">Open</a>'
            else:
                temp = val.split(",")
                temp_arr_1 = []
                for each in temp:
                    temp_arr_2 = each.split("=")

                    if temp_arr_2[0] == "S":
                        temp_arr_2[0] = "Sent"
                    elif temp_arr_2[0] == "R":
                        temp_arr_2[0] = "Received"
                    elif temp_arr_2[0] == "ErrIn":
                        temp_arr_2[0] = "Error-In"
                    elif temp_arr_2[0] == "ErrOut":
                        temp_arr_2[0] = "Error-Out"
                    elif temp_arr_2[0] == "T":
                        temp_arr_2[0] = "Total"
                    elif temp_arr_2[0] == "F":
                        temp_arr_2[0] = "Free"
                    else:
                        temp_arr_2[0] = temp_arr_2[0]


Create a new paste based on this one


Comments: