Subversion Repositories basico

Rev

Rev 65 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 65 Rev 73
Line 40... Line 40...
40
40
41
41
42
    def store(self, sapnote, html):
42
    def store(self, sapnote, html):
43
        DB_DIR = self.get_var('DB', 'local')
43
        DB_DIR = self.get_var('DB', 'local')
44
        FSAPNOTE = DB_DIR + sapnote + '.xml'
44
        FSAPNOTE = DB_DIR + sapnote + '.xml'
45
        f = open(FSAPNOTE, 'w')
-
 
46
        f.write(html)
-
 
47
        f.close()
-
 
48
        self.log.debug("\tSAP Note %s stored in %s" % (sapnote, FSAPNOTE))
-
 
-
 
45
-
 
46
        try:
-
 
47
            f = open(FSAPNOTE, 'w')
-
 
48
            f.write(html)
-
 
49
            f.close()
-
 
50
            self.log.debug("\tSAP Note %s stored in %s" % (sapnote, FSAPNOTE))
-
 
51
        except Exception as error:
-
 
52
            self.log.error(error)
49
53
50
54
51
    def rebuild_from_dir(self, path=None):
55
    def rebuild_from_dir(self, path=None):
52
        db = self.get_service('DB')
56
        db = self.get_service('DB')
53
        DB_DIR = self.get_var('DB', 'local')
57
        DB_DIR = self.get_var('DB', 'local')
Line 87... Line 91...
87
91
88
    def is_stored(self, sid):
92
    def is_stored(self, sid):
89
        DB_DIR = self.get_var('DB', 'local')
93
        DB_DIR = self.get_var('DB', 'local')
90
        fsapnote = DB_DIR + sid + '.xml'
94
        fsapnote = DB_DIR + sid + '.xml'
91
        stored = os.path.exists(fsapnote)
95
        stored = os.path.exists(fsapnote)
92
        self.log.debug("\tSAP Note %s stored in database? %s" % (sid, stored))
-
 
-
 
96
        #~ self.log.debug("\tSAP Note %s stored in database? %s" % (sid, stored))
93
97
94
        return stored
98
        return stored
95
99
96
100
97
    def build_stats(self, bag=None):
101
    def build_stats(self, bag=None):
Line 112... Line 116...
112
            self.tasks.save_tasks_from_stats(alltasks)
116
            self.tasks.save_tasks_from_stats(alltasks)
113
117
114
            # components
118
            # components
115
            compkey = self.sapnotes[sid]['componentkey']
119
            compkey = self.sapnotes[sid]['componentkey']
116
            comptxt = self.sapnotes[sid]['componenttxt']
120
            comptxt = self.sapnotes[sid]['componenttxt']
117
            self.log.debug("%s -> %s -> %s" % (sid, compkey, comptxt))
-
 
-
 
121
            #~ self.log.debug("%s -> %s -> %s" % (sid, compkey, comptxt))
118
            component = escape("%s (%s)" % (compkey, comptxt))
122
            component = escape("%s (%s)" % (compkey, comptxt))
119
            sep = compkey.find('-')
123
            sep = compkey.find('-')
120
            if sep > 0:
124
            if sep > 0:
121
                maincomp = compkey[0:sep]
125
                maincomp = compkey[0:sep]
122
            else:
126
            else: