コード例 #1
0
def process_field_data(_registration, flat):
    """Helper to generate field data for one registration"""
    one_res = build_registration_api_data(_registration)
    ## local migration code
    if 'datatitle' in one_res:
        del one_res['datatitle']
    one_res['data'] = all_fields(_registration, flat)
    one_res['price'] = _registration.price
    if _registration.state is not None:
        one_res['state'] = _registration.state.title
    return one_res
コード例 #2
0
    def _process_PATCH(self):
        if request.json is None:
            raise BadRequest('Expected JSON payload')

        invalid_fields = request.json.viewkeys() - {'checked_in'}
        if invalid_fields:
            raise BadRequest("Invalid fields: {}".format(', '.join(invalid_fields)))

        if 'checked_in' in request.json:
            self._registration.checked_in = bool(request.json['checked_in'])

        return jsonify(build_registration_api_data(self._registration))
コード例 #3
0
ファイル: api.py プロジェクト: MichelCordeiro/indico
    def _process_PATCH(self):
        if request.json is None:
            raise BadRequest('Expected JSON payload')

        invalid_fields = request.json.viewkeys() - {'checked_in'}
        if invalid_fields:
            raise BadRequest("Invalid fields: {}".format(', '.join(invalid_fields)))

        if 'checked_in' in request.json:
            self._registration.checked_in = bool(request.json['checked_in'])

        return jsonify(build_registration_api_data(self._registration))
コード例 #4
0
 def build_registration_data(self, reg):
     data = build_registration_api_data(reg)
     data['data_by_id'] = {}
     data['data_by_name'] = {}
     for field_id, item in reg.data_by_field.iteritems():
         data['data_by_id'][field_id] = item.friendly_data
     for item in reg.data:
         fieldname = slugify(item.field_data.field.title)
         fieldparent = slugify(item.field_data.field.parent.title)
         data['data_by_name']['{}_{}'.format(
             fieldparent, fieldname)] = item.friendly_data
     return data
コード例 #5
0
ファイル: api.py プロジェクト: javfg/indico
    def _process_PATCH(self):
        if request.json is None:
            raise BadRequest('Expected JSON payload')

        invalid_fields = request.json.keys() - {'checked_in'}
        if invalid_fields:
            raise BadRequest('Invalid fields: {}'.format(', '.join(invalid_fields)))

        if 'checked_in' in request.json:
            if self._registration.state not in (RegistrationState.complete, RegistrationState.unpaid):
                raise BadRequest('This registration cannot be marked as checked-in')
            self._registration.checked_in = bool(request.json['checked_in'])
            signals.event.registration_checkin_updated.send(self._registration)

        return jsonify(build_registration_api_data(self._registration))
コード例 #6
0
 def _process_GET(self):
     return jsonify(build_registration_api_data(self._registration))
コード例 #7
0
ファイル: api.py プロジェクト: indico/indico
 def _process_GET(self):
     return jsonify(build_registration_api_data(self._registration))