Exemple #1
0
 def _process(self):
     description_settings = abstracts_settings.get(self.event, 'description_settings')
     form = AbstractContentSettingsForm(obj=FormDefaults(description_settings))
     if form.validate_on_submit():
         abstracts_settings.set(self.event, 'description_settings', form.data)
         return jsonify_data(flash=False)
     return jsonify_form(form)
Exemple #2
0
 def open(self):
     if self.has_ended:
         abstracts_settings.set_multi(self.event, {
             'end_dt': None,
             'modification_end_dt': None
         })
     else:
         abstracts_settings.set(self.event, 'start_dt', now_utc(False))
Exemple #3
0
 def open(self):
     if self.has_ended:
         abstracts_settings.set_multi(self.event, {
             'end_dt': None,
             'modification_end_dt': None
         })
     else:
         abstracts_settings.set(self.event, 'start_dt', now_utc(False))
Exemple #4
0
    def _migrate_contribution_fields(self):
        pos = 0

        try:
            afm = self.amgr._abstractFieldsMgr
        except AttributeError:
            return

        content_field = None
        for field in afm._fields:
            # it may happen that there is a second 'content' field (old version schemas)
            # in that case, let's use the first one as description and keep the second one as a field
            if field._id == 'content' and not content_field:
                content_field = field
            else:
                pos += 1
                self._migrate_contribution_field(field, pos)

        if not content_field:
            self.print_warning('%[yellow!]Event has no content field!%[reset]')
            return

        def _positive_or_none(value):
            try:
                value = int(value)
            except (TypeError, ValueError):
                return None
            return value if value > 0 else None

        limitation = getattr(content_field, '_limitation', 'chars')
        settings = {
            'is_active':
            bool(content_field._active),
            'is_required':
            bool(content_field._isMandatory),
            'max_words':
            _positive_or_none(content_field._maxLength)
            if limitation == 'words' else None,
            'max_length':
            _positive_or_none(content_field._maxLength)
            if limitation == 'chars' else None
        }
        if settings != abstracts_settings.defaults['description_settings']:
            abstracts_settings.set(self.event, 'description_settings',
                                   settings)
Exemple #5
0
 def close(self):
     now = now_utc(False)
     abstracts_settings.set(self.event, 'end_dt', now)
     if not self.has_started:
         abstracts_settings.set(self.event, 'start_dt', now)
Exemple #6
0
 def close(self):
     now = now_utc(False)
     abstracts_settings.set(self.event, "end_dt", now)
     if not self.has_started:
         abstracts_settings.set(self.event_new, "start_dt", now)
Exemple #7
0
 def open(self):
     if self.has_ended:
         abstracts_settings.set_multi(self.event, {"end_dt": None, "modification_end_dt": None})
     else:
         abstracts_settings.set(self.event, "start_dt", now_utc(False))