aboutsummaryrefslogtreecommitdiff
path: root/moin
diff options
context:
space:
mode:
authorMike Crute <mike@crute.us>2020-02-08 00:55:53 +0000
committerMike Crute <mike@crute.us>2020-02-08 00:55:53 +0000
commitcd7d5795264de19f6354e8caaaf15b7ebec0dc92 (patch)
treedde125cf0076aec2ea181f04d85a82101234a944 /moin
parentbc08e7bc27349d4bbe9c775e925a40b8387112f7 (diff)
downloaddockerfiles-cd7d5795264de19f6354e8caaaf15b7ebec0dc92.tar.bz2
dockerfiles-cd7d5795264de19f6354e8caaaf15b7ebec0dc92.tar.xz
dockerfiles-cd7d5795264de19f6354e8caaaf15b7ebec0dc92.zip
moin: fix to python2 versions
Diffstat (limited to 'moin')
-rw-r--r--moin/Dockerfile7
-rw-r--r--moin/Makefile5
-rw-r--r--moin/wiki-common/plugins/macro/NoCacheRemoteImage.py33
3 files changed, 42 insertions, 3 deletions
diff --git a/moin/Dockerfile b/moin/Dockerfile
index 28c31d6..6dbf84f 100644
--- a/moin/Dockerfile
+++ b/moin/Dockerfile
@@ -1,6 +1,8 @@
1FROM docker.io/alpine:latest 1FROM docker.io/alpine:3.10
2LABEL maintainer="Mike Crute <mike@crute.us>" 2LABEL maintainer="Mike Crute <mike@crute.us>"
3 3
4ARG moin_version
5
4ADD patches/ /tmp/moin-patches 6ADD patches/ /tmp/moin-patches
5# aspell-en (wamerican) needed? 7# aspell-en (wamerican) needed?
6 8
@@ -42,8 +44,9 @@ RUN set -euxo pipefail; \
42 && mv *.so* /usr/lib \ 44 && mv *.so* /usr/lib \
43# Build the latest version of moin 45# Build the latest version of moin
44 && cd /tmp \ 46 && cd /tmp \
45 && git clone --depth=1 https://github.com/moinwiki/moin-1.9.git \ 47 && git clone https://github.com/moinwiki/moin-1.9.git \
46 && cd moin-1.9 \ 48 && cd moin-1.9 \
49 && git checkout ${moin_version} \
47 && for p in /tmp/moin-patches/*; do \ 50 && for p in /tmp/moin-patches/*; do \
48 patch -p1 < $p; \ 51 patch -p1 < $p; \
49 done \ 52 done \
diff --git a/moin/Makefile b/moin/Makefile
index a72d6ff..6330b72 100644
--- a/moin/Makefile
+++ b/moin/Makefile
@@ -1,8 +1,11 @@
1VERSION=latest 1VERSION=latest
2IMAGE=docker.crute.me/moin 2IMAGE=docker.crute.me/moin
3MOIN_VERSION=6cf59082f29a2bb3bb37bed1bd525e401e524a3e
3 4
4all: 5all:
5 docker build -t $(IMAGE):$(VERSION) . 6 docker build \
7 --build-arg=moin_version=$(MOIN_VERSION) \
8 -t $(IMAGE):$(VERSION) .
6 9
7all-no-cache: 10all-no-cache:
8 docker build --no-cache -t $(IMAGE):$(VERSION) . 11 docker build --no-cache -t $(IMAGE):$(VERSION) .
diff --git a/moin/wiki-common/plugins/macro/NoCacheRemoteImage.py b/moin/wiki-common/plugins/macro/NoCacheRemoteImage.py
new file mode 100644
index 0000000..9f37332
--- /dev/null
+++ b/moin/wiki-common/plugins/macro/NoCacheRemoteImage.py
@@ -0,0 +1,33 @@
1import time
2import urllib
3import urlparse
4
5
6QUERY_PART_INDEX = 4
7
8
9def macro_NoCacheRemoteImage(macro, url, querystring_param=None, alt=None,
10 width=None, link=True):
11 parsed = list(urlparse.urlparse(url))
12
13 query = urlparse.parse_qsl(parsed[QUERY_PART_INDEX])
14 query.append((querystring_param or "c", str(int(time.time() * 1000000))))
15
16 parsed[QUERY_PART_INDEX] = urllib.urlencode(query)
17
18 cb_url = urlparse.urlunparse(urlparse.ParseResult(*parsed))
19
20 img_args = { "class": "external image" }
21
22 if alt:
23 img_args["alt"] = alt
24 img_args["title"] = alt
25
26 if width:
27 img_args["width"] = width
28
29 return "".join([
30 macro.formatter.url(True, cb_url) if link else "",
31 macro.formatter.image(cb_url, **img_args),
32 macro.formatter.url(False) if link else "",
33 ])