comparison src/twisted/plugins/libervia_server.py @ 704:5319110a862c

server_side: static blog uses the default template
author souliane <souliane@mailoo.org>
date Thu, 04 Jun 2015 12:39:27 +0200
parents 2a4e071633f7
children bf562fb9c273
comparison
equal deleted inserted replaced
703:1a19ee7d8d8a 704:5319110a862c
50 raise ValueError("%(given)s not in %(expected)s" % {'given': value, 'expected': str(allowed_values)}) 50 raise ValueError("%(given)s not in %(expected)s" % {'given': value, 'expected': str(allowed_values)})
51 return value 51 return value
52 52
53 def coerceDataDir(value): # called from Libervia.OPT_PARAMETERS 53 def coerceDataDir(value): # called from Libervia.OPT_PARAMETERS
54 html = os.path.join(value, C.HTML_DIR) 54 html = os.path.join(value, C.HTML_DIR)
55 if not os.path.isfile(os.path.join(html, 'libervia.html')): 55 if not os.path.isfile(os.path.join(html, C.LIBERVIA_MAIN_PAGE)):
56 raise ValueError("%s is not a Libervia's browser HTML directory" % os.path.realpath(html)) 56 raise ValueError("%s is not a Libervia's browser HTML directory" % os.path.realpath(html))
57 server_css = os.path.join(value, C.SERVER_CSS_DIR) 57 themes_dir = os.path.join(value, C.THEMES_DIR)
58 if not os.path.isfile(os.path.join(server_css, 'blog.css')): 58 if not os.path.isfile(os.path.join(themes_dir, 'default/index.html')):
59 raise ValueError("%s is not a Libervia's server data directory" % os.path.realpath(server_css)) 59 raise ValueError("%s is not a Libervia's server data directory" % os.path.realpath(themes_dir))
60 return value 60 return value
61 61
62 DATA_DIR_DEFAULT = '' 62 DATA_DIR_DEFAULT = ''
63 OPT_PARAMETERS_BOTH = [['connection_type', 't', 'https', _(u"'http', 'https' or 'both' (to launch both servers).").encode('utf-8'), coerceConnectionType], 63 OPT_PARAMETERS_BOTH = [['connection_type', 't', 'https', _(u"'http', 'https' or 'both' (to launch both servers).").encode('utf-8'), coerceConnectionType],
64 ['port', 'p', 8080, _(u'The port number to listen HTTP on.').encode('utf-8'), int], 64 ['port', 'p', 8080, _(u'The port number to listen HTTP on.').encode('utf-8'), int],