本文整理汇总了Python中MaKaC.conference.Conference.setDates方法的典型用法代码示例。如果您正苦于以下问题:Python Conference.setDates方法的具体用法?Python Conference.setDates怎么用?Python Conference.setDates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MaKaC.conference.Conference
的用法示例。
在下文中一共展示了Conference.setDates方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestBasicManagement
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setDates [as 别名]
class TestBasicManagement(unittest.TestCase):
"""Tests the basic conference management functions
"""
def setUp( self ):
self._creator=Avatar()
self._creator.setId("creator")
self._conf=Conference(self._creator)
self._conf.setTimezone('UTC')
confTZ = self._conf.getTimezone()
sd = timezone(confTZ).localize(datetime(2000, 1, 1))
sdUTC = sd.astimezone(timezone('UTC'))
ed = timezone(confTZ).localize(datetime(2020, 1, 1))
edUTC = ed.astimezone(timezone('UTC'))
self._conf.setDates(sdUTC,edUTC)
def testAddRemoveSessions(self):
s1,s2=Session(),Session()
self._conf.addSession(s1)
self._conf.addSession(s2)
self.assert_(s1 in self._conf.getSessionList())
self.assert_(s1==self._conf.getSessionById(s1.getId()))
self.assert_(s2 in self._conf.getSessionList())
self.assert_(s2==self._conf.getSessionById(s2.getId()))
self._conf.removeSession(s1)
self.assert_(s1 not in self._conf.getSessionList())
self.assert_(None==self._conf.getSessionById(s1.getId()))
self.assert_(s2 in self._conf.getSessionList())
self.assert_(s2==self._conf.getSessionById(s2.getId()))
c1,c2,c3=Contribution(),Contribution(),Contribution()
self._conf.addSession(s1)
s1.addContribution(c1)
s1.addContribution(c2)
s2.addContribution(c3)
self.assert_(s1 in self._conf.getSessionList())
self.assert_(s1==self._conf.getSessionById(s1.getId()))
self.assert_(s2 in self._conf.getSessionList())
self.assert_(s2==self._conf.getSessionById(s2.getId()))
self.assert_(c1 in self._conf.getContributionList())
self.assert_(c2 in self._conf.getContributionList())
self.assert_(c3 in self._conf.getContributionList())
self.assert_(c1 in s1.getContributionList())
self.assert_(c2 in s1.getContributionList())
self.assert_(c3 in s2.getContributionList())
self._conf.removeSession(s1)
self.assert_(s1 not in self._conf.getSessionList())
self.assert_(s2 in self._conf.getSessionList())
self.assert_(c1 in self._conf.getContributionList())
self.assert_(c2 in self._conf.getContributionList())
self.assert_(c3 in self._conf.getContributionList())
self.assert_(c1 not in s1.getContributionList())
self.assert_(c1.getSession()==None)
self.assert_(c2.getSession()==None)
self.assert_(c2 not in s1.getContributionList())
self.assert_(c3 in s2.getContributionList())
示例2: TestBasicManagement
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setDates [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: TestSubmissionPrivileges
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setDates [as 别名]
class TestSubmissionPrivileges(unittest.TestCase):
"""Tests different scenarios concerning the material submission privileges
"""
def setUp( self ):
self._creator=Avatar()
self._creator.setId("creator")
self._conf=Conference(self._creator)
sd=datetime(2004, 01, 01, 10, 00, tzinfo=timezone("UTC"))
ed=datetime(2004, 01, 05, 10, 00, tzinfo=timezone("UTC"))
self._conf.setDates(sd,ed)
def testBasic(self):
c1=Contribution()
self._conf.addContribution(c1)
av1,av2=Avatar(),Avatar()
av1.setId("1")
av2.setId("2")
self.assert_(not c1.canUserSubmit(av1))
self.assert_(not c1.canUserSubmit(av2))
self.assert_(len(c1.getSubmitterList())==0)
c1.grantSubmission(av1)
self.assert_(c1.canUserSubmit(av1))
self.assert_(not c1.canUserSubmit(av2))
self.assert_(len(c1.getSubmitterList())==1)
self.assert_(av1 in c1.getSubmitterList())
self.assert_(av2 not in c1.getSubmitterList())
c1.revokeSubmission(av2)
self.assert_(c1.canUserSubmit(av1))
self.assert_(not c1.canUserSubmit(av2))
self.assert_(len(c1.getSubmitterList())==1)
self.assert_(av1 in c1.getSubmitterList())
self.assert_(av2 not in c1.getSubmitterList())
c1.revokeSubmission(av1)
self.assert_(not c1.canUserSubmit(av1))
self.assert_(not c1.canUserSubmit(av2))
self.assert_(len(c1.getSubmitterList())==0)
def testAccContrib(self):
#tests that when a contribution comes from an accepted abstract the
# abstract submitters are also granted with submission privileges
# for the contribution
av1=Avatar()
av1.setId("1")
av2=Avatar()
av2.setId("2")
abs=self._conf.getAbstractMgr().newAbstract(av1)
abs.accept(self._creator,None,None)
c=abs.getContribution()
self.assert_(c.canUserSubmit(av1))
self.assert_(not c.canUserSubmit(av2))
c.grantSubmission(av2)
self.assert_(c.canUserSubmit(av1))
self.assert_(c.canUserSubmit(av2))
示例4: TestSchedule
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setDates [as 别名]
class TestSchedule(unittest.TestCase):
"""Tests the schedule management functions
"""
def setUp( self ):
a = Avatar()
a.setId("creator")
self._conf=Conference(a)
self._conf.setTimezone('UTC')
sd=datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC'))
ed=datetime(2004, 01, 05, 10, 00, tzinfo=timezone('UTC'))
self._conf.setDates(datetime(2000, 01, 01, tzinfo=timezone('UTC')),datetime(2020, 01, 01, tzinfo=timezone('UTC')))
示例5: TestModifyConferenceDates
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setDates [as 别名]
class TestModifyConferenceDates(unittest.TestCase):
"""Tests different scenarios which can occur when modifying conference start
and end dates
"""
def setUp(self):
a = Avatar()
a.setId("creator")
self._conf=Conference(a)
self._conf.setTimezone('UTC')
sd=datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC'))
ed=datetime(2004, 01, 05, 10, 00, tzinfo=timezone('UTC'))
self._conf.setDates(sd,ed)
def testSessions(self):
s1=Session()
s1.setDates(datetime(2004, 01, 01, 10, 00, tzinfo=timezone('UTC')),datetime(2004, 01, 01, 12, 00, tzinfo=timezone('UTC')))
示例6: TestWithdrawal
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setDates [as 别名]
class TestWithdrawal(unittest.TestCase):
"""Tests different scenarios concerning the contribution withdrawal
"""
def setUp( self ):
self._creator=Avatar()
self._creator.setId("creator")
self._conf=Conference(self._creator)
self._conf.setTimezone('UTC')
sd=datetime(2004, 01, 01, 10, 00, tzinfo=timezone("UTC"))
ed=datetime(2004, 01, 05, 10, 00, tzinfo=timezone("UTC"))
self._conf.setDates(sd,ed)
def testBasicWithdrawal(self):
c1,c2=Contribution(),Contribution()
auth1,auth2=ContributionParticipation(),ContributionParticipation()
self._conf.addContribution(c1)
self._conf.addContribution(c2)
auth1.setFirstName("a")
auth1.setFamilyName("a")
auth1.setEmail("a")
auth2.setFirstName("b")
auth2.setFamilyName("b")
auth2.setEmail("b")
c1.addPrimaryAuthor(auth1)
c2.addPrimaryAuthor(auth2)
s1=Session()
sd=datetime(2004, 01, 01, 12, 00, tzinfo=timezone("UTC"))
ed=datetime(2004, 01, 01, 19, 00, tzinfo=timezone("UTC"))
s1.setDates(sd,ed)
slot1=SessionSlot(s1)
self._conf.addSession(s1)
s1.addSlot(slot1)
s1.addContribution(c1)
s1.addContribution(c2)
slot1.getSchedule().addEntry(c1.getSchEntry())
slot1.getSchedule().addEntry(c2.getSchEntry())
self.assert_(c1.isScheduled())
self.assert_(c2.isScheduled())
authIdx=self._conf.getAuthorIndex()
self.assert_(auth1 in authIdx.getParticipations()[0])
self.assert_(auth2 in authIdx.getParticipations()[1])
c1.withdraw(self._creator,"test")
self.assert_(not c1.isScheduled())
self.assert_(c2.isScheduled())
self.assert_(auth1 not in authIdx.getParticipations()[0])
self.assert_(auth2 in authIdx.getParticipations()[0])
auth1.setFirstName("aa")
self.assert_(auth1 not in authIdx.getParticipations()[0])
self.assert_(auth2 in authIdx.getParticipations()[0])
auth3,auth4=ContributionParticipation(),ContributionParticipation()
auth3.setFirstName("c")
auth3.setFamilyName("c")
auth3.setEmail("c")
auth4.setFirstName("d")
auth4.setFamilyName("d")
auth4.setEmail("d")
c1.addPrimaryAuthor(auth3)
c2.addPrimaryAuthor(auth4)
self.assert_(auth2 in authIdx.getParticipations()[0])
self.assert_(auth4 in authIdx.getParticipations()[1])
self.assertRaises(MaKaCError,slot1.getSchedule().addEntry,c1.getSchEntry())
示例7: TestBasicManagement
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setDates [as 别名]
class TestBasicManagement(unittest.TestCase):
"""Tests the basic contribution management functions
"""
def setUp( self ):
a = Avatar()
a.setId("creator")
self._conf = Conference( a )
self._conf.setDates(datetime(2000,1,1,tzinfo=timezone('UTC')),datetime(2020,1,1,tzinfo=timezone('UTC')))
def testDates(self):
session1=Session()
#self._conf.setStartDate(datetime(2004,1,1,8,0,tzinfo=timezone('UTC')))
#self._conf.setEndDate(datetime(2005,1,1,8,0,tzinfo=timezone('UTC')))
session1.setStartDate(datetime(2004,2,15,tzinfo=timezone('UTC')))
self.assertRaises(MaKaCError,session1.setEndDate,datetime(2004,2,14,tzinfo=timezone('UTC')))
session1.setEndDate(datetime(2004,2,16,tzinfo=timezone('UTC')))
self.assert_(session1.getStartDate()==datetime(2004,2,15,tzinfo=timezone('UTC')))
self.assert_(session1.getEndDate()==datetime(2004,2,16,tzinfo=timezone('UTC')))
session1.setDates(datetime(2004,2,10,tzinfo=timezone('UTC')),datetime(2004,2,11,tzinfo=timezone('UTC')))
self.assert_(session1.getStartDate()==datetime(2004,2,10,tzinfo=timezone('UTC')))
self.assert_(session1.getEndDate()==datetime(2004,2,11,tzinfo=timezone('UTC')))
session1.setDates(datetime(2004,2,15,tzinfo=timezone('UTC')),datetime(2004,2,16,tzinfo=timezone('UTC')))
self.assert_(session1.getStartDate()==datetime(2004,2,15,tzinfo=timezone('UTC')))
self.assert_(session1.getEndDate()==datetime(2004,2,16,tzinfo=timezone('UTC')))
session1.setDates(datetime(2004,2,14,tzinfo=timezone('UTC')),datetime(2004,2,17,tzinfo=timezone('UTC')))
self.assert_(session1.getStartDate()==datetime(2004,2,14,tzinfo=timezone('UTC')))
self.assert_(session1.getEndDate()==datetime(2004,2,17,tzinfo=timezone('UTC')))
def testBasicAddAndRemove( self ):
session1,session2=Session(),Session()
self._conf.addSession(session1)
self.assert_(self._conf.getSessionById(session1.getId())==session1)
self.assert_(session1 in self._conf.getSessionList())
session1.delete()
self.assert_(session1 not in self._conf.getSessionList())
self.assert_(self._conf.getSessionById(session1.getId())==None)
def testDateModification(self):
self._conf.setDates(datetime(2004,1,1,tzinfo=timezone('UTC')),datetime(2004,1,5,tzinfo=timezone('UTC')))
##checks that a session cannot be added if its dates are outside the
## schedule boundaries
#s1=Session()
#s1.setDates(datetime(2003,12,31,tzinfo=timezone('UTC')),datetime(2004,1,31,tzinfo=timezone('UTC')))
#self.assertRaises(MaKaCError,self._conf.addSession,s1)
#s1.setDates(datetime(2004,1,1,11,0,tzinfo=timezone('UTC')),datetime(2004,1,31,tzinfo=timezone('UTC')))
#self.assertRaises(MaKaCError,self._conf.addSession,s1)
#s1.setDates(datetime(2004,1,1,11,0,tzinfo=timezone('UTC')),datetime(2004,1,4,tzinfo=timezone('UTC')))
#self._conf.addSession(s1)
#self._conf.removeSession(s1)
#self._conf.getSchedule().setDates(datetime(2004,1,2,tzinfo=timezone('UTC')),datetime(2004,1,7,tzinfo=timezone('UTC')))
#s1=Session()
#s1.setDates(datetime(2003,12,31,tzinfo=timezone('UTC')),datetime(2004,1,31,tzinfo=timezone('UTC')))
#self.assertRaises(MaKaCError,self._conf.addSession,s1)
#s1.setDates(datetime(2004,1,1,11,0,tzinfo=timezone('UTC')),datetime(2004,1,31,tzinfo=timezone('UTC')))
#self.assertRaises(MaKaCError,self._conf.addSession,s1)
#s1.setDates(datetime(2004,1,1,11,0,tzinfo=timezone('UTC')),datetime(2004,1,4,tzinfo=timezone('UTC')))
#self.assertRaises(MaKaCError,self._conf.addSession,s1)
#s1.setDates(datetime(2004,1,2,11,0,tzinfo=timezone('UTC')),datetime(2004,1,6,tzinfo=timezone('UTC')))
#self._conf.addSession(s1)
##checks that when modifying the session dates to ones which are outside
## the conference schedule scope is not allowed
#s1.setDates(datetime(2004,1,3,tzinfo=timezone('UTC')),datetime(2004,1,5,tzinfo=timezone('UTC')))
#self.assertRaises(MaKaCError,s1.setDates,datetime(2004,1,3,tzinfo=timezone('UTC')),datetime(2004,1,8,tzinfo=timezone('UTC')))
#self.assertRaises(MaKaCError,s1.setDates,datetime(2005,1,1,11,0,tzinfo=timezone('UTC')),datetime(2004,1,6,tzinfo=timezone('UTC')))
#self.assertRaises(MaKaCError,s1.setDates,datetime(2005,1,1,11,0,tzinfo=timezone('UTC')),datetime(2004,1,8,tzinfo=timezone('UTC')))
def testContributionInclusion(self):
session1,session2=Session(),Session()
self._conf.addSession(session1)
self._conf.addSession(session2)
contrib1=Contribution()
session1.addContribution(contrib1)
self.assert_(self._conf.hasContribution(contrib1))
self.assert_(session1.hasContribution(contrib1))
self.assert_(not session2.hasContribution(contrib1))
session1.removeContribution(contrib1)
session2.addContribution(contrib1)
self.assert_(self._conf.hasContribution(contrib1))
self.assert_(not session1.hasContribution(contrib1))
self.assert_(session2.hasContribution(contrib1))
session2.removeContribution(contrib1)
self.assert_(self._conf.hasContribution(contrib1))
self.assert_(not session1.hasContribution(contrib1))
self.assert_(not session2.hasContribution(contrib1))
def testCoordination(self):
session1,session2,session3=Session(),Session(),Session()
self._conf.addSession(session1)
self._conf.addSession(session2)
c1,c2=Avatar(),Avatar()
c1.setId("1")
c2.setId("2")
session1.addCoordinator(c1)
self.assert_(c1 in session1.getCoordinatorList())
self.assert_(len(session1.getCoordinatorList())==1)
self.assert_(session1.isCoordinator(c1))
self.assert_(not session1.isCoordinator(c2))
self.assert_(not session1.isCoordinator(None))
self.assert_(session1 in self._conf.getCoordinatedSessions(c1))
#.........这里部分代码省略.........
示例8: TestSchedule
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setDates [as 别名]
class TestSchedule(unittest.TestCase):
"""Tests the schedule management functions
"""
def setUp( self ):
from MaKaC.user import Avatar
a = Avatar()
a.setId("creator")
from MaKaC.conference import Conference
self._conf = Conference( a )
self._conf.setTimezone('UTC')
def testTypeSetUp(self):
#test setting up the schedule type of a session works correctly
self._conf.setDates(datetime(2004,1,1,9,0,tzinfo=timezone('UTC')),datetime(2004,1,5,10,0,tzinfo=timezone('UTC')))
session=Session()
session.setStartDate(datetime(2004,1,1,9,0,tzinfo=timezone('UTC')))
session.setDuration(hours=10,minutes=0)
self._conf.addSession(session)
slot1=SessionSlot(session)
session.addSlot(slot1)
c1,c2,c3=Contribution(),Contribution(),Contribution()
session.addContribution(c1)
session.addContribution(c2)
session.addContribution(c3)
slot1.getSchedule().addEntry(c1.getSchEntry())
slot1.getSchedule().addEntry(c2.getSchEntry())
slot1.getSchedule().addEntry(c3.getSchEntry())
self.assert_(c1.getSchEntry()==slot1.getSchedule().getEntries()[0])
self.assert_(c2.getSchEntry()==slot1.getSchedule().getEntries()[1])
self.assert_(c3.getSchEntry()==slot1.getSchedule().getEntries()[2])
self.assert_(session.getScheduleType()=="standard")
self.assert_(slot1.getSchedule().__class__==conference.SlotSchedule)
session.setScheduleType("poster")
self.assert_(session.getScheduleType()=="poster")
self.assert_(slot1.getSchedule().__class__==conference.PosterSlotSchedule)
self.assert_(len(slot1.getSchedule().getEntries())==0)
def testSessionDates(self):
from MaKaC.conference import Session,SessionSlot, Conference
self._conf.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
self._conf.setEndDate(datetime(2004,1,1,15,0,tzinfo=timezone('UTC')))
session1=Session()
session1.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
session1.setEndDate(datetime(2004,1,1,15,0,tzinfo=timezone('UTC')))
self._conf.addSession(session1)
slot1=SessionSlot(session1)
slot1.setDuration(hours=2,minutes=0)
slot1.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
session1.addSlot(slot1)
# ------- SESSIONS -------
# Session start date can not be bigger than the first slot start date
self.assertRaises(MaKaCError, session1.setStartDate, datetime(2004,1,1,12,0,tzinfo=timezone('UTC')))
# Session end date can not be prior than the last slot end date
self.assertRaises(MaKaCError, session1.setEndDate, datetime(2004,1,1,11,0,tzinfo=timezone('UTC')))
# Session duration must be bigger than zero.
self.assertRaises(MaKaCError, session1.setDuration, 0,0)
# Session start date can not be prior than the conference end date
#self.assertRaises(MaKaCError, session1.setStartDate, datetime(2004,1,1,9,0,tzinfo=timezone('UTC')))
# Session end date can not be bigger than the conference end date
#self.assertRaises(MaKaCError, session1.setEndDate, datetime(2004,1,1,15,1,tzinfo=timezone('UTC')))
# Session end date can not be bigger than the conference end date
#self.assertRaises(MaKaCError, session1.setDuration, 6,1)
# ------- SESSION SLOTS -------
self._conf.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
self._conf.setEndDate(datetime(2004,1,1,15,0,tzinfo=timezone('UTC')))
session1.setStartDate(datetime(2004,1,1,10,0,tzinfo=timezone('UTC')))
session1.setEndDate(datetime(2004,1,1,15,0,tzinfo=timezone('UTC')))
# Session slot duration must be bigger than zero.
self.assertRaises(MaKaCError, slot1.setDuration, 0,0,0)
# Forbid to create a slot alogn several days
self._conf.setEndDate(datetime(2005,1,1,15,0,tzinfo=timezone('UTC')))
self.assertRaises(MaKaCError, slot1.setDuration, 1,0,1)
# Slot start date has to be between the session ones
#self.assertRaises(MaKaCError, slot1.setStartDate, datetime(2004,1,1,9,59,tzinfo=timezone('UTC')))
# Slot end date has to be between the session ones
#self.assertRaises(MaKaCError, slot1.setDuration, 0,5,1)
# If the duration is modified and any of the slot entries is affected then an excetpion is raised
c1,c2,c3=Contribution(),Contribution(),Contribution()
session1.addContribution(c1)
session1.addContribution(c2)
session1.addContribution(c3)
c1.setDuration(0,30)
c2.setDuration(0,30)
c3.setDuration(0,30)
from MaKaC.schedule import BreakTimeSchEntry
b1=BreakTimeSchEntry()
slot1.getSchedule().addEntry(c1.getSchEntry())
slot1.getSchedule().addEntry(c2.getSchEntry())
slot1.getSchedule().addEntry(c3.getSchEntry())
self.assertRaises(MaKaCError, slot1.setDuration, 0,1,29)
# Check that the duration of the entries do not overpass the slot duration
slot1.setDuration(hours=1,minutes=30)
#self.assertRaises(MaKaCError,c3.setDuration,0,31)
c3.setDuration(0,30)
slot1.setDuration(hours=2,minutes=0)
slot1.getSchedule().addEntry(b1)
#self.assertRaises(MaKaCError,b1.setDuration,0,31)
#Check that entries start date is not less than owner start date
#.........这里部分代码省略.........
示例9: TestContributionList
# 需要导入模块: from MaKaC.conference import Conference [as 别名]
# 或者: from MaKaC.conference.Conference import setDates [as 别名]
class TestContributionList(unittest.TestCase):
"""Tests the contribution list functions
"""
def setUp( self ):
from MaKaC.user import Avatar
a = Avatar()
a.setId("creator")
from MaKaC.conference import Conference
self._conf=Conference(a)
self._conf.setTimezone('UTC')
self._conf.setDates(datetime(2000,1,1,tzinfo=timezone('UTC')),datetime(2020,1,1,tzinfo=timezone('UTC')))
def testSorting( self ):
from MaKaC.conference import Contribution, ContributionType, Session, Track
from MaKaC.webinterface.common import contribFilters
from MaKaC.common.filters import SimpleFilter
contrib1 = Contribution()
contrib2 = Contribution()
contrib3 = Contribution()
self._conf.addContribution( contrib1 )
self._conf.addContribution( contrib2 )
self._conf.addContribution( contrib3 )
# Sorting by ID
sortingCrit = contribFilters.SortingCriteria( ["number"] )
f = SimpleFilter( None, sortingCrit )
contribList = f.apply(self._conf.getContributionList())
self.assert_( len(contribList) == 3 )
self.assert_( contribList[0] == contrib1 )
self.assert_( contribList[1] == contrib2 )
self.assert_( contribList[2] == contrib3 )
#Sorting by Date
contrib1.setStartDate(datetime(2004, 5, 1, 10, 30,tzinfo=timezone('UTC')))
contrib2.setStartDate(datetime(2003, 5, 1, 10, 30,tzinfo=timezone('UTC')))
sortingCrit = contribFilters.SortingCriteria( ["date"] )
f = SimpleFilter( None, sortingCrit )
contribList = f.apply(self._conf.getContributionList())
self.assert_( len(contribList) == 3 )
self.assert_( contribList[0] == contrib2 )
self.assert_( contribList[1] == contrib1 )
self.assert_( contribList[2] == contrib3 )
# Sorting by Contribution Type
contribType1 = ContributionType("oral presentation", "no description", self._conf)
contribType2 = ContributionType("poster", "no description", self._conf)
contrib1.setType(contribType1)
contrib2.setType(contribType2)
sortingCrit = contribFilters.SortingCriteria( ["type"] )
f = SimpleFilter( None, sortingCrit )
contribList = f.apply(self._conf.getContributionList())
self.assert_( len(contribList) == 3 )
self.assert_( contribList[0] == contrib1 )
self.assert_( contribList[1] == contrib2 )
self.assert_( contribList[2] == contrib3 )
# Sorting by Session
session1 = Session()
self._conf.addSession(session1)
session2 = Session()
self._conf.addSession(session2)
contrib1.setSession(session1)
contrib2.setSession(session2)
sortingCrit = contribFilters.SortingCriteria( ["session"] )
f = SimpleFilter( None, sortingCrit )
contribList = f.apply(self._conf.getContributionList())
self.assert_( len(contribList) == 3 )
self.assert_(contrib1 in contribList)
self.assert_(contrib2 in contribList)
self.assert_(contrib3 in contribList)
# Sorting by Track
track1 = Track()
track1.setTitle("3")
track1.setConference(self._conf)
track2 = Track()
track2.setTitle("1")
track2.setConference(self._conf)
contrib1.setTrack(track1)
contrib2.setTrack(track2)
sortingCrit = contribFilters.SortingCriteria( ["track"] )
f = SimpleFilter( None, sortingCrit )
contribList = f.apply(self._conf.getContributionList())
self.assert_( len(contribList) == 3 )
self.assert_( contribList[0] == contrib2 )
self.assert_( contribList[1] == contrib1 )
self.assert_( contribList[2] == contrib3 )