diff --git a/pastiche.scm b/pastiche.scm index 2900823..4ebd957 100644 --- a/pastiche.scm +++ b/pastiche.scm @@ -263,65 +263,66 @@ (navigation-links))) title: "Pastiche: the Chicken Scheme pasting service") - (define-page "paste" - (lambda () - (let ((paste-title "Untitled paste")) - (with-request-variables ((nick (nonempty as-string)) - (title (nonempty as-string)) - paste - id) - (html-page + (define (handle-pastes) + (let ((paste-title "Untitled paste")) + (with-request-variables ((nick (nonempty as-string)) + (title (nonempty as-string)) + paste + id) + (html-page + (++ + (
"Hi " nick ", thanks for pasting: " ( title) ( align: "center") "Your paste can be reached with this url: " (link url url))))))
+ (cond ((fetch-paste id)
+ => (lambda (p)
+ (set! paste-title (third (last p)))
(++
- ( "Hi " nick ", thanks for pasting: " ( title) ( align: "center") "Your paste can be reached with this url: " (link url url))))))
- (cond ((fetch-paste id)
- => (lambda (p)
- (set! paste-title (third (last p)))
- (++
- (format-all-snippets p)
- (
))
+ ( align: "center" "Thanks for your paste!")
- (
))
- ( align: "center"
- (link (++ base-path "?id=" id
- ";annotate=t") "Annotate this paste!"))))))
- (else (bail-out "Could not find a paste with this id:" id)))))
- (navigation-links))
- css: (page-css)
- title: paste-title))))
- no-template: #t)
+ (format-all-snippets p)
+ (
align: "center"
+ (link (++ base-path "?id=" id
+ ";annotate=t") "Annotate this paste!"))))))
+ (else (bail-out "Could not find a paste with this id:" id)))))
+ (navigation-links))
+ css: (page-css)
+ title: paste-title))))
+
+ (define-page "paste" handle-pastes method: 'GET)
+ (define-page "paste" handle-pastes method: 'POST)
(define-page "raw"
(lambda ()