Browse Source

added check for negative numbers in user playlist page numbers

master
Wesley Kerfoot 12 years ago
parent
commit
8f02595a60
  1. 7
      links.rkt
  2. 6
      playlist_server.rkt

7
links.rkt

@ -111,6 +111,11 @@
username
(+ 1 page-n))))
;; Message when we get to the beginning/end of a user's list
(define (no-more username)
(format "<html><body>No more left<br></br><a href=\"http://localhost:8080/~a?p=1\">Beginning</a></body></html>"
username))
;(retrieve-videos "slowbeef")
(provide get-category retrieve-videos)
(provide get-category retrieve-videos no-more)

6
playlist_server.rkt

@ -39,10 +39,12 @@
(string->xexpr
(let [(username (path/param-path (car (url-path (request-uri req)))))
(page-n (hash-ref (list->hash (url-query (request-uri req))) 'p))]
(check-cache (user-cache-params username
(match (positive? (string->number page-n))
[#t (check-cache (user-cache-params username
page-n)
(λ () (retrieve-videos username (string->number page-n)))
identity)))))
identity)]
[_ (no-more username)])))))
;; Adds a new resource to the lazyplay queue
(define (add-name req)