[Zope-Coders] Re: [Zope-Checkins] CVS: Zope/lib/python/DocumentTemplate - DT_Var.py:1.51

Florent Guillaume fg@nuxeo.com
Tue, 19 Mar 2002 11:50:20 +0000 (UTC)


Is adding an environment variable for every global parametrization of
Zope the right way to do such things ? We could get pretty quickly
drowned under variables...

At the very least prefix it by ZOPE_ or something.

But in my humble opinion this is creeping featurism. If someone really
wants to have a non-default level for stx in HTML, let him write an
external method to do it.


Florent


Andreas Jung  <andreas@digicool.com> wrote:
> Update of /cvs-repository/Zope/lib/python/DocumentTemplate
> In directory cvs.zope.org:/tmp/cvs-serv32587/lib/python/DocumentTemplate
>
> Modified Files:
> 	DT_Var.py
> Log Message:
> added new env. var "STX_DEFAULT_LEVEL"
>
>
> === Zope/lib/python/DocumentTemplate/DT_Var.py 1.50 => 1.51 ===
>
>  from DT_Util import parse_params, name_param, str
> -import string, re,  sys
> +import os, string, re,  sys
>  from urllib import quote, quote_plus
>  from cgi import escape
>  from html_quote import html_quote # for import by other modules, dont remove!
> @@ -357,7 +357,9 @@
>
>      else: txt = str(v)
>
> -    return HTML(txt,level=3,header=0)
> +    return HTML(txt,
> +                level=int(os.environ.get('STX_DEFAULT_LEVEL',3)),
> +                header=0)
>
>
>  def sql_quote(v, name='(Unknown name)', md={}):
-- 
Florent Guillaume, Nuxeo (Paris, France)
+33 1 40 33 79 10  http://nuxeo.com  mailto:fg@nuxeo.com