本文整理汇总了Python中MaKaC.conference.Conference.setId方法的典型用法代码示例。如果您正苦于以下问题:Python Conference.setId方法的具体用法?Python Conference.setId怎么用?Python Conference.setId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.conference.Conference
的用法示例。
在下文中一共展示了Conference.setId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testArchiveConferenceFile
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setId [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 )
示例2: TestBasicManagement
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setId [as 别名]
class TestBasicManagement(unittest.TestCase):
"""Tests the basic contribution management functions
"""
def setUp( self ):
a = Avatar()
a.setId("creator")
self._categ = Category()
self._conf = Conference( a )
self._conf.setId('a')
self._conf.setDates(datetime(2000, 01, 01, tzinfo=timezone("UTC")),datetime(2020, 01, 01, tzinfo=timezone("UTC")))
示例3: TestContributionSubmitterIndex
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setId [as 别名]
class TestContributionSubmitterIndex(unittest.TestCase):
"""
"""
def setUp( self ):
self._creator = Avatar()
self._creator.setId("creator")
self._categ = Category()
self._conf=Conference(self._creator)
self._conf.setId('a')
self._conf.setTimezone('UTC')
self._categ._addConference(self._conf)
def testBasic(self):
c1,c2=Contribution(),Contribution()
av1,av2=Avatar(),Avatar()
av1.setId("1")
av2.setId("2")
self.assert_(len(self._conf.getContribsForSubmitter(av1))==0)
self.assert_(len(self._conf.getContribsForSubmitter(av2))==0)
self._conf.addContribution(c1)
self.assert_(len(self._conf.getContribsForSubmitter(av1))==0)
self.assert_(len(self._conf.getContribsForSubmitter(av2))==0)
c1.grantSubmission(av1)
self.assert_(len(self._conf.getContribsForSubmitter(av1))==1)
self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
self.assert_(len(self._conf.getContribsForSubmitter(av2))==0)
c2.grantSubmission(av2)
self.assert_(len(self._conf.getContribsForSubmitter(av1))==1)
self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
self.assert_(len(self._conf.getContribsForSubmitter(av2))==0)
self._conf.addContribution(c2)
self.assert_(len(self._conf.getContribsForSubmitter(av1))==1)
self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
self.assert_(len(self._conf.getContribsForSubmitter(av2))==1)
self.assert_(c2 in self._conf.getContribsForSubmitter(av2))
c1.grantSubmission(av2)
self.assert_(len(self._conf.getContribsForSubmitter(av1))==1)
self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
self.assert_(len(self._conf.getContribsForSubmitter(av2))==2)
self.assert_(c1 in self._conf.getContribsForSubmitter(av2))
self.assert_(c2 in self._conf.getContribsForSubmitter(av2))
c1.revokeSubmission(av2)
self.assert_(len(self._conf.getContribsForSubmitter(av1))==1)
self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
self.assert_(len(self._conf.getContribsForSubmitter(av2))==1)
self.assert_(c1 not in self._conf.getContribsForSubmitter(av2))
self.assert_(c2 in self._conf.getContribsForSubmitter(av2))
self._conf.removeContribution(c2)
self.assert_(len(self._conf.getContribsForSubmitter(av1))==1)
self.assert_(c1 in self._conf.getContribsForSubmitter(av1))
self.assert_(len(self._conf.getContribsForSubmitter(av2))==0)
self.assert_(c1 not in self._conf.getContribsForSubmitter(av2))
self.assert_(c2 not in self._conf.getContribsForSubmitter(av2))
示例4: _Needs_Rewriting_TestTimeSchedule
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setId [as 别名]
class _Needs_Rewriting_TestTimeSchedule(unittest.TestCase):
"""Tests the basic schedule management functions
"""
def setUp( self ):
a = Avatar()
a.setId("creator")
self._conf = Conference( a )
self._conf.setId('a')
category=Category()
category.setId('1')
self._conf.addOwner(category)
catDateIdx = indexes.IndexesHolder().getIndex('categoryDate')
catDateIdx.indexConf(self._conf)
self._conf.setTimezone('UTC')
#TODO We need somehow to link schOwner with self._conf (Same thing for the following test
# def testBasicAddAndRemove( self ):
# from MaKaC.schedule import TimeSchedule
# sDateSch,eDateSch=datetime(2004,1,1,10,0, tzinfo=timezone('UTC')),datetime(2004,1,1,12,0, tzinfo=timezone('UTC'))
# schOwner=_ScheduleOwnerWrapper(sDateSch,eDateSch)
# sch=TimeSchedule(schOwner)
# self._conf.addOwner(sch)
# entry1=IndTimeSchEntry()
# entry1.setDuration(0,25)
# entry2=IndTimeSchEntry()
# entry2.setDuration(0,30)
# entry3=IndTimeSchEntry()
# self.assert_(not entry1.isScheduled())
# self.assert_(not entry2.isScheduled())
# self.assert_(not entry3.isScheduled())
# sch.addEntry(entry1)
# sch.addEntry(entry2)
# sch.addEntry(entry3)
# self.assert_(entry1.isScheduled())
# self.assert_(entry2.isScheduled())
# self.assert_(entry3.isScheduled())
# self.assert_(entry1==sch.getEntries()[0])
# self.assert_(entry2==sch.getEntries()[1])
# self.assert_(entry3==sch.getEntries()[2])
# self.assert_(entry1.getStartDate()==datetime(2004,1,1,10,0, tzinfo=timezone('UTC')))
# self.assert_(entry1.getDuration()==timedelta(minutes=25))
# self.assert_(entry2.getStartDate()==datetime(2004,1,1,10,25, tzinfo=timezone('UTC')))
# self.assert_(entry2.getDuration()==timedelta(minutes=30))
# self.assert_(entry3.getStartDate()==datetime(2004,1,1,10,55, tzinfo=timezone('UTC')))
# self.assert_(entry3.getDuration()==timedelta(minutes=5))
# sch.removeEntry(entry1)
# self.assert_(not entry1.isScheduled())
# self.assert_(entry2.isScheduled())
# self.assert_(entry3.isScheduled())
# self.assert_(entry1 not in sch.getEntries())
# self.assert_(entry2==sch.getEntries()[0])
# self.assert_(entry3==sch.getEntries()[1])
# self.assert_(entry1.getDuration()==timedelta(minutes=25))
# self.assert_(entry2.getStartDate()==datetime(2004,1,1,10,25, tzinfo=timezone('UTC')))
# self.assert_(entry2.getDuration()==timedelta(minutes=30))
# self.assert_(entry3.getStartDate()==datetime(2004,1,1,10,55, tzinfo=timezone('UTC')))
# self.assert_(entry3.getDuration()==timedelta(minutes=5))
# def testCompact(self):
# from MaKaC.schedule import TimeSchedule
# sDateSch=datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC'))
# eDateSch=datetime(2004, 01, 01, 12, 00, tzinfo=timezone('UTC'))
# schOwner=_ScheduleOwnerWrapper(sDateSch,eDateSch)
# sch=TimeSchedule(schOwner)
# from MaKaC.schedule import TimeSchEntry
# entry1,entry2=IndTimeSchEntry(),IndTimeSchEntry()
# entry3=IndTimeSchEntry()
# entry1.setDuration(0,25)
# entry2.setDuration(0,25)
# entry3.setDuration(0,30)
# sch.addEntry(entry1)
# self.assert_(entry1.getStartDate()==datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC')))
# sch.addEntry(entry2)
# self.assert_(entry2.getStartDate()==datetime(2004, 01, 01, 10, 25, tzinfo=timezone('UTC')))
# sch.addEntry(entry3)
# self.assert_(entry3.getStartDate()==datetime(2004, 01, 01, 10, 50, tzinfo=timezone('UTC')))
# entry1.setStartDate(datetime(2004, 01, 01, 11, 00, tzinfo=timezone('UTC')))
# entry2.setStartDate(datetime(2004, 01, 01, 11, 15, tzinfo=timezone('UTC')))
# entry3.setStartDate(datetime(2004, 01, 01, 11, 25, tzinfo=timezone('UTC')))
# self.assert_(entry1.getStartDate()==datetime(2004, 01, 01, 11, 00, tzinfo=timezone('UTC')))
# self.assert_(entry2.getStartDate()==datetime(2004, 01, 01, 11, 15, tzinfo=timezone('UTC')))
# self.assert_(entry3.getStartDate()==datetime(2004, 01, 01, 11, 25, tzinfo=timezone('UTC')))
# sch.compact()
# self.assert_(entry1.getStartDate()==datetime(2004 ,01, 01, 10, 00, tzinfo=timezone('UTC')))
# self.assert_(entry1.getDuration()==timedelta(minutes=25))
# self.assert_(entry2.getStartDate()==datetime(2004, 01, 01, 10, 25, tzinfo=timezone('UTC')))
# self.assert_(entry2.getDuration()==timedelta(minutes=25))
# self.assert_(entry3.getStartDate()==datetime(2004, 01, 01, 10, 50, tzinfo=timezone('UTC')))
# self.assert_(entry3.getDuration()==timedelta(minutes=30))
def testStartEndDates(self):
from MaKaC.schedule import TimeSchedule
sDateSch,eDateSch=datetime(2004,1,1,10,0, tzinfo=timezone('UTC')),datetime(2004,1,1,12,0, tzinfo=timezone('UTC'))
schOwner=_ScheduleOwnerWrapper(sDateSch,eDateSch)
sch=TimeSchedule(schOwner)
self.assert_(sch.getStartDate()==schOwner.getStartDate())
self.assert_(sch.getEndDate()==schOwner.getEndDate())
schOwner.setStartDate(datetime(2004, 01, 02, 10, 00, tzinfo=timezone('UTC')))
示例5: TestAuthorIndex
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setId [as 别名]
class TestAuthorIndex(unittest.TestCase):
"""Tests the author index
"""
def setUp( self ):
self._creator = Avatar()
self._creator.setId("creator")
self._categ = Category()
self._conf=Conference(self._creator)
self._conf.setId('a')
self._conf.setTimezone('UTC')
self._categ._addConference(self._conf)
def testBasicIndexing(self):
#Tests adding a contribution with some authors already on it
c1=Contribution()
self._conf.addContribution(c1)
auth1,auth2=ContributionParticipation(),ContributionParticipation()
auth1.setFirstName("hector")
auth1.setFamilyName("sanchez sanmartin")
auth1.setEmail("[email protected]")
auth2.setFirstName("jose benito")
auth2.setFamilyName("gonzalez lopez")
auth2.setEmail("[email protected]")
c1.addPrimaryAuthor(auth1)
c1.addPrimaryAuthor(auth2)
idx=self._conf.getAuthorIndex()
self.assert_(auth1 in idx.getParticipations()[1])
self.assert_(len(idx.getParticipations()[1])==1)
self.assert_(auth2 in idx.getParticipations()[0])
self.assert_(len(idx.getParticipations()[0])==1)
c2=Contribution()
self._conf.addContribution(c2)
auth3,auth4=ContributionParticipation(),ContributionParticipation()
auth3.setFirstName("hector")
auth3.setFamilyName("sanchez sanmartin")
auth3.setEmail("[email protected]")
auth4.setFirstName("jose benito")
auth4.setFamilyName("gonzalez lopez2")
auth4.setEmail("[email protected]")
c2.addPrimaryAuthor(auth3)
c2.addPrimaryAuthor(auth4)
#Tests removing a contribution from a conference updates the author
# index correctly
#self.assert_(auth3 in idx.getParticipations()[2])
#self.assert_(len(idx.getParticipations()[2])==2)
#self.assert_(auth4 in idx.getParticipations()[1])
#self.assert_(len(idx.getParticipations()[1])==1)
#self._conf.removeContribution(c2)
#self.assert_(auth1 in idx.getParticipations()[1])
#self.assert_(len(idx.getParticipations()[1])==1)
#self.assert_(auth2 in idx.getParticipations()[0])
#self.assert_(len(idx.getParticipations()[0])==1)
#Tests adding additional authors to a contribution which is already
# included in a conference updates the author index correctly
#auth5=ContributionParticipation()
#auth5.setFirstName("jean-yves")
#auth5.setFamilyName("le meur")
#auth5.setEmail("[email protected]")
#c1.addPrimaryAuthor(auth5)
#self.assert_(auth1 in idx.getParticipations()[2])
#self.assert_(len(idx.getParticipations()[2])==1)
#self.assert_(auth2 in idx.getParticipations()[0])
#self.assert_(len(idx.getParticipations()[0])==1)
#self.assert_(auth5 in idx.getParticipations()[1])
#self.assert_(len(idx.getParticipations()[1])==1)
#Tests removing authors from a contribution which is already
# included in a conference updates the author index correctly
#c1.removePrimaryAuthor(auth5)
#self.assert_(auth1 in idx.getParticipations()[1])
#self.assert_(len(idx.getParticipations()[1])==1)
#self.assert_(auth2 in idx.getParticipations()[0])
#self.assert_(len(idx.getParticipations()[0])==1)
def testChangesInAuthorData(self):
#Checks that changes in the author data updates the author index
# correctly
c1=Contribution()
self._conf.addContribution(c1)
auth1,auth2=ContributionParticipation(),ContributionParticipation()
auth1.setFirstName("zFN")
auth1.setFamilyName("zSN")
auth1.setEmail("zM")
auth2.setFirstName("AFN")
auth2.setFamilyName("ASN")
auth2.setEmail("aM")
c1.addPrimaryAuthor(auth1)
c1.addPrimaryAuthor(auth2)
idx=self._conf.getAuthorIndex()
self.assert_(auth1 in idx.getParticipations()[1])
self.assert_(len(idx.getParticipations()[1])==1)
self.assert_(auth2 in idx.getParticipations()[0])
self.assert_(len(idx.getParticipations()[0])==1)
auth2.setFamilyName("ZZSN")
self.assert_(auth1 in idx.getParticipations()[0])
self.assert_(len(idx.getParticipations()[0])==1)
self.assert_(auth2 in idx.getParticipations()[1])
self.assert_(len(idx.getParticipations()[1])==1)