Пример #1
0
 def registration_forms(self):
     if not self.event.has_feature('registration'):
         return []
     registration_forms = self.event.registration_forms
     return [
         serialize_registration_form(regform)
         for regform in registration_forms
     ]
Пример #2
0
def serialize_principal(principal):
    from indico.modules.categories.util import serialize_category_role
    if principal.principal_type == PrincipalType.email:
        return serialize_email_principal(principal)
    elif principal.principal_type == PrincipalType.network:
        return serialize_ip_network_group(principal)
    elif principal.principal_type == PrincipalType.user:
        return serialize_user(principal)
    elif principal.principal_type == PrincipalType.event_role:
        return serialize_event_role(principal)
    elif principal.principal_type == PrincipalType.category_role:
        return serialize_category_role(principal)
    elif principal.principal_type == PrincipalType.registration_form:
        return serialize_registration_form(principal)
    elif principal.is_group:
        return serialize_group(principal)
    else:
        raise ValueError(f'Invalid principal: {principal} ({principal.principal_type})')
Пример #3
0
def serialize_principal(principal):
    from indico.modules.categories.util import serialize_category_role
    if principal.principal_type == PrincipalType.email:
        return serialize_email_principal(principal)
    elif principal.principal_type == PrincipalType.network:
        return IPNetworkGroupSchema().dump(principal)
    elif principal.principal_type == PrincipalType.user:
        return serialize_user(principal)
    elif principal.principal_type == PrincipalType.event_role:
        return serialize_event_role(principal)
    elif principal.principal_type == PrincipalType.category_role:
        return serialize_category_role(principal)
    elif principal.principal_type == PrincipalType.registration_form:
        return serialize_registration_form(principal)
    elif principal.principal_type in (PrincipalType.local_group,
                                      PrincipalType.multipass_group):
        return serialize_group(principal)
    else:
        raise ValueError(
            f'Invalid principal: {principal} ({principal.principal_type})')
Пример #4
0
 def registration_forms(self):
     registration_forms = self.event.registration_forms
     return [
         serialize_registration_form(regform)
         for regform in registration_forms
     ]