Re: [viewvc-dev] [PATCH] mod_python configuration

Alon Bar-Lev <[email protected]> Thu, 15 Sep 2011 18:19:25 +0300
Newsgroups gmane.comp.version-control.cvs.viewcvs.devel
Message-ID <CAOazyz2stj_ujj3QfC-6tRuCauzRoTMx5rvZvqcWihgmxSfOhA__43878.8324165673$1316099983$gmane$org@mail.gmail.com>
On Thu, Sep 15, 2011 at 5:31 PM, C. Michael Pilato <[email protected]> wrote:
> You're wrong.  Well, sorta.  :-)

Sorry!
I am not python developer, never understood this language!

> The viewvc.load_config() function is responsible for loading the
> configuration information, and it already consults the VIEWVC_CONF_PATHNAME
> environment variable to override the hard-coded stuff.

Right, now I see this.

> That said, in reviewing your patch, it occurs to me that the code in
> viewvc.load_config() probably shouldn't use os.environ() to check for that
> variable, but (if a 'server' is provided') should use server.getenv()
> instead.  That way, the appropriate environment-checking function for the
> deployment type (mod_python, CGI, IIS, etc.) is used.
>
> Would you be willing to explore this idea a bit to see if it makes sense?

Well,

SetEnv does not work in mod_python, at least not in my setup.
So we need something like:

  if pathname is None:
    pathname = (server.get_options()["org.viewvc.conf_file"]              <----
                or os.environ.get("VIEWVC_CONF_PATHNAME")
                or os.environ.get("VIEWCVS_CONF_PATHNAME")
                or os.path.join(os.path.dirname(os.path.dirname(__file__)),
                                "viewvc.conf"))

However

1. The python throws and exception if element within hash is not found
(I expect it to return None...) so I leave it for you...

2. Correct me if I am wrong but this does not overrides the default
within file, it does set if config is null, and it never is as the
viewvc-install sets CONF_PATHNAME to none null.
I expect environment / option to override the hard coded anyway, so
remove the "if pathname is None:" (and of course un-indent...).

3. Environment(or options) should be documented in INSTALL.... A
complete <Directory sample would be nice! :)

Thanks!
Alon.

------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2839246

To unsubscribe from this discussion, e-mail: [[email protected]].