   "Turn an integer into a key suitable for fetching from mongodb."
   [id]
   keyword str int)
+
+(defn trim-code [code]
+  (when code (.trim code)))
 
 (defn code-length [code]
   (count (remove #(Character/isWhitespace %)

  (POST "/problem/reject" [id]
    (reject-problem (Integer. id) "We didn't like your problem."))
  (POST "/problem/:id" [id code]
    (static-run-code (Integer. id) code))
  (POST "/rest/problem/:id" [id code]
     {:headers {"Content-Type" "application/json"}}
     (rest-run-code (Integer. id) code))
  (GET "/problems/rss" [] (create-feed
                           "4Clojure: Recent Problems"
                           "http://4clojure.com/problems"

    (catch Throwable t {:message (.getMessage t), :url *url*
                        :num-tests-passed 0})))

(defn static-run-code [id code]
  (session/flash-put! :code code)
  (let [{:keys [message url num-tests-passed]}
        (binding [*url* (str *url* "#prob-desc")]
          (run-code id code))]
    (session/flash-put! :failing-test num-tests-passed)
    (flash-msg message url)))

