00120 :
00121 tmp = tempfile.mkdtemp()
00122 os.mkdir( os.path.join( tmp, "META-INF" ) )
00123
00124 f_meta = "meta.xml"
00125 fd = open( os.path.join( tmp, f_meta ), "w" )
00126 fd.write( self.meta.toxml() )
00127 fd.close()
00128
00129 f_content = "content.xml"
00130 fd = open( os.path.join( tmp, f_content ), "w" )
00131 fd.write( self.content.toxml() )
00132 fd.close()
00133
00134 f_mimetype = "mimetype"
00135 fd = open( os.path.join( tmp, f_mimetype ), "w" )
00136 fd.write( self.mime_type )
00137 fd.close()
00138
00139 f_manifest = os.path.join("META-INF","manifest.xml")
00140 fd = open( os.path.join( tmp, f_manifest ), "w" )
00141 fd.write( self.manifest.toxml() )
00142 fd.close()
00143
00144 out = zipfile.ZipFile( filename, 'w' )
00145 for file in [ f_mimetype, f_meta, f_content, f_manifest ] :
00146 out.write( os.path.join( tmp, file ), file )
00147 out.close()
00148
00149 shutil.rmtree( tmp, True )
00150
00151
00152
00153