Esempio n. 1
0
 def update_annotations(old_obj, translate_dict):
     new_annotations = [DBAnnotation.update_version(a, translate_dict)
                        for a in old_obj.db_annotations]
     if old_obj.db_id in notes_annotations:
         (id, notes, is_new, is_dirty) = notes_annotations[old_obj.db_id]
         ann = DBAnnotation(id=id,
                            key='__notes__',
                            value=notes)
         ann.is_new = is_new
         ann.is_dirty = is_dirty
         new_annotations.append(ann)
     if old_obj.db_id in upgrade_annotations:
         (id, upgrade, is_new, is_dirty) = \
             upgrade_annotations[old_obj.db_id]
         ann =  DBAnnotation(id=id,
                             key='__upgrade__',
                             value=upgrade)
         ann.is_new = is_new
         ann.is_dirty = is_dirty
         new_annotations.append(ann)
     if old_obj.db_id in thumb_annotations:
         (id, thumb, is_new, is_dirty) = thumb_annotations[old_obj.db_id]
         ann = DBAnnotation(id=id,
                            key='__thumb__',
                            value=thumb)
         ann.is_new = is_new
         ann.is_dirty = is_dirty
         new_annotations.append(ann)
     return new_annotations
Esempio n. 2
0
 def update_annotations(old_obj, translate_dict):
     new_annotations = [DBAnnotation.update_version(a, translate_dict)
                        for a in old_obj.db_annotations]
     if old_obj.db_id in notes_annotations:
         (id, notes, is_new, is_dirty) = notes_annotations[old_obj.db_id]
         ann = DBAnnotation(id=id,
                            key='__notes__',
                            value=notes)
         ann.is_new = is_new
         ann.is_dirty = is_dirty
         new_annotations.append(ann)
     if old_obj.db_id in upgrade_annotations:
         (id, upgrade, is_new, is_dirty) = \
             upgrade_annotations[old_obj.db_id]
         ann =  DBAnnotation(id=id,
                             key='__upgrade__',
                             value=upgrade)
         ann.is_new = is_new
         ann.is_dirty = is_dirty
         new_annotations.append(ann)
     if old_obj.db_id in thumb_annotations:
         (id, thumb, is_new, is_dirty) = thumb_annotations[old_obj.db_id]
         ann = DBAnnotation(id=id,
                            key='__thumb__',
                            value=thumb)
         ann.is_new = is_new
         ann.is_dirty = is_dirty
         new_annotations.append(ann)
     return new_annotations
Esempio n. 3
0
 def update_actions(old_obj, translate_dict):
     new_actions = []
     for action in old_obj.db_actions:
         if action.db_id in del_notes_annotations:
             (id, notes, is_new, is_dirty) = \
                 del_notes_annotations[action.db_id]
             ann = DBAnnotation(id=id,
                                key='__notes__',
                                value=notes)
             ann.is_new = is_new
             ann.is_dirty = is_dirty
             action.db_deleted_annotations.append(ann)
         if action.db_id in del_upgrade_annotations:
             (id, upgrade, is_new, is_dirty) = \
                 del_upgrade_annotations[action.db_id]
             ann = DBAnnotation(id=id,
                                key='__upgrade__',
                                value=upgrade)
             ann.is_new = is_new
             ann.is_dirty = is_dirty
             action.db_deleted_annotations.append(ann)
         if action.db_id in del_thumb_annotations:
             (id, thumb, is_new, is_dirty) = \
                 del_thumb_annotations[action.db_id]
             ann = DBAnnotation(id=id,
                                key='__thumb__',
                                value=thumb)
             ann.is_new = is_new
             ann.is_dirty = is_dirty
             action.db_deleted_annotations.append(ann)                
         new_actions.append(DBAction.update_version(action, translate_dict))
     return new_actions
Esempio n. 4
0
 def update_actions(old_obj, translate_dict):
     new_actions = []
     for action in old_obj.db_actions:
         if action.db_id in del_notes_annotations:
             (id, notes, is_new, is_dirty) = \
                 del_notes_annotations[action.db_id]
             ann = DBAnnotation(id=id,
                                key='__notes__',
                                value=notes)
             ann.is_new = is_new
             ann.is_dirty = is_dirty
             action.db_deleted_annotations.append(ann)
         if action.db_id in del_upgrade_annotations:
             (id, upgrade, is_new, is_dirty) = \
                 del_upgrade_annotations[action.db_id]
             ann = DBAnnotation(id=id,
                                key='__upgrade__',
                                value=upgrade)
             ann.is_new = is_new
             ann.is_dirty = is_dirty
             action.db_deleted_annotations.append(ann)
         if action.db_id in del_thumb_annotations:
             (id, thumb, is_new, is_dirty) = \
                 del_thumb_annotations[action.db_id]
             ann = DBAnnotation(id=id,
                                key='__thumb__',
                                value=thumb)
             ann.is_new = is_new
             ann.is_dirty = is_dirty
             action.db_deleted_annotations.append(ann)                
         new_actions.append(DBAction.update_version(action, translate_dict))
     return new_actions