summaryrefslogtreecommitdiffstats
path: root/src/Gui/CCDump.py
blob: 96d036c402a8f0b89f33132b8953644bb2c8041e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# -*- coding: utf-8 -*-
from datetime import datetime

from abrt_utils import _, init_logging, log, log1, log2

CD_TYPE     = 0
CD_EDITABLE = 1
CD_CONTENT  = 2

class Dump():
    """Class for mapping the debug dump to python object"""
    def __init__(self):
        self.UUID = None
        self.UID = None
        self.Count = None
        self.Executable = None
        self.Package = None
        self.Time = None
        self.Description = None
        self.Message = None
        self.Reported = None

    def getUUID(self):
        return self.UUID[CD_CONTENT]

    def getUID(self):
        return self.UID[CD_CONTENT]

    def getCount(self):
        return self.Count[CD_CONTENT]

    def getExecutable(self):
        return self.Executable[CD_CONTENT]

    def getPackage(self):
        return self.Package[CD_CONTENT]

    def isReported(self):
        return self.Reported[CD_CONTENT] == "1"

    def getMessage(self):
        if not self.Message:
            return "" #[]
        #return self.Message[CD_CONTENT].split('\n')
        return self.Message[CD_CONTENT]

    def getTime(self,format):
        #print format
        if format:
            try:
                return datetime.fromtimestamp(int(self.Time[CD_CONTENT])).strftime(format)
            except Exception, e:
                print e
        return int(self.Time[CD_CONTENT])

    def getPackageName(self):
        return self.Package[CD_CONTENT][:self.Package[CD_CONTENT].find("-")]

    def getDescription(self):
        return self.Description[CD_CONTENT]