示例#1
0
 def _clone_tracks(self, new_event):
     attrs = get_simple_column_attrs(Track) | {'abstract_reviewers', 'conveners'}
     for old_track in self.old_event.tracks:
         track = Track()
         track.populate_from_attrs(old_track, attrs)
         new_event.tracks.append(track)
         self._track_map[old_track] = track
示例#2
0
def create_track(event, data):
    track = Track(event=event)
    track.populate_from_dict(data)
    db.session.flush()
    logger.info('Track %r created by %r', track, session.user)
    event.log(EventLogRealm.management, EventLogKind.positive, 'Tracks',
              'Track "{}" has been created.'.format(track.title), session.user)
    return track
示例#3
0
def create_track(event, data):
    track = Track(event=event)
    track.populate_from_dict(data)
    db.session.flush()
    logger.info('Track %r created by %r', track, session.user)
    event.log(EventLogRealm.management, EventLogKind.positive, 'Tracks',
              'Track "{}" has been created.'.format(track.title), session.user)
    return track
示例#4
0
 def _clone_tracks(self, new_event):
     attrs = get_simple_column_attrs(Track) | {
         'abstract_reviewers', 'conveners'
     }
     for old_track in self.old_event.tracks:
         track = Track()
         track.populate_from_attrs(old_track, attrs)
         new_event.tracks.append(track)
         self._track_map[old_track] = track
示例#5
0
 def _migrate_tracks(self):
     program = convert_to_unicode(
         getattr(self.conf, 'programDescription', ''))
     if program:
         track_settings.set_multi(self.event, {
             'program_render_mode': RenderMode.html,
             'program': program
         })
     for pos, old_track in enumerate(self.conf.program, 1):
         track = Track(title=convert_to_unicode(old_track.title),
                       description=convert_to_unicode(
                           old_track.description),
                       code=convert_to_unicode(old_track._code),
                       position=pos,
                       abstract_reviewers=set())
         self.importer.print_info(
             cformat('%{white!}Track:%{reset} {}').format(track.title))
         for coordinator in old_track._coordinators:
             user = self._user_from_legacy(coordinator)
             if user is None:
                 continue
             self.importer.print_info(
                 cformat('%{blue!}  Coordinator:%{reset} {}').format(user))
             track.conveners.add(user)
             track.abstract_reviewers.add(user)
             self.event.update_principal(
                 user,
                 add_roles={'abstract_reviewer', 'track_convener'},
                 quiet=True)
         self.track_map[old_track] = track
         self.track_map_by_id[int(old_track.id)] = track
         self.event.tracks.append(track)
示例#6
0
def create_mock_abstract(event):
    """Create a mock abstract that can be used in previews.

    Brace for geek references.
    """
    User = namedtuple('Author', ['first_name', 'last_name', 'title', 'full_name'])
    Track = namedtuple('Track', ['title'])
    Session = namedtuple('Session', ['title'])
    ContributionType = namedtuple('ContributionType', ['name'])
    Contribution = namedtuple('Contribution', ['title', 'track', 'session', 'type', 'locator'])
    Abstract = namedtuple('Abstract', ['friendly_id', 'title', 'event_new', 'submitter', 'contribution',
                                       'primary_authors', 'secondary_authors', 'locator', 'judgment_comment',
                                       'accepted_track', 'accepted_contrib_type', 'state', 'merged_into'])

    englert = User(full_name="Fran\xe7ois Englert", first_name="Fran\xe7ois", last_name="Englert", title="Prof.")
    brout = User(full_name="Robert Brout", first_name="Robert", last_name="Brout", title="Prof.")
    guralnik = User(full_name="Gerald Guralnik", first_name="Gerald", last_name="Guralnik", title="Prof.")
    hagen = User(full_name="Carl Hagen", first_name="Carl", last_name="Hagen", title="Prof.")
    kibble = User(full_name="Tom Kibble", first_name="Tom", last_name="Kibble", title="Prof.")
    higgs = User(full_name="Peter Higgs", first_name="Peter", last_name="Higgs", title="Prof.")

    track = Track(title=_("Higgs Fields"))
    session = Session(title=_("Higgs Fields Posters"))
    contribution_type = ContributionType(name=_("Poster"))
    contribution = Contribution(title="Broken Symmetry and the Mass of Gauge Vector Mesons",
                                track=track,
                                session=session,
                                type=contribution_type,
                                locator={'confId': -314, 'contrib_id': 1234})

    target_abstract = Abstract(friendly_id=315,
                               title="Broken Symmetry",
                               accepted_track=track,
                               accepted_contrib_type=contribution_type,
                               event_new=event,
                               submitter=brout,
                               state=AbstractState.accepted,
                               contribution=contribution,
                               primary_authors=[englert, brout],
                               secondary_authors=[guralnik, hagen, kibble, higgs],
                               locator={'confId': -314, 'abstract_id': 1235},
                               judgment_comment='Vague but interesting!',
                               merged_into=None)

    abstract = Abstract(friendly_id=314,
                        title="Broken Symmetry and the Mass of Gauge Vector Mesons",
                        accepted_track=track,
                        accepted_contrib_type=contribution_type,
                        event_new=event,
                        submitter=brout,
                        state=AbstractState.accepted,
                        contribution=contribution,
                        primary_authors=[englert, brout],
                        secondary_authors=[guralnik, hagen, kibble, higgs],
                        locator={'confId': -314, 'abstract_id': 1234},
                        judgment_comment='Vague but interesting!',
                        merged_into=target_abstract)

    return abstract
