aboutsummaryrefslogtreecommitdiffstats
path: root/servo/models/common.py
diff options
context:
space:
mode:
Diffstat (limited to 'servo/models/common.py')
-rw-r--r--servo/models/common.py13
1 files changed, 8 insertions, 5 deletions
diff --git a/servo/models/common.py b/servo/models/common.py
index 520b769..1d3e17b 100644
--- a/servo/models/common.py
+++ b/servo/models/common.py
@@ -46,6 +46,7 @@ class CsvTable(object):
self.header = u''
def padrow(self, row):
+ """Pad row to self.colwdith"""
r = []
for c in row:
r.append(unicode(c).ljust(self.colwidth))
@@ -761,7 +762,9 @@ class Template(models.Model):
class Attachment(models.Model):
- """A file attached to something."""
+ """
+ A file attached to something.
+ """
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey('content_type', 'object_id')
@@ -786,7 +789,7 @@ class Attachment(models.Model):
attachment.save()
def save(self, *args, **kwargs):
- DENIED_EXTENSIONS = ('.htm', '.html', '.py', '.js',)
+ DENIED_EXTENSIONS = ('.htm', '.html', '.py', '.js', '.exe', '.sh',)
filename = self.content.name.lower()
ext = os.path.splitext(filename)[1]
@@ -798,10 +801,10 @@ class Attachment(models.Model):
def __str__(self):
return os.path.basename(self.content.name)
- def __str__(self):
- return unicode(self).encode('utf-8')
-
def from_url(self, url):
+ """
+ Downloads a file and creates an attachment
+ """
pass
def get_absolute_url(self):