# HG changeset patch # User Paul Boddie # Date 1383504056 -3600 # Node ID 5e5052387518a3474ad460d73f2e4f358223bdfd # Parent f1b03998cf9196a9e06172b1637418fb91767c6f Fixed .htaccess/mod_rewrite support for page PDF export. diff -r f1b03998cf91 -r 5e5052387518 README.txt --- a/README.txt Sun Nov 03 14:52:17 2013 +0100 +++ b/README.txt Sun Nov 03 19:40:56 2013 +0100 @@ -235,7 +235,10 @@ The redirect.py script, apart from supporting identifier-to-page redirects, also supports PDF page exports since the "doexportpage" action uses -identifiers to indicate which page is to be exported. +identifiers to indicate which page is to be exported. In an environment that +uses .htaccess and mod_rewrite, the redirect.py script should also be deployed +under a separate name (such as export.py) so that it can discover whether it +should be exporting a page instead of just showing it. The search.py script redirects search requests in a suitable form to the MoinMoin "fullsearch" action. diff -r f1b03998cf91 -r 5e5052387518 config/mailmanwiki-redirect-htaccess --- a/config/mailmanwiki-redirect-htaccess Sun Nov 03 14:52:17 2013 +0100 +++ b/config/mailmanwiki-redirect-htaccess Sun Nov 03 19:40:56 2013 +0100 @@ -8,7 +8,7 @@ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d -RewriteRule ^pages/doexportpage.action /redirect.py [PT,L,QSA] +RewriteRule ^pages/doexportpage.action /export.py [PT,L,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d diff -r f1b03998cf91 -r 5e5052387518 scripts/redirect.py --- a/scripts/redirect.py Sun Nov 03 14:52:17 2013 +0100 +++ b/scripts/redirect.py Sun Nov 03 19:40:56 2013 +0100 @@ -16,6 +16,7 @@ # An empty string means that the wiki is anchored at the site root. URL_PREFIX = "" +EXPORT_SCRIPT = "/export.py" # See the scripts/tiny.py program for similar code in a stand-alone program. @@ -79,7 +80,7 @@ if pageid is None: fail(pageid) - export = script.endswith("/pages/doexportpage.action") and args.get("type", [""])[0] == "TYPE_PDF" + export = (script.endswith(EXPORT_SCRIPT) or script.endswith("/pages/doexportpage.action")) and args.get("type", [""])[0] == "TYPE_PDF" f = open(MAPPING_ID_TO_PAGE) try: