Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self, zinstance, payload, parentid=None, basedir=None):
super(Zupload, self).__init__()
self.zinstance = zinstance
self.payload = payload
self.parentid = parentid
if basedir is None:
self.basedir = Path("")
elif isinstance(basedir, Path):
self.basedir = basedir
else:
self.basedir = Path(basedir)
def _attachment(self, payload, parentid=None):
"""
Create attachments
accepts a list of one or more attachment template dicts
and an optional parent Item ID. If this is specified,
attachments are created under this ID
"""
attachment = Zupload(self, payload, parentid)
res = attachment.upload()
return res
def upload_attachments(self, attachments, parentid=None, basedir=None):
"""Upload files to the already created (but never uploaded) attachments"""
return Zupload(self, attachments, parentid, basedir=basedir).upload()