Changeset 14853 in project


Ignore:
Timestamp:
06/01/09 13:41:41 (10 years ago)
Author:
azul
Message:

Fix bug in invocation to sleep which caused crashes. Added some asserts. Added some tests for svnwiki-email-parse. Added a bit more information in the page that shows the results of a subscription request (it now shows the page to which addresses have been subscribed).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/3/svnwiki-mail/trunk/svnwiki-mail.scm

    r14698 r14853  
    124124
    125125(define (subscribe-address env address)
     126  (assert (and 'subscribe-address address))
    126127  (let-from-environment env (path)
    127128    (let ((http-address (getenv "REMOTE_ADDR")))
     
    168169(define (send-mail env to writer)
    169170  (when (> (+ *last-mail-time* *seconds-between-mails*) (current-seconds))
    170     (sleep (- *seconds-between-mails* (- (current-seconds) *last-mail-time*))))
     171    (sleep (inexact->exact (ceiling (- *seconds-between-mails* (- (current-seconds) *last-mail-time*))))))
    171172  (format (current-error-port) "Sending mail to: ~A~%" to)
    172173  (set! *last-mail-time* (current-seconds))
     
    246247
    247248(define (send-confirmation-mail env address)
     249  (assert (and 'send-confirmation-mail address))
    248250  (let-from-environment env (static-url path path-in)
    249251    (send-no-reply-mail env address
     
    287289      (stream->html-ul (stream-reverse (list->stream s))))))
    288290
     291(test-group svnwiki-email-parse
     292  (test (stream->string (svnwiki-email-parse (string->stream ""))) "")
     293  (test (stream->string (svnwiki-email-parse (string->stream "   "))) "")
     294  (test (stream->string (svnwiki-email-parse (string->stream "foo@bar.com"))) "foo@bar.com")
     295  (test (stream->string (svnwiki-email-parse (string->stream "  foo@bar.com  "))) "foo@bar.com"))
     296
    289297(define (svnwiki-email-parse email)
    290298  (stream-reverse (stream-drop-while char-whitespace?
     
    324332          (h2 "Subscription results")
    325333          (mail-request-subscribe-show-list
    326             "The following addresses were successfully subscribed:"
     334            (html-stream
     335              "The following addresses were successfully subscribed to page "
     336              (i target)
     337              ":")
    327338            successful)
    328339          (mail-request-subscribe-show-list
Note: See TracChangeset for help on using the changeset viewer.