Rename
This commit is contained in:
parent
fb95033dbe
commit
a6eab76ab7
@ -94,12 +94,12 @@ class TaskOrder(Base, mixins.TimestampsMixin):
|
|||||||
def pdf(self, new_pdf):
|
def pdf(self, new_pdf):
|
||||||
self._pdf = self._set_attachment(new_pdf, "_pdf")
|
self._pdf = self._set_attachment(new_pdf, "_pdf")
|
||||||
|
|
||||||
def _set_attachment(self, new_attachment, property):
|
def _set_attachment(self, new_attachment, attribute):
|
||||||
if isinstance(new_attachment, Attachment):
|
if isinstance(new_attachment, Attachment):
|
||||||
return new_attachment
|
return new_attachment
|
||||||
elif isinstance(new_attachment, FileStorage):
|
elif isinstance(new_attachment, FileStorage):
|
||||||
return Attachment.attach(new_attachment, "task_order", self.id)
|
return Attachment.attach(new_attachment, "task_order", self.id)
|
||||||
elif not new_attachment and hasattr(self, property):
|
elif not new_attachment and hasattr(self, attribute):
|
||||||
return None
|
return None
|
||||||
else:
|
else:
|
||||||
raise TypeError("Could not set attachment with invalid type")
|
raise TypeError("Could not set attachment with invalid type")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user