initialize file/image in case of missing attribute
This commit is contained in:
parent
6f35b9ffd6
commit
9fe17a1a2e
|
@ -125,6 +125,8 @@ class SyncFromThemis(UtilityView):
|
|||
if data.get('picture'):
|
||||
# this will be an url
|
||||
content = self.urlopen(data.get('picture')).read()
|
||||
if not hasattr(object, 'picture'):
|
||||
object.picture = None
|
||||
if object.picture is None or object.picture.data != content:
|
||||
object.picture = NamedBlobImage(content, filename=data.get('id'))
|
||||
if data.get('past_functions'):
|
||||
|
@ -240,10 +242,14 @@ class SyncFromThemis(UtilityView):
|
|||
object.session = data.get('session')
|
||||
if data.get('fichier'):
|
||||
content = self.urlopen(data.get('fichier')).read()
|
||||
if not hasattr(object, 'file'):
|
||||
object.file = None
|
||||
if object.file is None or object.file.data != content:
|
||||
object.file = NamedBlobFile(content, filename=data.get('id')+'.pdf')
|
||||
if data.get('document_imprime'):
|
||||
content = self.urlopen(data.get('document_imprime')).read()
|
||||
if not hasattr(object, 'file'):
|
||||
object.file = None
|
||||
if object.file is None or object.file.data != content:
|
||||
object.file = NamedBlobFile(content, filename=data.get('id')+'.pdf')
|
||||
if data.get('object_type'):
|
||||
|
|
Reference in New Issue