|
|
@@ -87,26 +87,27 @@ class DocumentConverter(object):
|
|
|
data['isSaved'] = False
|
|
|
data['snippets'][0]['lastExecuted'] = time.mktime(doc.last_modified.timetuple()) * 1000
|
|
|
|
|
|
- doc2 = _historify(data, self.user)
|
|
|
- doc2.last_modified = doc.last_modified
|
|
|
-
|
|
|
- # save() updates the last_modified to current time. Resetting it using update()
|
|
|
- doc2.save()
|
|
|
- Document2.objects.filter(id=doc2.id).update(last_modified=doc.last_modified)
|
|
|
-
|
|
|
- self.imported_docs.append(doc2)
|
|
|
-
|
|
|
- # Tag for not re-importing
|
|
|
- Document.objects.link(
|
|
|
- doc2,
|
|
|
- owner=doc2.owner,
|
|
|
- name=doc2.name,
|
|
|
- description=doc2.description,
|
|
|
- extra=doc.extra
|
|
|
- )
|
|
|
-
|
|
|
- doc.add_tag(self.imported_tag)
|
|
|
- doc.save()
|
|
|
+ with transaction.atomic():
|
|
|
+ doc2 = _historify(data, self.user)
|
|
|
+ doc2.last_modified = doc.last_modified
|
|
|
+
|
|
|
+ # save() updates the last_modified to current time. Resetting it using update()
|
|
|
+ doc2.save()
|
|
|
+ Document2.objects.filter(id=doc2.id).update(last_modified=doc.last_modified)
|
|
|
+
|
|
|
+ self.imported_docs.append(doc2)
|
|
|
+
|
|
|
+ # Tag for not re-importing
|
|
|
+ Document.objects.link(
|
|
|
+ doc2,
|
|
|
+ owner=doc2.owner,
|
|
|
+ name=doc2.name,
|
|
|
+ description=doc2.description,
|
|
|
+ extra=doc.extra
|
|
|
+ )
|
|
|
+
|
|
|
+ doc.add_tag(self.imported_tag)
|
|
|
+ doc.save()
|
|
|
except ImportError, e:
|
|
|
LOG.warn('Cannot convert Saved Query documents: beeswax app is not installed')
|
|
|
|