feat: add support for multiple theme search paths
This commit is contained in:
parent
2f79377c09
commit
de110cd397
6 changed files with 27 additions and 9 deletions
|
@ -93,7 +93,7 @@ build_debian:
|
||||||
- gzip -9n package/debian/matemat/usr/share/doc/matemat/changelog
|
- gzip -9n package/debian/matemat/usr/share/doc/matemat/changelog
|
||||||
- cp -r static/ package/debian/matemat/usr/lib/matemat/static/
|
- cp -r static/ package/debian/matemat/usr/lib/matemat/static/
|
||||||
- cp -r templates/ package/debian/matemat/usr/lib/matemat/templates/
|
- cp -r templates/ package/debian/matemat/usr/lib/matemat/templates/
|
||||||
- mkdir -p package/debian/matemat/var/lib/matemat/
|
- mkdir -p package/debian/matemat/var/lib/matemat/themes/
|
||||||
- cp -r themes/ package/debian/matemat/usr/lib/matemat/themes/
|
- cp -r themes/ package/debian/matemat/usr/lib/matemat/themes/
|
||||||
- python3.7 setup.py egg_info install --root=package/debian/matemat/ --prefix=/usr --optimize=1
|
- python3.7 setup.py egg_info install --root=package/debian/matemat/ --prefix=/usr --optimize=1
|
||||||
- cd package/debian
|
- cd package/debian
|
||||||
|
|
13
CHANGELOG.md
13
CHANGELOG.md
|
@ -1,5 +1,18 @@
|
||||||
# Matemat Changelog
|
# Matemat Changelog
|
||||||
|
|
||||||
|
<!-- BEGIN RELEASE v0.3.3 -->
|
||||||
|
## Version 0.3.3
|
||||||
|
|
||||||
|
Multiple theme search paths
|
||||||
|
|
||||||
|
### Changes
|
||||||
|
|
||||||
|
<!-- BEGIN CHANGES 0.3.3-->
|
||||||
|
- Support for multiple theme search paths
|
||||||
|
<!-- END CHANGES 0.3.3 -->
|
||||||
|
|
||||||
|
<!-- END RELEASE v0.3.3 -->
|
||||||
|
|
||||||
<!-- BEGIN RELEASE v0.3.2 -->
|
<!-- BEGIN RELEASE v0.3.2 -->
|
||||||
## Version 0.3.2
|
## Version 0.3.2
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,2 @@
|
||||||
|
|
||||||
__version__ = '0.3.2'
|
__version__ = '0.3.3'
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Dict, Iterable, Union
|
from typing import Any, Dict, Iterable, Union
|
||||||
|
|
||||||
|
import shlex
|
||||||
import sys
|
import sys
|
||||||
import os.path
|
import os.path
|
||||||
import bottle
|
import bottle
|
||||||
|
@ -63,11 +64,15 @@ def _init(config: Dict[str, Any]):
|
||||||
@bottle.route('/static/<filename:path>')
|
@bottle.route('/static/<filename:path>')
|
||||||
def serve_static_files(filename: str):
|
def serve_static_files(filename: str):
|
||||||
config = get_config()
|
config = get_config()
|
||||||
themeroot = os.path.abspath(os.path.join(config['themeroot'], config['theme'], 'static'))
|
roots = []
|
||||||
staticroot = os.path.abspath(config['staticroot'])
|
for themeroot in shlex.split(config['themeroot']):
|
||||||
resp = bottle.static_file(filename, root=themeroot)
|
roots.append(os.path.abspath(os.path.join(themeroot, config['theme'], 'static')))
|
||||||
if resp.status_code == 404:
|
roots.append(os.path.abspath(config['staticroot']))
|
||||||
resp = bottle.static_file(filename, root=staticroot)
|
resp = None
|
||||||
|
for root in roots:
|
||||||
|
resp = bottle.static_file(filename, root=root)
|
||||||
|
if resp.status_code == 200:
|
||||||
|
break
|
||||||
return resp
|
return resp
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
Package: matemat
|
Package: matemat
|
||||||
Version: 0.3.2
|
Version: 0.3.3
|
||||||
Maintainer: s3lph <1375407-s3lph@users.noreply.gitlab.com>
|
Maintainer: s3lph <1375407-s3lph@users.noreply.gitlab.com>
|
||||||
Section: web
|
Section: web
|
||||||
Priority: optional
|
Priority: optional
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
StaticPath=/usr/lib/matemat/static
|
StaticPath=/usr/lib/matemat/static
|
||||||
TemplatePath=/usr/lib/matemat/templates
|
TemplatePath=/usr/lib/matemat/templates
|
||||||
ThemePath=/var/lib/matemat/themes
|
ThemePath=/var/lib/matemat/themes /usr/lib/matemat/themes
|
||||||
|
|
||||||
LogTarget=stdout
|
LogTarget=stdout
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue