本文整理汇总了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 )