@@ -297,19 +297,31 @@ def agenda_documents(request):
297297 telechats .append ({'date' :date , 'docs' :res })
298298 return direct_to_template (request , 'iesg/agenda_documents.html' , {'telechats' :telechats , 'hide_telechat_date' :True })
299299
300- def agenda_downloaddocstgz (request ,year ,month ,day ):
300+ def telechat_docs_tarfile (request ,year ,month ,day ):
301+ from tempfile import mkstemp
301302 date = datetime .date (int (year ),int (month ),int (day ))
302303 docs = IDInternal .objects .filter (telechat_date = date , primary_flag = 1 , agenda = 1 )
303304 response = HttpResponse (mimetype = 'application/octet-stream' )
304305 response ['Content-Disposition' ] = 'attachment; filename=telechat-%s-%s-%s-docs.tgz' % (year , month , day )
305306 tarstream = tarfile .open ('' ,'w:gz' ,response )
307+ mfh , mfn = mkstemp ()
308+ manifest = open (mfn , "w" )
306309 for doc in docs :
307- tarstream .add (os .path .join (settings .INTERNET_DRAFT_PATH , doc .draft .filename + "-" + doc .draft .revision_display ()+ ".txt" ),
308- doc .draft .filename + "-" + doc .draft .revision_display ()+ ".txt" )
310+ doc_path = os .path .join (settings .INTERNET_DRAFT_PATH , doc .draft .filename + "-" + doc .draft .revision_display ()+ ".txt" )
311+ if os .path .exists (doc_path ):
312+ try :
313+ tarstream .add (doc_path , str (doc .draft .filename + "-" + doc .draft .revision_display ()+ ".txt" ))
314+ manifest .write ("Included: " + doc_path + "\n " )
315+ except Exception , e :
316+ manifest .write (("Failed (%s): " % e )+ doc_path + "\n " )
317+ else :
318+ manifest .write ("Not found: " + doc_path + "\n " )
319+ manifest .close ()
320+ tarstream .add (mfn , "manifest.txt" )
309321 tarstream .close ()
322+ os .unlink (mfn )
310323 return response
311324
312-
313325def discusses (request ):
314326 positions = Position .objects .filter (discuss = 1 )
315327 res = []
0 commit comments