Removed visit count from view.
[microbotany.git] / water.scm
1 ;; Water garden
2 ;;
3
4 (lambda (uri)
5   (import
6     (chicken condition)
7     (chicken file)
8     uri-common)
9   (for-each eval (with-input-from-file "garden.scm" read-list))
10   (let ((query (uri-query uri)))
11     (if (null? query)
12         (begin
13           (print "=> register.scm Please register first."))
14         (let ((hash (symbol->string (caar query))))
15           (condition-case
16               (let* ((g (with-input-from-file (make-pathname "accounts" hash) read)))
17                 (water-garden! g)
18                 (with-output-to-file (make-pathname "accounts" hash)
19                   (lambda ()
20                     (write g)))
21                 (redirect-permanent (update-uri uri
22                                                 path: '(/ "microbotany" "view.scm")
23                                                 query: `((,hash . #t)))))
24             (o (exn)
25                (print "This garden no longer exists.\n\n"
26                       "=> register.scm Register to create another.")))))))
27