示例#7
0
 def _get_contribution_track_updates(self, track_id):
     updates = {}
     if track_id is None:
         updates['track_id'] = None
     else:
         track = Track.get(track_id)
         if not track:
             raise BadRequest('Invalid track id')
         if track_id != self.contrib.track_id:
             updates['track_id'] = track_id
     return updates
示例#8
0
 def _get_contribution_track_updates(self, track_id):
     updates = {}
     if track_id is None:
         updates['track_id'] = None
     else:
         track = Track.get(track_id)
         if not track:
             raise BadRequest('Invalid track id')
         if track_id != self.contrib.track_id:
             updates['track_id'] = track_id
     return updates
示例#9
0
 def _clone_tracks(self, new_event):
     attrs = get_simple_column_attrs(Track)
     for old_track in self.old_event.tracks:
         track = Track()
         track.populate_from_attrs(old_track, attrs)
         track.acl_entries = clone_principals(TrackPrincipal, old_track.acl_entries)
         track.track_group = self._track_group_map.get(old_track.track_group, None)
         new_event.tracks.append(track)
         self._track_map[old_track] = track
示例#10
0
 def _process_args(self):
     RHAbstractBase._process_args(self)
     self.track = Track.get_one(request.view_args['track_id'])
示例#11
0
 def _process_args(self):
     RHAbstractsBase._process_args(self)
     self.track = Track.get_one(request.view_args['track_id'])
     self.list_generator = AbstractListGeneratorDisplay(event=self.event, track=self.track)
示例#12
0
 def _create(event):
     track = Track(title='Dummy Track', event=event)
     db.session.add(track)
     db.session.flush()
     return track
示例#13
0
 def _process_args(self):
     RHManageTracksBase._process_args(self)
     self.track = Track.get_one(request.view_args['track_id'])
示例#14
0
 def _checkParams(self, params):
     RHManageTracksBase._checkParams(self, params)
     self.track = Track.get_one(request.view_args['track_id'])
示例#15
0
 def _checkParams(self, params):
     RHAbstractBase._checkParams(self, params)
     self.track = Track.get_one(request.view_args['track_id'])
示例#16
0
 def _checkParams(self, params):
     RHAbstractsBase._checkParams(self, params)
     self.track = Track.get_one(request.view_args['track_id'])
     self.list_generator = AbstractListGeneratorDisplay(
         event=self.event_new, track=self.track)
示例#17
0
 def _checkParams(self, params):
     RHAbstractsBase._checkParams(self, params)
     self.track = Track.get_one(request.view_args['track_id'])
     self.list_generator = AbstractListGeneratorDisplay(event=self.event_new, track=self.track)
