]>
git.mar77i.info Git - hublib/blob - hub/utils.py
ae448ed8fb499a14c3c9ea486fcc1e59252fbe42
1 from pathlib
import Path
3 from jinja2_simple_tags
import StandaloneTag
6 class StaticTag(StandaloneTag
):
9 def render(self
, filename
="/", hubapp
=None):
11 hubapp
= self
.context
["hubapp"]
12 elif isinstance(hubapp
, str):
13 hubapp
= self
.context
["hubapp"].app
.hubapps
[hubapp
]
14 return hubapp
.uri_from(Path(filename
))
17 def get_redis_pass(redis_conf
):
18 prefix
= "requirepass "
19 with open(redis_conf
, "rt") as fh
:
21 if not line
.startswith(prefix
):
23 return line
[len(prefix
) :].rstrip()