本文整理汇总了Python中MaKaC.user.Avatar类的典型用法代码示例。如果您正苦于以下问题:Python Avatar类的具体用法?Python Avatar怎么用?Python Avatar使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Avatar类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testTplConditions
def testTplConditions(self):
# test adding and removing conditions to templates
from MaKaC.review import NotificationTemplate
tpl1 = NotificationTemplate()
tpl2 = NotificationTemplate()
absMgr = self._conf.getAbstractMgr()
absMgr.addNotificationTpl(tpl1)
absMgr.addNotificationTpl(tpl2)
from MaKaC.review import NotifTplCondAccepted, NotifTplCondRejected
cond1 = NotifTplCondAccepted(contribType=self._contribTypeOral)
cond2 = NotifTplCondRejected()
tpl1.addCondition(cond1)
tpl2.addCondition(cond2)
from MaKaC.user import Avatar
submitter = Avatar()
submitter.setId("submitter")
abs1 = absMgr.newAbstract(submitter)
tplRes = absMgr.getNotifTplForAbstract(abs1)
self.assert_(tplRes is None)
abs1.accept(submitter, self._track1, self._contribTypeOral)
self.assert_(absMgr.getNotifTplForAbstract(abs1) == tpl1)
abs2 = absMgr.newAbstract(submitter)
abs2.accept(submitter, self._track1, self._contribTypePoster)
self.assert_(not absMgr.getNotifTplForAbstract(abs2))
abs3 = absMgr.newAbstract(submitter)
abs3.reject(submitter)
self.assert_(absMgr.getNotifTplForAbstract(abs3) == tpl2)
示例2: testTplCondAccNoneTrack
def testTplCondAccNoneTrack(self):
# test different possibilities when a condition has been stablished for
# a notif tpl on none track
from MaKaC.review import NotificationTemplate
tpl1 = NotificationTemplate()
absMgr = self._conf.getAbstractMgr()
absMgr.addNotificationTpl(tpl1)
from MaKaC.review import NotifTplCondAccepted
cond1 = NotifTplCondAccepted(track=None, contribType=self._contribTypeOral)
tpl1.addCondition(cond1)
from MaKaC.user import Avatar
submitter = Avatar()
submitter.setId("submitter")
abs1 = absMgr.newAbstract(submitter)
abs1.accept(submitter, self._track1, self._contribTypeOral)
self.assert_(absMgr.getNotifTplForAbstract(abs1) is None)
abs2 = absMgr.newAbstract(submitter)
abs2.accept(submitter, self._track1, self._contribTypePoster)
self.assert_(absMgr.getNotifTplForAbstract(abs2) is None)
abs3 = absMgr.newAbstract(submitter)
abs3.accept(submitter, None, self._contribTypeOral)
self.assert_(absMgr.getNotifTplForAbstract(abs3) == tpl1)
示例3: testBasic
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)
示例4: setUp
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")))
示例5: setUp
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')
示例6: setUp
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)
示例7: setUp
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')))
示例8: testAddTC
def testAddTC( self ):
from MaKaC.user import Avatar
tc1 = Avatar()
tc1.setId( "tc1" )
self._track1.addCoordinator( tc1 )
self.assert_( len(self._track1.getCoordinatorList()) == 1 )
self.assert_( tc1 in self._track1.getCoordinatorList() )
self.assert_( self._track1 in self._conf.getCoordinatedTracks( tc1 ) )
示例9: setUp
def setUp( self ):
from MaKaC.user import Avatar
cr = Avatar()
cr.setId( "creator" )
from MaKaC.conference import Conference, Track
self._conf = Conference( cr )
self._track1 = Track()
self._track1.setId( "1" )
self._conf.addTrack( self._track1 )
示例10: setUp
def setUp( self ):
a = Avatar()
a.setId("creator")
self._conf = ConferenceFacade( a )
self._conf.setId('a')
self._conf.setTimezone('UTC')
self._conf.setDates(datetime(2009, 9, 21, 16, 0 ,0, tzinfo=timezone("UTC")), datetime(2009, 9, 21, 19, 0 ,0, tzinfo=timezone("UTC")))
示例11: TestBasicManagement
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())
示例12: testSimpleUnidexing
def testSimpleUnidexing( self ):
#check that unindexing works properly
from MaKaC.user import Avatar
av = Avatar()
av.setId( "1" ) #the index needs the avatar to be uniquely identified
from MaKaC.conference import Track
t = Track()
t.setId( "1" )
self._idx.indexCoordinator( av , t )
self._idx.unindexCoordinator( av, t )
self.assert_( len(self._idx.getTracks( av )) == 0 )
示例13: testSimpleIndexing
def testSimpleIndexing( self ):
#adding a simple object to the index
from MaKaC.user import Avatar
av = Avatar()
av.setId( "1" ) #the index needs the avatar to be uniquely identified
from MaKaC.conference import Track
t = Track()
t.setId( "1" )
self._idx.indexCoordinator( av , t )
self.assert_( len(self._idx.getTracks( av )) == 1 )
self.assert_( t in self._idx.getTracks( av ) )
示例14: setUp
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')
示例15: TestContributionSubmitterIndex
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))