# HG changeset patch # User Paul Boddie # Date 1390856377 -3600 # Node ID 24482c1426b77af1502e32ad3df79c5a49024c99 # Parent 25ac87b5950fd07e589e1f8602ef3e98bb087e6c Added access to the static content location of a wiki. diff -r 25ac87b5950f -r 24482c1426b7 MoinSupport.py --- a/MoinSupport.py Mon Jan 27 00:40:07 2014 +0100 +++ b/MoinSupport.py Mon Jan 27 21:59:37 2014 +0100 @@ -17,6 +17,7 @@ from MoinMoin.Page import Page from MoinMoin.support.python_compatibility import hash_new from MoinMoin import caching, config, search, wikiutil +from os.path import abspath, exists, join, split from shlex import shlex import re import time @@ -35,6 +36,14 @@ except ImportError: pass +# Static resource location. + +try: + from MoinMoin.web import static + htdocs = abspath(join(static.__file__, "htdocs")) +except ImportError: + htdocs = None + __version__ = "0.5" # Extraction of shared fragments. @@ -65,6 +74,22 @@ ur'{{{(?P.*?)}}}' ur')', re.UNICODE) +# Access to static Moin content. + +def getStaticContentDirectory(request): + + "Use the 'request' to find the htdocs directory." + + global htdocs + + if not htdocs: + htdocs_in_data = abspath(join(split(request.cfg.data_dir)[0], "htdocs")) + if exists(htdocs_in_data): + htdocs = htdocs_in_data + return htdocs + + return htdocs + # Category discovery. def getCategoryPattern(request): diff -r 25ac87b5950f -r 24482c1426b7 README.txt --- a/README.txt Mon Jan 27 00:40:07 2014 +0100 +++ b/README.txt Mon Jan 27 21:59:37 2014 +0100 @@ -74,6 +74,7 @@ * Added RFC 2822 datetime formatting. * Added a "raw" parser which just formats its input as text. * Added page-related caching functions. + * Added access to the static content location of a wiki. New in MoinSupport 0.4.1 (Changes since MoinSupport 0.4) --------------------------------------------------------