X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=scripts%2Flib%2Fcocanwiki_pages.ml;h=70eb525607791d71f6b12591de5ab2c69489d0f8;hb=2fb2827e6f832d9a7987043c480cfe2288a881bc;hp=31bb2510faaac9fa52dcdd0338a13e48e2975c39;hpb=32144d49593fc38678f907580095b98d7cd58ee9;p=cocanwiki.git diff --git a/scripts/lib/cocanwiki_pages.ml b/scripts/lib/cocanwiki_pages.ml index 31bb251..70eb525 100644 --- a/scripts/lib/cocanwiki_pages.ml +++ b/scripts/lib/cocanwiki_pages.ml @@ -1,7 +1,7 @@ (* COCANWIKI - a wiki written in Objective CAML. * Written by Richard W.M. Jones . * Copyright (C) 2004 Merjis Ltd. - * $Id: cocanwiki_pages.ml,v 1.7 2006/07/27 16:46:55 rich Exp $ + * $Id: cocanwiki_pages.ml,v 1.8 2006/08/04 12:20:07 rich Exp $ * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +26,10 @@ open Cocanwiki_strings type pt = Page of string | Title of string +type section = + string option * string option * string option * string + (* (sectionname, divname, jsgo, content) *) + type model = { id : int32; (* Original page ID (0 = none). *) pt : pt; (* Page of title (only used if id=0) *) @@ -34,12 +38,11 @@ type model = { (* NB. Don't call this 'contents' because that clashes with the * Pervasives.contents fields of the ref type. *) - contents_ : (string option * string option * string option * string) list; - (* (sectionname, divname, jsgo, content) for each section. *) + contents_ : section list; } exception SaveURLError -exception SaveConflict of int32 * int32 * string * string +exception SaveConflict of int32 * int32 * string * string option let new_page pt = let description = @@ -183,10 +186,8 @@ let save_page r dbh hostid ?user model = let edited = max_id <> model_id in - if edited then ( - let css = match css with None -> "" | Some css -> css in - raise (SaveConflict (max_id, model_id, url, css)) - ); + if edited then + raise (SaveConflict (max_id, model_id, url, css)); (* Defer the pages_redirect_cn constraint because that would * temporarily fail on the next UPDATE.