示例#18
0
def create_mock_abstract(event):
    """Create a mock abstract that can be used in previews.

    Brace for geek references.
    """
    User = namedtuple('Author', ['first_name', 'last_name', 'title', 'full_name'])
    Track = namedtuple('Track', ['title'])
    Session = namedtuple('Session', ['title'])
    ContributionType = namedtuple('ContributionType', ['name'])
    Contribution = namedtuple('Contribution', ['title', 'track', 'session', 'type', 'locator'])
    Abstract = namedtuple('Abstract', ['friendly_id', 'title', 'event', 'submitter', 'contribution',
                                       'primary_authors', 'secondary_authors', 'locator', 'judgment_comment',
                                       'accepted_track', 'accepted_contrib_type', 'state', 'merged_into'])

    class _MockLocator(dict):
        def __init__(self, locator, **sublocators):
            super().__init__(locator)
            self._sublocators = sublocators

        def __getattr__(self, attr):
            try:
                return self._sublocators[attr]
            except KeyError:
                raise AttributeError

    englert = User(full_name='Fran\xe7ois Englert', first_name='Fran\xe7ois', last_name='Englert', title='Prof.')
    brout = User(full_name='Robert Brout', first_name='Robert', last_name='Brout', title='Prof.')
    guralnik = User(full_name='Gerald Guralnik', first_name='Gerald', last_name='Guralnik', title='Prof.')
    hagen = User(full_name='Carl Hagen', first_name='Carl', last_name='Hagen', title='Prof.')
    kibble = User(full_name='Tom Kibble', first_name='Tom', last_name='Kibble', title='Prof.')
    higgs = User(full_name='Peter Higgs', first_name='Peter', last_name='Higgs', title='Prof.')

    track = Track(title='Higgs Fields')
    session = Session(title='Higgs Fields Posters')
    contribution_type = ContributionType(name='Poster')
    contribution = Contribution(title='Broken Symmetry and the Mass of Gauge Vector Mesons',
                                track=track,
                                session=session,
                                type=contribution_type,
                                locator={'event_id': -314, 'contrib_id': 1234})

    target_abstract = Abstract(friendly_id=315,
                               title='Broken Symmetry',
                               accepted_track=track,
                               accepted_contrib_type=contribution_type,
                               event=event,
                               submitter=brout,
                               state=AbstractState.accepted,
                               contribution=contribution,
                               primary_authors=[englert, brout],
                               secondary_authors=[guralnik, hagen, kibble, higgs],
                               locator=_MockLocator({'event_id': -314, 'abstract_id': 1235},
                                                    token={'event_id': -314,
                                                           'uuid': '12345678-9abc-def0-1234-56789abcdef0'}),
                               judgment_comment='Vague but interesting!',
                               merged_into=None)

    abstract = Abstract(friendly_id=314,
                        title='Broken Symmetry and the Mass of Gauge Vector Mesons',
                        accepted_track=track,
                        accepted_contrib_type=contribution_type,
                        event=event,
                        submitter=brout,
                        state=AbstractState.accepted,
                        contribution=contribution,
                        primary_authors=[englert, brout],
                        secondary_authors=[guralnik, hagen, kibble, higgs],
                        locator=_MockLocator({'event_id': -314, 'abstract_id': 1234},
                                             token={'event_id': -314, 'uuid': '12345678-9abc-def0-1234-56789abcdef0'}),
                        judgment_comment='Vague but interesting!',
                        merged_into=target_abstract)

    return abstract
示例#19
0
 def _process_args(self):
     RHAbstractBase._process_args(self)
     self.track = Track.get_one(request.view_args['track_id'])
示例#20
0
 def _process_args(self):
     RHAbstractsBase._process_args(self)
     self.track = Track.get_one(request.view_args['track_id'])
     self.list_generator = AbstractListGeneratorDisplay(event=self.event, track=self.track)
示例#21
0
 def _process_args(self):
     RHManageTracksBase._process_args(self)
     self.track = Track.get_one(request.view_args['track_id'])