~edwargix/git.sr.ht

c61c00ffd2e6a5dd12b9585b491964237a625bcc — Drew DeVault 7 years ago 5f60b49
Add support for py-redis 3.x
3 files changed, 7 insertions(+), 4 deletions(-)

M gitsrht/blueprints/repo.py
M gitsrht/git.py
M gitsrht/redis.py
M gitsrht/blueprints/repo.py => gitsrht/blueprints/repo.py +2 -2
@@ 51,7 51,7 @@ def get_readme(repo, tip):
    except:
        md = "Error decoding readme - is it valid UTF-8?"
    html = markdown(md, ["h1", "h2", "h3", "h4", "h5"])
    redis.setex(key, html, timedelta(days=7))
    redis.setex(key, timedelta(days=7), html)
    return Markup(html)

def _get_shebang(data):


@@ 88,7 88,7 @@ def _highlight_file(name, data, blob_id):
    formatter = HtmlFormatter()
    style = formatter.get_style_defs('.highlight')
    html = f"<style>{style}</style>" + highlight(data, lexer, formatter)
    redis.setex(key, html, timedelta(days=7))
    redis.setex(key, timedelta(days=7), html)
    return Markup(html)

def get_last_3_commits(commit):

M gitsrht/git.py => gitsrht/git.py +1 -1
@@ 135,7 135,7 @@ def annotate_tree(repo, tree, commit):

    cache = {entry.name: entry.serialize() for entry in tree.values()}
    cache = json.dumps(cache)
    redis.setex(key, cache, timedelta(days=30))
    redis.setex(key, timedelta(days=30), cache)

    return [entry.fetch_blob() for entry in tree.values()]


M gitsrht/redis.py => gitsrht/redis.py +4 -1
@@ 1,3 1,6 @@
from redis import Redis
try:
    from redis import StrictRedis as Redis
except ImportError:
    from redis import Redis

redis = Redis()