Prevent locked drawings to be deleted. Fixes https://github.com/GNS3/gns3-gui/issues/2948

This commit is contained in:
grossmj committed 2020-03-16 16:30:08 +10:30
1 parent 868c39acfe
commit 615cffd9ac
2 files changed
+2 -1

No files matched your search

-1
View File
@@ -16,7 +16,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import hashlib
import asyncio
import base64
import uuid
import re
+2
View File
@@ -684,6 +684,8 @@ class Project:
@open_required
async def delete_drawing(self, drawing_id):
drawing = self.get_drawing(drawing_id)
if drawing.locked:
raise aiohttp.web.HTTPConflict(text="Drawing ID {} cannot be deleted because it is locked".format(drawing_id))
del self._drawings[drawing.id]
self.dump()
self.emit_notification("drawing.deleted", drawing.__json__())