@@ -1381,7 +1381,7 @@ def upload_table(self, *, upload_resource=None, table_name=None, table_descripti
1381
1381
log .info (f"Uploaded table '{ table_name } '." )
1382
1382
return None
1383
1383
1384
- def __uploadTableMultipart (self , resource , * , table_name = None , table_description = None , resource_format = "votable" ,
1384
+ def __uploadTableMultipart (self , resource , * , table_name = None , table_description = None , resource_format = "votable" ,
1385
1385
verbose = False ):
1386
1386
connHandler = self .__getconnhandler ()
1387
1387
if isinstance (resource , Table ):
@@ -1410,17 +1410,21 @@ def __uploadTableMultipart(self, resource, *, table_name=None, table_description
1410
1410
"TABLE_DESC" : str (table_description ),
1411
1411
"FORMAT" : 'votable' }
1412
1412
log .info (f"Sending file: { resource } " )
1413
+ if resource .lower () == 'votable' :
1414
+ with open (resource , "r" ) as f :
1415
+ chunk = f .read ()
1416
+ files = [['FILE' , os .path .basename (resource ), chunk ]]
1417
+ else :
1418
+ table = Table .read (str (resource ))
1419
+ fh = tempfile .NamedTemporaryFile (delete = False )
1420
+ table .write (fh , format = 'votable' )
1421
+ fh .close ()
1413
1422
1414
- t = Table .read (str (resource ) )
1415
- fh = tempfile .NamedTemporaryFile (delete = False )
1416
- t .write (fh , format = 'votable' )
1417
- fh .close ()
1418
-
1419
- with open (fh .name , "r" ) as f :
1420
- chunk = f .read ()
1423
+ with open (fh .name , "r" ) as f :
1424
+ chunk = f .read ()
1421
1425
1422
- os .unlink (fh .name )
1423
- files = [['FILE' , 'pytable' , chunk ]]
1426
+ os .unlink (fh .name )
1427
+ files = [['FILE' , 'pytable' , chunk ]]
1424
1428
1425
1429
content_type , body = connHandler .encode_multipart (args , files )
1426
1430
else : # upload from URL
0 commit comments