Various fixes and improvements.
* lib/config.py: (_parse_roots): get rid of a string method usage. * lib/popen.py: (pipe_cmds): stop using the += syntax (not compatible with 1.5.2) * lib/sapi.py: (CgiServer.__init__): use os.environ, not os.getenv() (IIS_FixURL): stop using the += syntax * lib/viewcvs.py: - note: these changes look big, but are small. use 'cvs diff -b' to see the real change without the reindentation. (markup_stream_python): record a note about some future work (run_viewcvs): new function which holds the guts of ViewCVS. this used to be main() a long while back before that got monkeyed. this is really just a reindent. (main): hold the exception handling logic. tweak then the t_start and t_end calls are made, relative to the try/finally. git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@638 8cb11bc2-c004-0410-86c3-e597b4017df7remotes/tags/1.0.0-rc1
parent
14c0409e77
commit
d51c87a71a
|
@ -221,7 +221,7 @@ class Config:
|
|||
def _parse_roots(config_name, config_value):
|
||||
roots = { }
|
||||
for root in config_value:
|
||||
pos = root.find(':')
|
||||
pos = string.find(root, ':')
|
||||
if pos < 0:
|
||||
raise MalformedRoot(config_name, root)
|
||||
name, path = map(string.strip, (root[:pos], root[pos+1:]))
|
||||
|
|
|
@ -153,7 +153,7 @@ def pipe_cmds(cmds):
|
|||
|
||||
i = 0
|
||||
for cmd in cmds:
|
||||
i += 1
|
||||
i = i + 1
|
||||
|
||||
dbgOut, dbgErr = StringIO.StringIO(), StringIO.StringIO()
|
||||
|
||||
|
@ -181,7 +181,7 @@ def pipe_cmds(cmds):
|
|||
|
||||
i = 0
|
||||
for cmd in cmds:
|
||||
i += 1
|
||||
i = i + 1
|
||||
if i < len(cmds):
|
||||
nextStdIn, hStdOut = win32popen.CreatePipe(1, 1, 1, 1)
|
||||
else:
|
||||
|
|
|
@ -19,7 +19,7 @@ class CgiServer:
|
|||
self.header_sent = 0
|
||||
self.pageGlobals = {}
|
||||
|
||||
if os.getenv('SERVER_SOFTWARE', '')[:13] == 'Microsoft-IIS':
|
||||
if os.environ.get('SERVER_SOFTWARE', '')[:13] == 'Microsoft-IIS':
|
||||
self.iis = 1
|
||||
else:
|
||||
self.iis = 0
|
||||
|
@ -111,9 +111,9 @@ def IIS_FixURL(url):
|
|||
else:
|
||||
dport = "80"
|
||||
prefix = "http://"
|
||||
prefix += os.environ['HTTP_HOST']
|
||||
prefix = prefix + os.environ['HTTP_HOST']
|
||||
if os.environ['SERVER_PORT'] != dport:
|
||||
prefix += ":" + os.environ['SERVER_PORT']
|
||||
prefix = prefix + ":" + os.environ['SERVER_PORT']
|
||||
return prefix + url
|
||||
return url
|
||||
|
||||
|
|
|
@ -578,6 +578,10 @@ def markup_stream_default(fp):
|
|||
print '</pre>'
|
||||
|
||||
def markup_stream_python(fp):
|
||||
### convert this code to use the recipe at:
|
||||
### http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52298
|
||||
### note that the cookbook states all the code is licensed according to
|
||||
### the Python license.
|
||||
try:
|
||||
# see if Marc-Andre Lemburg's py2html stuff is around
|
||||
# http://starship.python.net/crew/lemburg/SoftwareDescriptions.html#py2html.py
|
||||
|
@ -2898,13 +2902,7 @@ def handle_config():
|
|||
debug.t_end('load-config')
|
||||
|
||||
|
||||
def main():
|
||||
global server
|
||||
try:
|
||||
try:
|
||||
server = sapi.server
|
||||
debug.t_start('main')
|
||||
|
||||
def run_viewcvs(server):
|
||||
# handle the configuration stuff
|
||||
handle_config()
|
||||
|
||||
|
@ -3015,6 +3013,23 @@ def main():
|
|||
raise debug.ViewcvsException(
|
||||
'%s: unable to determine desired operation'
|
||||
% request.url, '404 Not Found')
|
||||
|
||||
|
||||
def main():
|
||||
### this is a bad hack. various functions expect a runtime global
|
||||
### named 'server' which corresponds to how we generate output.
|
||||
### bleck. the right answer is to make this part of the Request object
|
||||
### and ensure that every function is passed the Request instance.
|
||||
### this would also allow us to toss the AspProxy and its per-thread
|
||||
### nonsense.
|
||||
global server
|
||||
server = sapi.server
|
||||
|
||||
try:
|
||||
debug.t_start('main')
|
||||
|
||||
try:
|
||||
run_viewcvs(sapi.server)
|
||||
except SystemExit, e:
|
||||
return
|
||||
except:
|
||||
|
@ -3025,6 +3040,7 @@ def main():
|
|||
debug.dump()
|
||||
debug.DumpChildren()
|
||||
|
||||
|
||||
class _item:
|
||||
def __init__(self, **kw):
|
||||
vars(self).update(kw)
|
||||
|
|
Loading…
Reference in New Issue