Commit fa68bc93 authored by Stephane Glondu's avatar Stephane Glondu

Simplify languages_of_string

parent 8372ef28
......@@ -234,4 +234,4 @@ let string_of_languages xs =
String.concat " " (get_languages xs)
let languages_of_string x =
Some (Pcre.split x)
Pcre.split x
......@@ -99,4 +99,4 @@ val split_identity : string -> string * string
val available_languages : string list
val get_languages : string list option -> string list
val string_of_languages : string list option -> string
val languages_of_string : string -> string list option
val languages_of_string : string -> string list
......@@ -474,22 +474,21 @@ let () =
with_setup_election uuid (fun se ->
let langs = languages_of_string languages in
match langs with
| None -> assert false
| Some [] ->
| [] ->
let service = preapply election_setup uuid in
T.generic_page ~title:"Error" ~service
"You must select at least one language!" () >>= Html5.send
| Some ls ->
| _ :: _ ->
let unavailable =
List.filter (fun x ->
not (List.mem x available_languages)
) ls
) langs
in
match unavailable with
| [] ->
se.se_metadata <- {
se.se_metadata with
e_languages = langs
e_languages = Some langs
};
redir_preapply election_setup uuid ()
| l :: _ ->
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment