Re: [viewvc-dev] [PATCH] mod_python configuration
"C. Michael Pilato" <[email protected]> Fri, 23 Sep 2011 11:28:59 -0400
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.devel |
|---|---|
| Organization | CollabNet, Inc. |
| Message-ID | <[email protected]> |
Sorry, Alon. Been busy doing other things and haven't had a chance to comment on this. I do believe there is value in being able to programmatically define the configuration file under mod_python (and mod_wsgi, and FastCGI, etc.). At this time, the most useful thing you could do would be a file an issue in the ViewVC tracker for this enhancement, hang your latest patch on it, and point to this mailing list thread. (http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2839188) On 09/23/2011 06:42 AM, Alon Bar-Lev wrote: > Hello, > I don't want to nag... > Just wanted to know if adding the ability to send config file via the > mod_python/cgi interface is something that will be considered and if I > can help further to push this forward. > Thanks! > > On Sun, Sep 18, 2011 at 6:17 PM, Alon Bar-Lev <[email protected]> wrote: >> >> Can I help further in this issue? >> >> On Thu, Sep 15, 2011 at 8:11 PM, Alon Bar-Lev <[email protected]> wrote: >>> >>> On Thu, Sep 15, 2011 at 7:51 PM, C. Michael Pilato <[email protected]> wrote: >>>> On 09/15/2011 11:19 AM, Alon Bar-Lev wrote: >>>>>> 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. >>>> >>>> How do you know that SetEnv doesn't work for mod_python? How are you >>>> testing that? >>> >>> Apache >>> --- >>> <Location /viewvc> >>> DirectoryIndex viewvc.py >>> # PythonOption org.viewvc.conf_file "/var/www/localhost/conf/viewvc.conf" >>> SetEnv VIEWVC_CONF_PATHNAME "/var/www/localhost/conf/viewvc.conf" >>> </Location> >>> --- >>> >>> Viewvc >>> --- >>> pathname = (server.getenv("VIEWVC_CONF_PATHNAME") >>> 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")) >>> --- >>> >>> Well, I am more like C guy but it looks right and does not work. >>> I may miss something? >>> Does it work for you? >>> >>>> >>>>> 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 >>> >>> Correction, the server is your own viewvc object... so it actually need to be: >>> >>> pathname = (server.request.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")) >>> >>> >>>>> >>>>> 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... >>>> >>>> server.get_options().get("org.viewvc.conf_file") returns None of the key >>>> doesn't exist in the dictionary/hash. >>> >>> Strange, I getting an exception. >>> --- >>> File "/usr/lib64/python2.7/site-packages/viewvc/viewvc.py", line >>> 4411, in load_config >>> pathname = (server.request.get_options()["org.viewvc.conf_file44"] >>> >>> KeyError: 'org.viewvc.conf_file44' >>> --- >>> >>> Not python developer... >>> >>> But I can add get_option in the ModPythonServer object that returns >>> None if not exists. >>> >>>> >>>>> 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...). >>>> >>>> You are correct. I read that wrongly. >>>> >>>>> 3. Environment(or options) should be documented in INSTALL.... A >>>>> complete <Directory sample would be nice! :) >>>> >>>> Fair enough. :-) >>>> >>>> -- >>>> C. Michael Pilato <[email protected]> >>>> CollabNet <> www.collab.net <> Distributed Development On Demand >>>> >>>> -- C. Michael Pilato <[email protected]> CollabNet <> www.collab.net <> Distributed Development On Demand ------------------------------------------------------ http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2843984 To unsubscribe from this discussion, e-mail: [[email protected]].
signature.asc
(application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk58pbsACgkQokEGqRcG/W4RzQCgqJsplqlZ981t/yHIy2hNt1YQ D8sAn1GBZq0fzUiN6DnU3ekIt3djOUaX =gllj -----END PGP SIGNATURE-----