[viewvc-dev] [PATCH] mod_python configuration
Alon Bar-Lev <[email protected]> Thu, 15 Sep 2011 13:23:34 +0300
| Newsgroups | gmane.comp.version-control.cvs.viewcvs.devel |
|---|---|
| Message-ID | <CAOazyz1Kg6g4wokuyxm6-nqNQeTiapu9RkA+R+EekKj5A=mYEg__25170.3185648241$1316095075$gmane$org@mail.gmail.com> |
Hello,
Correct me if I am wrong, but current configuration of web extensions
requires rewiring the python code, and modify:
---
LIBRARY_DIR = None
CONF_PATHNAME = None
---
For the LIBRARY_DIR, I can understand that during installation you
know where configuration file is.
But for the configuration file I disagree.
Maybe this happens in other variants of execution, but an attempt
should be made to allow customization.
The attached patch allows cgi and mod_python the user to override the
default configuration file and specify a
different configuration location using apache configuration, example:
---
<!--mod_python-->
<Location /viewvc>
DirectoryIndex viewvc.py
PythonOption org.viewvc.conf_file "/var/www/localhost/conf/viewvc.conf"
</Location>
<!--CGI-->
<Location /viewvc>
DirectoryIndex viewvc.cgi
SetEnv VIEWVC_CONF "/var/www/localhost/conf/viewvc.conf"
</Location>
---
I think same get by achieved for all other extensions out there.
Can you please consider?
Thanks,
Regards,
Alon Bar-Lev
Alon.
------------------------------------------------------
http://viewvc.tigris.org/ds/viewMessage.do?dsForumId=4251&dsMessageId=2839188
To unsubscribe from this discussion, e-mail: [[email protected]].
viewvc-1.1.11-config.patch
(text/x-patch, 1.6 KB)
--- bin/mod_python/viewvc.py 2009-03-18 18:45:10.000000000 +0200
+++ bin/mod_python/viewvc.py 2011-09-15 12:48:46.711708637 +0300
@@ -36,6 +36,7 @@ CONF_PATHNAME = None
# Adjust sys.path to include our library directory
#
+import os
import sys
if LIBRARY_DIR:
@@ -53,6 +54,10 @@ finally:
fp.close()
def index(req):
+ try:
+ CONF_PATHNAME = req.get_options()["org.viewvc.conf_file"];
+ except:
+ pass
server = sapi.ModPythonServer(req)
cfg = viewvc.load_config(CONF_PATHNAME, server)
try:
--- bin/mod_python/query.py 2010-09-09 21:20:01.000000000 +0300
+++ bin/mod_python/query.py 2011-09-15 13:14:16.583177393 +0300
@@ -60,6 +60,10 @@ finally:
if fp:
fp.close()
+try:
+ CONF_PATHNAME = req.get_options()["org.viewvc.conf_file"];
+except:
+ pass
cfg = viewvc.load_config(CONF_PATHNAME)
def index(req):
diff -urNp bin/cgi/query.cgi bin/cgi/query.cgi
--- bin/cgi/query.cgi 2010-09-09 18:31:52.000000000 +0300
+++ bin/cgi/query.cgi 2011-09-15 13:11:57.101317580 +0300
@@ -52,6 +52,7 @@ import sapi
import viewvc
import query
+CONF_PATHNAME = os.getenv("VIEWVC_CONF", CONF_PATHNAME)
server = sapi.CgiServer()
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc_base_url = cfg.query.viewvc_base_url
diff bin/cgi/viewvc.cgi /tmp/view1/bin/cgi/viewvc.cgi
--- bin/cgi/viewvc.cgi 2006-03-18 04:07:36.000000000 +0200
+++ bin/cgi/viewvc.cgi 2011-09-15 13:06:21.546598925 +0300
@@ -56,6 +56,7 @@ else:
import sapi
import viewvc
+CONF_PATHNAME = os.getenv("VIEWVC_CONF", CONF_PATHNAME)
server = sapi.CgiServer()
cfg = viewvc.load_config(CONF_PATHNAME, server)
viewvc.main(server, cfg)