summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSunil Shetye2024-06-20 19:32:44 +0530
committerSunil Shetye2024-06-20 19:32:44 +0530
commit22f0ab7f8cd0f56b52195553f815a88e723fb30c (patch)
tree809c20116ab49c9a04032ac79c3a1d86d20ce3bb
parent76c040108030a19e3fa42d8a4f042052e6bfce95 (diff)
downloadCommon-Interface-Project-22f0ab7f8cd0f56b52195553f815a88e723fb30c.tar.gz
Common-Interface-Project-22f0ab7f8cd0f56b52195553f815a88e723fb30c.tar.bz2
Common-Interface-Project-22f0ab7f8cd0f56b52195553f815a88e723fb30c.zip
fix python bugs
-rw-r--r--blocks/saveAPI/models.py4
-rwxr-xr-xscripts/xmldiff.py5
2 files changed, 6 insertions, 3 deletions
diff --git a/blocks/saveAPI/models.py b/blocks/saveAPI/models.py
index b2c399ac..fc4af5b3 100644
--- a/blocks/saveAPI/models.py
+++ b/blocks/saveAPI/models.py
@@ -2,6 +2,7 @@ from django.conf import settings
from django.contrib.auth import get_user_model
from django.core.files.storage import FileSystemStorage
from django.db import models
+from django.utils.html import format_html
from django.utils.safestring import mark_safe
import uuid
@@ -47,7 +48,8 @@ class Gallery(models.Model):
def image_tag(self):
print(file_storage)
if self.media:
- return mark_safe('<img src="%s" style="width: 45px; height:45px;" />' % self.media.url)
+ return format_html('<img src="{}" style="width: 45px; height:45px;" />',
+ mark_safe(self.media.url))
else:
return 'No Image Found'
image_tag.short_description = 'Image'
diff --git a/scripts/xmldiff.py b/scripts/xmldiff.py
index f95c3f33..bf371a35 100755
--- a/scripts/xmldiff.py
+++ b/scripts/xmldiff.py
@@ -2,6 +2,7 @@
import sys
import xml.etree.ElementTree as ET
+import defusedxml.ElementTree as goodET
def remove_keys(elem):
for key in ['x', 'y', 'height', 'width', 'style']:
@@ -10,8 +11,8 @@ def remove_keys(elem):
return elem
def compare_xml_files(file1, file2):
- tree1 = ET.parse(file1)
- tree2 = ET.parse(file2)
+ tree1 = goodET.parse(file1)
+ tree2 = goodET.parse(file2)
root1 = tree1.getroot()
root2 = tree2.getroot()