function stringlengths 11 56k | repo_name stringlengths 5 60 | features list |
|---|---|---|
def desactiveCFA(self):
self._activated = False | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def addAuthorizedSubmitter(self, av):
try:
if self._authorizedSubmitter:
pass
except AttributeError:
self._authorizedSubmitter = PersistentList()
if not av in self._authorizedSubmitter:
self._authorizedSubmitter.append(av) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getCFAStatus(self):
return self._activated | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def isActive(self):
return self._activated | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getStartSubmissionDate(self):
return timezone(self.getTimezone()).localize(self._submissionStartDate) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getEndSubmissionDate(self):
return timezone(self.getTimezone()).localize(self._submissionEndDate) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getModificationDeadline(self):
"""Returns the deadline for modifications on the submitted abstracts.
"""
try:
if self._modifDeadline:
pass
except AttributeError, e:
self._modifDeadline = None
if self._modifDeadline is not None:
return timezone(self.getTimezone()).localize(self._modifDeadline)
else:
return None | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def inModificationPeriod(self, date=None):
"""Tells whether is possible to modify a submitted abstract in a
certain date.
"""
if date is None:
date = nowutc()
if not self.getModificationDeadline():
return True
return date <= self.getModificationDeadline() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def setAnnouncement(self, newAnnouncement):
self._announcement = newAnnouncement.strip() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def newAbstract(self, av, **data):
"""Creates a new abstract under this manager
"""
from indico.modules.events.contributions import Contribution
new_abstract = self._new_abstract(self.getConference().as_event)
# sanity checks to avoid collisions
assert str(new_abstract.id) not in self._abstracts
assert not Contribution.query.with_parent(new_abstract.event_new).filter_by(friendly_id=new_abstract.id).count()
a = Abstract(self, str(new_abstract.friendly_id), av, **data)
self._abstracts[str(new_abstract.friendly_id)] = a
for auth in a.getPrimaryAuthorList():
self.indexAuthor(auth)
return a | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def removeAbstract(self, abstract):
if self._abstracts.has_key(abstract.getId()):
#for auth in abstract.getPrimaryAuthorList():
# self.unindexAuthor(auth)
# * Remove dependencies with another abstracts:
# - If it's an accepted abstract-->remove abstract from contribution
if isinstance(abstract.getCurrentStatus(), AbstractStatusAccepted):
raise NoReportError(_("Cannot remove an accepted abstract before removing the contribution linked to it"))
# If it's a withdrawn abstract-->remove abstract from contribution
if abstract.as_new.contribution:
raise NoReportError(_("Cannot remove the abstract before removing the contribution linked to it"))
for abs in self._abstracts.values():
if abs != abstract:
st = abs.getCurrentStatus()
if isinstance(st, AbstractStatusDuplicated):
#if the abstract to delete is the orginal in another "duplicated", change status to submitted
if st.getOriginal() == abstract:
abs.setCurrentStatus(AbstractStatusSubmitted(abs))
elif isinstance(st, AbstractStatusMerged):
#if the abstract to delete is the target one in another "merged", change status to submitted
if st.getTargetAbstract() == abstract:
abs.setCurrentStatus(AbstractStatusSubmitted(abs))
#unindex participations!!!
self.unregisterParticipation(abstract.getSubmitter())
self._remove_abstract(abstract)
del self._abstracts[abstract.getId()]
abstract.delete() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getAbstractList(self):
return self._abstracts.values() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def registerParticipation(self, p):
self._participationIdx.index(p) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getAbstractListForAvatar(self, av):
try:
if self._participationIdx:
pass
except AttributeError, e:
self._participationIdx = self._partipationIdx
self._partipationIdx = None
res = []
for participation in self._participationIdx.getParticipationList(av):
abstract = participation.getAbstract()
if abstract is not None and abstract.isSubmitter(av):
if abstract not in res:
res.append(abstract)
return res | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getNotificationTplList(self):
try:
if self._notifTpls:
pass
except AttributeError:
self._notifTpls = IOBTree()
try:
if self._notifTplsOrder:
pass
except AttributeError:
self._notifTplsOrder = PersistentList()
for tpl in self._notifTpls.values():
self._notifTplsOrder.append(tpl)
return self._notifTplsOrder | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def removeNotificationTpl(self, tpl):
try:
if self._notifTpls:
pass
except AttributeError:
self._notifTpls = IOBTree()
try:
if self._notifTplsOrder:
pass
except AttributeError:
self._notifTplsOrder = PersistentList()
for tpl in self._notifTpls.values():
self._notifTplsOrder.append(tpl)
if tpl.getOwner() != self or not self._notifTpls.has_key(int(tpl.getId())):
return
del self._notifTpls[int(tpl.getId())]
self._notifTplsOrder.remove(tpl)
tpl.includeInOwner(None, tpl.getId()) # We don't change the id for
# recovery purposes.
tpl.delete() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getNotificationTplById(self, id):
try:
if self._notifTpls:
pass
except AttributeError:
self._notifTpls = IOBTree()
return self._notifTpls.get(int(id), None) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def moveUpNotifTpl(self, tpl):
"""
"""
try:
if self._notifTplsOrder:
pass
except AttributeError:
self._notifTplsOrder = PersistentList()
for tpl in self._notifTpls.values():
self._notifTplsOrder.append(tpl)
if tpl not in self._notifTplsOrder:
return
idx = self._notifTplsOrder.index(tpl)
if idx == 0:
return
self._notifTplsOrder.remove(tpl)
self._notifTplsOrder.insert(idx-1, tpl) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def indexAuthor(self, auth):
a = auth.getAbstract()
if a.isPrimaryAuthor(auth):
self._getPrimAuthIndex().index(auth)
self._getAuthEmailIndex().index(auth) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _getPrimAuthIndex(self):
try:
if self._primAuthIdx:
pass
except AttributeError:
self._primAuthIdx = _PrimAuthIdx(self)
return self._primAuthIdx | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getAbstractsMatchingAuth(self, query, onlyPrimary=True):
if str(query).strip() == "":
return self.getAbstractList()
res = self._getPrimAuthIndex().match(query)
return [self.getAbstractById(id) for id in res] | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def hasEnabledAbstractField(self, key):
return self.getAbstractFieldsMgr().hasActiveField(key) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def setSubmissionNotification(self, sn):
self._submissionNotification = sn | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def removeAnswersOfQuestion(self, questionId):
''' Remove a question results for each abstract '''
for abs in self.getAbstractList():
abs.removeAnswersOfQuestion(questionId) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def __init__(self):
self._toList = PersistentList()
self._ccList = PersistentList() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getToList(self):
return self._toList | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def addToList(self, to):
self._toList.append(to) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getCCList(self):
return self._ccList | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def addCCList(self, cc):
self._ccList.append(cc) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def clone(self):
nsn = SubmissionNotification()
for i in self.getToList():
nsn.addToList(i)
for i in self.getCCList():
nsn.addCCList(i)
return nsn | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def __init__(self, res, content=""):
self._abstract = None
self._id = ""
self._responsible = res
self._content = ""
self._creationDate = nowutc()
self._modificationDate = nowutc() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def includeInAbstract(self, abstract, id):
self._abstract = abstract
self._id = id | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def recover(self):
TrashCanManager().remove(self) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getResponsible(self):
return self._responsible | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getId(self):
return self._id | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def setContent(self, newContent):
self._content = newContent
self._notifyModification() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getModificationDate(self):
return self._modificationDate | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def canUserModify(self, user):
abstract = self.getAbstract()
conf = abstract.getConference()
return self.getResponsible() == user and \
(abstract.canUserModify(user) or \
len(conf.getConference().getCoordinatedTracks(user)) > 0) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def __init__(self, owner, id, submitter, **abstractData):
self._setOwner( owner )
self._setId( id )
self._title = ""
self._authorGen = Counter()
self._authors = OOBTree()
self._primaryAuthors = PersistentList()
self._coAuthors = PersistentList()
self._speakers = PersistentList()
self._tracks = OOBTree()
self._contribTypes = PersistentList( [""] )
self._setSubmissionDate( nowutc() )
self._modificationDate = nowutc()
self._currentStatus = AbstractStatusSubmitted( self )
self._trackAcceptances = OOBTree()
self._trackRejections = OOBTree()
self._trackReallocations = OOBTree()
self._trackJudgementsHistorical={}
self._comments = ""
self._contribution = None
self._intCommentGen=Counter()
self._intComments=PersistentList()
self._mergeFromList = PersistentList()
self._notifLog=NotificationLog(self)
self._submitter=None
self._setSubmitter( submitter )
self._rating = None # It needs to be none to avoid the case of having the same value as the lowest value in the judgement
self._attachments = {}
self._attachmentsCounter = Counter() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def clone(self, conference, abstractId):
# abstractId - internal in abstract manager of the conference
abs = Abstract(conference.getAbstractMgr(), abstractId, self.getSubmitter().getAvatar())
abs.setTitle(self.getTitle())
for key in self.getFields().keys():
abs.setField(key,self.getField(key))
abs.setComments(self.getComments())
abs._setSubmissionDate(self.getSubmissionDate())
abs._modificationDate = self.getModificationDate()
# Cloning of primary- and coauthors
# if an author is also a speaker, an appropriate object will be
# appended also to the speaker list
for pa in self.getPrimaryAuthorList() :
npa = abs.newPrimaryAuthor(**(pa.getData()))
if self.isSpeaker(pa) :
abs.addSpeaker(npa)
for ca in self.getCoAuthorList() :
nca = abs.newCoAuthor(**(ca.getData()))
if self.isSpeaker(ca) :
abs.addSpeaker(nca)
# Cloning of speakers
# only those, who are not authors :
for sp in self.getSpeakerList() :
if not self.isAuthor(sp) :
abs.addSpeaker(sp.clone())
abs.setSubmitter(self.getSubmitter().getAvatar())
abs.as_new.type = self.as_new.type
# the track, to which the abstract belongs to
# legacy list implementation
for tr in self.getTrackList() :
for newtrack in conference.getTrackList():
if newtrack.getTitle() == tr.getTitle() :
abs.addTrack(newtrack)
# overall abstract status (accepted / rejected)
abs._currentStatus = self._currentStatus.clone(abs)
abs.as_new.accepted_track_id = self.as_new.track.id if self.as_new.track else None
abs.as_new.accepted_type = self.as_new.type
for ta in self.getTrackAcceptanceList() :
for newtrack in conference.getTrackList():
if newtrack.getTitle() == ta.getTrack().getTitle() :
newta = ta.clone(newtrack)
abs._addTrackAcceptance(newta)
abs._addTrackJudgementToHistorical(newta)
for trj in self.getTrackRejections().values() :
for newtrack in conference.getTrackList():
if newtrack.getTitle() == trj.getTrack().getTitle() :
newtrj = trj.clone(newtrack)
abs._addTrackRejection(newtrj)
abs._addTrackJudgementToHistorical(newtrj)
for trl in self.getTrackReallocations().values() :
for newtrack in conference.getTrackList():
if newtrack.getTitle() == trl.getTrack().getTitle() :
newtrl = trl.clone(newtrack)
abs._addTrackReallocation(newtrl)
abs._addTrackJudgementToHistorical(newtrl)
# Cloning materials
for f in self.getAttachments().values():
newFile = f.clone(abs, protection=False)
abs.__addFile(newFile)
return abs | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getMergeFromList(self):
try:
return self._mergeFromList
except AttributeError:
self._mergeFromList = PersistentList()
return self._mergeFromList | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def removeMergeFromAbstract(self, abstract):
try:
if self._mergeFromList:
pass
except AttributeError:
self._mergeFromList = PersistentList()
if abstract in self._mergeFromList:
self._mergeFromList.remove(abstract) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def setComments(self, comments):
self._comments = comments | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def saveFiles(self, files):
cfg = Config.getInstance()
from MaKaC.conference import LocalFile
for fileUploaded in files:
if fileUploaded.filename:
# create a temp file
tempPath = cfg.getUploadedFilesTempDir()
tempFileName = tempfile.mkstemp(suffix="IndicoAbstract.tmp", dir=tempPath)[1]
f = open(tempFileName, "wb")
f.write(fileUploaded.file.read() )
f.close()
file = LocalFile()
file.setFileName(fileUploaded.filename)
file.setFilePath(tempFileName)
file.setOwner(self)
file.setId(self._getAttachmentsCounter())
self.__addFile(file) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _deleteFile(self, key):
file = self.getAttachments()[key]
file.delete()
del self.getAttachments()[key]
self._notifyModification() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getOwner( self ):
return self._owner | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getId(self):
return self._id | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def setModificationDate(self, dt = None):
if dt:
self._modificationDate = dt
else:
self._modificationDate = nowutc() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getModificationDate( self ):
return self._modificationDate | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def recoverSubmitter(self, subm):
if not subm:
raise MaKaCError( _("An abstract must have a submitter"))
if self._submitter:
self.getOwner().unregisterParticipation( self._submitter )
self._submitter.delete()
self._submitter = subm
self._submitter.setAbstract(self)
self.getOwner().registerParticipation( self._submitter )
subm.recover()
self._notifyModification() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getSubmitter( self ):
return self._submitter | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def setTitle(self, title):
self._title = title.strip()
self._notifyModification() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def title(self):
return self._title | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getConference( self ):
mgr = self.getOwner()
return mgr.getOwner() if mgr else None | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _removeAuthor(self,part):
if not self.isAuthor(part):
return
part.delete()
del self._authors[part.getId()] | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getAuthorList( self ):
return self._authors.values() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def clearAuthors( self ):
self.clearPrimaryAuthors()
self.clearCoAuthors()
self._notifyModification() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def isPrimaryAuthor( self, part ):
return part in self._primaryAuthors | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getPrimaryAuthorEmailList(self, lower=False):
emailList = []
for pAuthor in self.getPrimaryAuthorList():
emailList.append(pAuthor.getEmail().lower() if lower else pAuthor.getEmail())
return emailList | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _addPrimaryAuthor( self, part ):
if not self.isAuthor( part ):
raise MaKaCError( _("The participation you want to set as primary author is not an author of the abstract"))
if part in self._primaryAuthors:
return
self._primaryAuthors.append( part )
self.getOwner().indexAuthor(part) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def recoverPrimaryAuthor(self, auth):
self._authors[ auth.getId() ] = auth
auth.setAbstract(self)
self._addPrimaryAuthor(auth)
auth.recover()
self._notifyModification() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _comp_CoAuthors(self):
try:
if self._coAuthors!=None:
return
except AttributeError:
self._coAuthors=PersistentList()
for auth in self._authors.values():
if not self.isPrimaryAuthor(auth):
self._addCoAuthor(auth) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getCoAuthorList( self ):
self._comp_CoAuthors()
return self._coAuthors | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def clearCoAuthors(self):
while len(self._coAuthors)>0:
self._removeCoAuthor(self._coAuthors[0])
self._notifyModification() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _removeCoAuthor(self,part):
if not self.isCoAuthor(part):
return
if self.isSpeaker(part):
self.removeSpeaker(part)
self._coAuthors.remove(part)
self._removeAuthor(part) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def addSpeaker( self, part ):
if not self.isAuthor( part ):
raise MaKaCError( _("The participation you want to set as speaker is not an author of the abstract"))
if part in self._speakers:
return
self._speakers.append( part )
self._notifyModification() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def clearSpeakers( self ):
while len(self.getSpeakerList()) > 0:
self.removeSpeaker(self.getSpeakerList()[0])
self._speakers = PersistentList() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def isSpeaker( self, part ):
return part in self._speakers | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def addTrack( self, track ):
self._changeTracksImpl()
if not self._tracks.has_key( track.getId() ):
self._addTrack( track )
self.getCurrentStatus().update() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def removeTrack( self, track ):
if self._tracks.has_key( track.getId() ):
self._removeTrack( track )
self.getCurrentStatus().update()
if isinstance(self.getCurrentStatus(), AbstractStatusAccepted):
self.getCurrentStatus()._setTrack(None) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getTrackList( self ):
self._changeTracksImpl()
return self._tracks.values() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def hasTrack( self, track ):
self._changeTracksImpl()
return self._tracks.has_key( track.getId() ) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def clearTracks( self ):
self._changeTracksImpl()
while len(self.getTrackList())>0:
track = self.getTrackList()[0]
self._removeTrack( track )
self.getCurrentStatus().update() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def isProposedForTrack( self, track ):
return self._tracks.has_key( track.getId() ) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getLocator(self):
loc = self.getConference().getLocator()
loc["abstractId"] = self.getId()
return loc | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def canAuthorAccess(self, user):
if user is None:
return False
el = self.getCoAuthorEmailList(True)+self.getPrimaryAuthorEmailList(True)
for e in user.getEmails():
if e.lower() in el:
return True
return False | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def canAccess(self, aw):
#if the conference is protected, then only allowed AW can access
return self.isAllowedToAccess(aw.getUser()) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def canModify(self, aw_or_user):
if hasattr(aw_or_user, 'getUser'):
aw_or_user = aw_or_user.getUser()
return self.canUserModify(aw_or_user) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getModifKey(self):
return "" | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getAccessController(self):
return self.getConference().getAccessController() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def delete(self):
if self._owner:
self.getOwner().unregisterParticipation(self._submitter)
self._submitter.getUser().unlinkTo(self, "submitter")
self._submitter.delete()
self._submitter = None
self.clearAuthors()
self.clearSpeakers()
self.clearTracks()
owner = self._owner
self._owner = None
owner.removeAbstract(self)
self.setCurrentStatus(AbstractStatusNone(self))
TrashCanManager().add(self) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getCurrentStatus(self):
try:
if self._currentStatus:
pass
except AttributeError, e:
self._currentStatus = AbstractStatusSubmitted(self)
return self._currentStatus | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def accept(self, responsible, destTrack, type, comments="", session=None):
"""
"""
self.getCurrentStatus().accept(responsible, destTrack, type, comments)
# add the abstract to the track for which it has been accepted so it
# is visible for it.
if destTrack is not None:
destTrack.addAbstract(self)
contrib = contribution_from_abstract(self, session)
self.as_new.contribution = contrib | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _cmpByDate(self, tj1, tj2):
return cmp(tj1.getDate(), tj2.getDate()) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getJudgementHistoryByTrack(self, track):
id = "notrack"
if track is not None:
id = track.getId()
if self.getTrackJudgementsHistorical().has_key(id):
return self.getTrackJudgementsHistorical()[id]
return [] | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _removeTrackAcceptance( self, track ):
"""
"""
if self.getTrackAcceptances().has_key( track.getId() ):
del self.getTrackAcceptances()[ track.getId() ] | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _removeTrackRejection( self, track ):
"""
"""
if self.getTrackRejections().has_key( track.getId() ):
del self.getTrackRejections()[ track.getId() ] | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _removeTrackReallocation( self, track ):
"""
"""
if self.getTrackReallocations().has_key( track.getId() ):
del self.getTrackReallocations()[ track.getId() ] | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _clearTrackRejections( self ):
while len(self.getTrackRejections().values())>0:
t = self.getTrackRejections().values()[0].getTrack()
self._removeTrackRejection( t ) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def _clearTrackReallocations( self ):
while len(self.getTrackReallocations().values())>0:
t = self.getTrackReallocations().values()[0].getTrack()
self._removeTrackReallocation(t) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def proposeToAccept( self, responsible, track, contribType, comment="", answers=[] ):
"""
"""
# the proposal has to be done for a track
if track is None:
raise MaKaCError( _("You have to choose a track in order to do the proposal. If there are not tracks to select, please change the track assignment of the abstract"))
#We check the track for which the abstract is proposed to be accepted
# is in the current abstract
if not self.isProposedForTrack( track ):
raise MaKaCError( _("Cannot propose to accept an abstract which is not proposed for the specified track"))
# check if there is a previous judgement of this author in for this abstract in this track
self._removePreviousJud(responsible, track)
# Create the new judgement
jud = AbstractAcceptance(self, track, responsible, contribType, answers)
self._add_judgment(jud)
jud.setComment( comment )
self._addTrackAcceptance( jud )
# Update the rating of the abstract
self.updateRating()
#We trigger the state transition
self.getCurrentStatus().proposeToAccept() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def proposeForOtherTracks( self, responsible, track, comment, propTracks, answers=[] ):
"""
"""
#We check the track which proposes to allocate the abstract is in the
# current abstract
if not self.isProposedForTrack( track ):
raise MaKaCError( _("Cannot propose to reallocate an abstract which is not proposed for the specified track"))
# check if there is a previous judgement of this author in for this abstract in this track
self._removePreviousJud(responsible, track)
#We keep the track judgement
jud = AbstractReallocation(self, track, responsible, propTracks, answers)
jud.setComment( comment )
self._addTrackReallocation( jud )
#We add the proposed tracks to the abstract
for track in propTracks:
self._addTrack( track )
#We trigger the state transition
self.getCurrentStatus().proposeToReallocate()
# Update the rating of the abstract
self.updateRating() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def recover( self ):
"""Puts a withdrawn abstract back in the list of submitted abstracts.
HAS NOTHING TO DO WITH THE RECOVERY PROCESS...
"""
#we must clear any track judgement
#self._clearTrackAcceptances()
#self._clearTrackRejections()
#self._clearTrackReallocations()
self.getCurrentStatus().recover() #status change
#if succeeded we must reset the submission date
self._setSubmissionDate( nowutc() )
self._notifyModification() | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getTrackAcceptances( self ):
try:
if self._trackAcceptances:
pass
except AttributeError, e:
self._trackAcceptances = OOBTree()
return self._trackAcceptances | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getNumProposedToAccept( self ):
return len( intersection( self._tracks, self.getTrackAcceptances() ) ) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getNumProposedToReject( self ):
return len( intersection( self._tracks, self.getTrackRejections() ) ) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getNumProposedToReallocate( self ):
return len( intersection( self._tracks, self.getTrackReallocations() ) ) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def getReallocationTargetedList( self, track ):
#XXX: not optimal
res = []
for r in self.getTrackReallocations().values():
if track in r.getProposedTrackList():
res.append( r )
return res | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def addIntComment(self,newComment):
try:
if self._intComments:
pass
except AttributeError:
self._intComments=PersistentList()
try:
if self._intCommentsGen:
pass
except AttributeError:
self._intCommentsGen=Counter()
if newComment in self._intComments:
return
id = newComment.getId()
if id == "":
id = self._authorGen.newCount()
newComment.includeInAbstract(self, id)
self._intComments.append(newComment) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
def clearIntCommentList(self):
while len(self.getIntCommentList()) > 0:
self.removeIntComment(self.getIntCommentList()[0]) | belokop/indico_bare | [
1,
1,
1,
5,
1465204236
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.