Changeset 617c7f in indico
- Timestamp:
- 02/07/11 18:42:49 (2 years ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, d9941f8582b36b24821a11ea5ba16fda6a457fb1
- Children:
- 3f6b20
- Parents:
- 2ed6e4
- git-author:
- Pedro Ferreira <jose.pedro.ferreira@…> (02/04/11 16:08:23)
- git-committer:
- Pedro Ferreira <jose.pedro.ferreira@…> (02/07/11 18:42:49)
- File:
-
- 1 edited
-
bin/utils/syncFromAbstractToContribs.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
bin/utils/syncFromAbstractToContribs.py
rbdd862 r617c7f 19 19 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. 20 20 21 """ 22 Synchronizes contributions with the corresponding abstracts 23 """ 24 25 26 import sys 21 27 from MaKaC.common import DBMgr 22 28 from MaKaC.conference import ConferenceHolder, ContributionParticipation 23 29 from MaKaC.review import AbstractStatusAccepted 24 30 25 conferenceId=""26 31 27 DBMgr.getInstance().startRequest() 28 conf=ConferenceHolder().getById(conferenceId) 29 counter=[] 30 if conf is None: 31 print "Error fetching conference" 32 else: 33 for abstract in conf.getAbstractMgr().getAbstractList(): 34 if isinstance(abstract.getCurrentStatus(), AbstractStatusAccepted): 35 contrib=abstract.getContribution() 36 contrib.setTitle( abstract.getTitle() ) 37 contrib.setDescription( abstract.getContent() ) 38 contrib.setSummary( abstract.getSummary() ) 39 contrib.setTrack( abstract.getCurrentStatus().getTrack() ) 40 contrib.setType( abstract.getCurrentStatus().getType() ) 41 for auth1 in contrib.getPrimaryAuthorList()[:]: 42 contrib.removePrimaryAuthor(auth1) 43 for auth2 in contrib.getCoAuthorList()[:]: 44 contrib.removeCoAuthor(auth2) 45 for auth3 in contrib.getSpeakerList()[:]: 46 contrib.removeSpeaker(auth3) 47 for auth in abstract.getAuthorList(): 48 c_auth = ContributionParticipation() 49 contrib._setAuthorValuesFromAbstract( c_auth, auth ) 50 if abstract.isPrimaryAuthor( auth ): 51 contrib.addPrimaryAuthor( c_auth ) 52 else: 53 contrib.addCoAuthor( c_auth ) 54 if abstract.isSpeaker( auth ): 55 contrib.addSpeaker( c_auth ) 56 # TODO: remove the previous submitter...how??? 57 contrib._grantSubmission(contrib.getAbstract().getSubmitter().getUser()) 58 counter.append(contrib.getId()) 59 DBMgr.getInstance().endRequest() 60 print "contribs ids:%s"%counter 61 print "" 62 print "%s contribs sync"%(len(counter)) 32 def sync(confId): 33 DBMgr.getInstance().startRequest() 34 conf = ConferenceHolder().getById(confId) 35 counter = [] 63 36 37 if conf is None: 38 raise Exception("Error fetching conference") 39 else: 40 for abstract in conf.getAbstractMgr().getAbstractList(): 41 if isinstance(abstract.getCurrentStatus(), AbstractStatusAccepted): 42 contrib = abstract.getContribution() 43 contrib.setTitle(abstract.getTitle()) 44 contrib.setDescription(abstract.getField('content')) 45 contrib.setField('summary', abstract.getField('summary')) 46 contrib.setTrack(abstract.getCurrentStatus().getTrack()) 47 contrib.setType(abstract.getCurrentStatus().getType()) 48 49 for auth1 in contrib.getPrimaryAuthorList()[:]: 50 contrib.removePrimaryAuthor(auth1) 51 for auth2 in contrib.getCoAuthorList()[:]: 52 contrib.removeCoAuthor(auth2) 53 for auth3 in contrib.getSpeakerList()[:]: 54 contrib.removeSpeaker(auth3) 55 for auth in abstract.getAuthorList(): 56 c_auth = ContributionParticipation() 57 contrib._setAuthorValuesFromAbstract(c_auth, auth) 58 if abstract.isPrimaryAuthor(auth): 59 contrib.addPrimaryAuthor(c_auth) 60 else: 61 contrib.addCoAuthor(c_auth) 62 if abstract.isSpeaker(auth): 63 contrib.addSpeaker(c_auth) 64 65 # TODO: remove the previous submitter...how??? 66 submitter = contrib.getAbstract().getSubmitter().getUser() 67 contrib._grantSubmission(submitter) 68 counter.append(contrib.getId()) 69 70 DBMgr.getInstance().endRequest() 71 print "%s contributions synchronized (%s)" % (len(counter), 72 ', '.join(counter)) 73 74 if __name__ == '__main__': 75 76 if len(sys.argv) == 2: 77 sync(sys.argv[1]) 78 sys.exit(0) 79 else: 80 print "Usage: %s [conf_id]" % sys.argv[0] 81 sys.exit(1)
Note: See TracChangeset
for help on using the changeset viewer.
