本文整理匯總了Python中MaKaC.conference.Conference.addMaterial方法的典型用法代碼示例。如果您正苦於以下問題:Python Conference.addMaterial方法的具體用法?Python Conference.addMaterial怎麽用?Python Conference.addMaterial使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類MaKaC.conference.Conference
的用法示例。
在下文中一共展示了Conference.addMaterial方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: testArchiveConferenceFile
# 需要導入模塊: from MaKaC.conference import Conference [as 別名]
# 或者: from MaKaC.conference.Conference import addMaterial [as 別名]
def testArchiveConferenceFile( self ):
"""Makes sure a file wich is attached to a conference gets stored in
the right path: basePath/year/C0/0/test.txt
"""
#first we create a dummy user which will be the conf creator
from MaKaC.user import Avatar
av = Avatar()
#Now we create a dummy conference and set its id to 0
from MaKaC.conference import Conference
c = Conference( av )
c.setId( "0" )
#Now we create the material (id=0) and attach it to the conference
from MaKaC.conference import Material
m = Material()
c.addMaterial( m )
#Now we create a dummy file and attach it to the material
filePath = os.path.join( os.getcwd(), "test.txt" )
fh = open(filePath, "w")
fh.write("hola")
fh.close()
from MaKaC.conference import LocalFile
f = LocalFile()
f.setFilePath( filePath )
f.setFileName( "test.txt" )
m.addResource( f )