Exemple #1
0
    def set(self, doc_id):
        # Load json
        self.doc_id = str(doc_id)
        try:
            fd = File(self.doc_id, 'c', 'r')
            content = fd.read()
            fd.close()
        except IOError:
            # There is no comment file.
            content = '{}'
        try:
            json_load = json.loads(content)
        except ValueError:
            # We get empty content.
            json_load = {}

        # Set json
        self.setFromDict(json_load)