 
 
 
+

    [storemi.session :as sess]
    [storemi.models.story :as st]
    [storemi.urlfor :as url]
    [storemi.routes.policies :refer
     [enforce-story
      enforce-user

          (fn [request]
            (:script (st/story-match-by request)))))

(defn wrap-parse-script [handler]
  (fn [request]
    (let [script (get-in request [:params :script])
          script (clojure.string/replace script "\r" "")
          data (js/parse-script script)
          request (-> request
                      (assoc-in [:params :script] script)
                      (assoc-in [:params :data] data))]
      (handler request))))

;; TODO: GET, POST and others actually can take a 
;; function directly instead of an expresssion.
;; Thus, rewrite to obliterate redundancies.
