export wcs_* env. vars to substition vars

This commit is contained in:
Thomas NOËL 2011-08-03 15:37:12 +00:00
parent d7cbeb627e
commit bf9777ee50
2 changed files with 11 additions and 0 deletions

View File

@ -61,3 +61,13 @@ class HTTPRequest(quixote.http_request.HTTPRequest):
for k, v in self.form.items():
if type(v) is unicode:
self.form[k] = v.encode(site_charset)
def get_substitution_variables(self):
# env variables starting with "APPNAME_" are exported to
# substitutions variables
prefix = get_publisher().APP_NAME.lower() + '_'
vars = {}
for k, v in self.environ.items():
if k.lower().startswith(prefix):
vars['env_' + k.lower()] = v
return vars

View File

@ -377,6 +377,7 @@ class QommonPublisher(Publisher):
self.install_lang(request.language)
self.substitutions.reset()
self.substitutions.feed(self)
self.substitutions.feed(request)
return Publisher.try_publish(self, request)
def get_site_language(self):