mirror of
https://expo.survex.com/repositories/troggle/.git
synced 2025-01-19 17:32:31 +00:00
Make more robust to WSL chmod failures for tests
This commit is contained in:
parent
71ed0815cc
commit
18c2892967
@ -46,7 +46,6 @@ todo = '''
|
|||||||
https://stackoverflow.com/questions/889333/how-to-check-if-a-file-is-a-valid-image-file
|
https://stackoverflow.com/questions/889333/how-to-check-if-a-file-is-a-valid-image-file
|
||||||
|
|
||||||
- Enable folder creation in dwguploads or as a separate form
|
- Enable folder creation in dwguploads or as a separate form
|
||||||
|
|
||||||
- Register uploaded filenames in the Django db without needing to wait for a reset & bulk file import
|
- Register uploaded filenames in the Django db without needing to wait for a reset & bulk file import
|
||||||
'''
|
'''
|
||||||
|
|
||||||
@ -200,7 +199,13 @@ def scanupload(request, path=None):
|
|||||||
actual_saved = []
|
actual_saved = []
|
||||||
if multiple:
|
if multiple:
|
||||||
for f in multiple:
|
for f in multiple:
|
||||||
actual_saved.append( fs.save(f.name, content=f) )
|
try: # crashes in Django os.chmod call if on WSL, but does save file!
|
||||||
|
saved_filename = fs.save(f.name, content=f)
|
||||||
|
except:
|
||||||
|
print(f'\n !! Permissions failure ?! on attempting to save file {f.name}')
|
||||||
|
if 'saved_filename' in locals():
|
||||||
|
if saved_filename.is_file():
|
||||||
|
actual_saved.append(saved_filename)
|
||||||
# print(f'! - FORM scanupload multiple {actual_saved}')
|
# print(f'! - FORM scanupload multiple {actual_saved}')
|
||||||
filesaved = True
|
filesaved = True
|
||||||
|
|
||||||
@ -367,7 +372,13 @@ def photoupload(request, folder=None):
|
|||||||
actual_saved = []
|
actual_saved = []
|
||||||
if multiple:
|
if multiple:
|
||||||
for f in multiple:
|
for f in multiple:
|
||||||
actual_saved.append( fs.save(f.name, content=f) )
|
try: # crashes in Django os.chmod call if on WSL, but does save file!
|
||||||
|
saved_filename = fs.save(f.name, content=f)
|
||||||
|
except:
|
||||||
|
print(f'\n !! Permissions failure ?! on attempting to save file {f.name}')
|
||||||
|
if 'saved_filename' in locals():
|
||||||
|
if saved_filename.is_file():
|
||||||
|
actual_saved.append(saved_filename)
|
||||||
filesaved = True
|
filesaved = True
|
||||||
files = []
|
files = []
|
||||||
dirs = []
|
dirs = []
|
||||||
@ -456,7 +467,12 @@ def dwgupload(request, folder=None, gitdisable='no'):
|
|||||||
if multiple:
|
if multiple:
|
||||||
for f in multiple:
|
for f in multiple:
|
||||||
if dwgvalid(f.name):
|
if dwgvalid(f.name):
|
||||||
|
try: # crashes in Django os.chmod call if on WSL, but does save file!
|
||||||
saved_filename = fs.save(f.name, content=f)
|
saved_filename = fs.save(f.name, content=f)
|
||||||
|
except:
|
||||||
|
print(f'\n !! Permissions failure ?! on attempting to save file {f.name}')
|
||||||
|
if 'saved_filename' in locals():
|
||||||
|
if saved_filename.is_file():
|
||||||
actual_saved.append(saved_filename)
|
actual_saved.append(saved_filename)
|
||||||
if gitdisable != 'yes':
|
if gitdisable != 'yes':
|
||||||
dr_add = subprocess.run([git, "add", saved_filename], cwd=dirpath, capture_output=True, text=True)
|
dr_add = subprocess.run([git, "add", saved_filename], cwd=dirpath, capture_output=True, text=True)
|
||||||
|
Loading…
Reference in New Issue
Block a user