diff options
Diffstat (limited to 'readdb.py')
-rw-r--r-- | readdb.py | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -386,6 +386,8 @@ class AnnotationManager: if self._userid == '': self._userid = self.get_userid_for_username( self.get_user_string( user ) ) #get the clientuuid to schedule its deletion on the annotation server + _logger.debug('delete annotation with id %s', str(annotation_id) ) + rows = self._conn.execute('select uuid, creator from annotations where md5=? and id=?', [self._filehash, annotation_id]) row = rows.fetchone() if row[1] == self._userid: @@ -597,9 +599,12 @@ class AnnotationManager: t = (None, annotation.get_filehash(), annotation.get_page(), annotation.get_note_title(), annotation.get_note_body(), annotation.get_bodyurl(), annotation.get_texttitle(), annotation.get_textcreator(), annotation.get_created(), annotation.get_modified(), annotation.get_creator(), annotation.get_annotates(), annotation.get_color().to_string(), annotation.is_local(), annotation.get_mimetype(), annotation.get_uuid(), annotation.get_annotationurl()) self._conn.execute('insert into annotations values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)', t) self._conn.commit() + row = self._conn.execute('select id from annotations order by id desc limit 1') + r = row.fetchone() + tid = int( r[0] ) + annotation.set_id( tid ) self.current_annotation = annotation - def update_annotation_db_record(self, annotation): #(id INTEGER PRIMARY KEY, md5, page, title, content, bodyurl, texttitle, textcreator, created TIMESTAMP, modified TIMESTAMP, creator, annotates, color, local, mimetype, uuid, annotationurl) @@ -672,8 +677,8 @@ class AnnotationManager: self.remotecreators.append(remotecreator) self.remotecolors[remotecreator] = XoColor() a.color = self.remotecolors[remotecreator] - self._annotations.append(a) self.insert_annotation_db_record(a) + self._annotations.append(a) self._sidebar.update_for_page(a.page) |