diff libervia/server/server.py @ 1199:b300eaec53b6

server: don't raise error anymore if themes_dir is invalid or legacy blog can't be created: legacy blog will be entirely removed with 0.8 release, and themes_dir is only used by it. This patch limit troubles with this old code by not raising an error anymore if option is wrong or if the legacy blog can't be created. fix 317
author Goffi <goffi@goffi.org>
date Tue, 09 Jul 2019 20:20:46 +0200
parents a15ac511390c
children 3f791fbc1643
line wrap: on
line diff
--- a/libervia/server/server.py	Sat Jul 06 14:11:10 2019 +0200
+++ b/libervia/server/server.py	Tue Jul 09 20:20:46 2019 +0200
@@ -2026,8 +2026,15 @@
         self.putChildSAT("upload_avatar", _upload_avatar)
 
         # static pages
-        self.putChildSAT("blog_legacy", MicroBlog(self))
-        self.putChildSAT(C.THEMES_URL, ProtectedFile(self.themes_dir))
+        # FIXME: legacy blog must be removed entirely in 0.8
+        try:
+            micro_blog = MicroBlog(self)
+        except Exception as e:
+            log.warning(u"Can't load legacy microblog, ignoring it: {reason}".format(
+                reason=e))
+        else:
+            self.putChildSAT("blog_legacy", micro_blog)
+            self.putChildSAT(C.THEMES_URL, ProtectedFile(self.themes_dir))
 
         # websocket
         if self.options["connection_type"] in ("https", "both"):