summaryrefslogtreecommitdiff
path: root/src/utils.clj
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils.clj')
-rwxr-xr-xsrc/utils.clj20
1 files changed, 11 insertions, 9 deletions
diff --git a/src/utils.clj b/src/utils.clj
index 04b870f..fbdefda 100755
--- a/src/utils.clj
+++ b/src/utils.clj
@@ -259,16 +259,18 @@
(def template-group (new StringTemplateGroup "dumpfm" "template"))
(.setRefreshInterval template-group 3)
-; TODO: handle exception, clean-up template setting
(defn fetch-template [template session]
- (let [st (.getInstanceOf template-group template)]
- (if (session :nick)
- (do (.setAttribute st "user_email" (session :email))
- (.setAttribute st "user_nick" (session :nick))
- (if (non-empty-string? (session :avatar))
- (.setAttribute st "user_avatar" (session :avatar)))
- (.setAttribute st "isadmin" (session :is_admin))))
- st))
+ (try
+ (let [st (.getInstanceOf template-group template)]
+ (if (session :nick)
+ (doto st
+ (.setAttribute "user_email" (session :email))
+ (.setAttribute "user_nick" (session :nick))
+ (.setAttribute "user_avatar" (if (non-empty-string? (session :avatar))
+ (session :avatar) nil))
+ (.setAttribute "isadmin" (session :is_admin)))
+ st))
+ (catch Exception e nil)))
(defn fetch-template-fragment [template]
(.getInstanceOf template-group template))