# HG changeset patch # User Paul Boddie # Date 1370641264 -7200 # Node ID 129eb3495f2df54ed7b1ee9bab6f80a9f0c6cfb5 # Parent ffd4c114650370cddbda81aad21931ecf7e1e785 Added a superuser parameter to getWikiDict to make the function usable by auth handlers. diff -r ffd4c1146503 -r 129eb3495f2d MoinSupport.py --- a/MoinSupport.py Mon Jun 03 23:37:05 2013 +0200 +++ b/MoinSupport.py Fri Jun 07 23:41:04 2013 +0200 @@ -169,14 +169,15 @@ # WikiDict functions. -def getWikiDict(pagename, request): +def getWikiDict(pagename, request, superuser=False): """ Return the WikiDict provided by the given 'pagename' using the given - 'request'. + 'request'. If the optional 'superuser' is specified as a true value, no read + access check will be made. """ - if pagename and Page(request, pagename).exists() and request.user.may.read(pagename): + if pagename and Page(request, pagename).exists() and (superuser or request.user.may.read(pagename)): if hasattr(request.dicts, "dict"): return request.dicts.dict(pagename) else: @@ -661,8 +662,10 @@ return request.getHeader(header_name) elif hasattr(request, "headers"): return request.headers.get(header_name) + elif hasattr(request, "env"): + return request.env.get((prefix and prefix + "_" or "") + header_name.upper()) else: - return request.env.get((prefix and prefix + "_" or "") + header_name.upper()) + return None def writeHeaders(request, mimetype, metadata, status=None): diff -r ffd4c1146503 -r 129eb3495f2d README.txt --- a/README.txt Mon Jun 03 23:37:05 2013 +0200 +++ b/README.txt Fri Jun 07 23:41:04 2013 +0200 @@ -74,6 +74,8 @@ * Fixed the time zone information associated with page revisions. * Added RFC 2822 datetime parsing with help from the email.utils module. * Added a common wikidict entry parsing function. + * Added a superuser parameter to getWikiDict to make the function usable by + auth handlers. New in MoinSupport 0.3 (Changes since MoinSupport 0.2) ------------------------------------------------------