* lib/sapi.py
(WsgiServer.FieldStorage): Don't pass self._headers to
cgi.FieldStorage() -- that parameter is for *input* headers, and
self._headers is a collection of output headers.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2459 8cb11bc2-c004-0410-86c3-e597b4017df7
of this is aimed at not paying the maintenance price of supporting
Python versions prior to 2.4 any longer, plus a little bit of just
getting dead code out of the way.
* lib/compat.py
Remove as unused.
* bin/cvsdbadmin,
* bin/loginfo-handler,
* bin/make-database,
* bin/svndbadmin,
* lib/accept.py,
* lib/blame.py,
* lib/cvsdb.py,
* lib/popen.py,
* lib/query.py,
* lib/sapi.py,
* lib/vcauth/forbidden/__init__.py
* lib/vcauth/forbiddenre/__init__.py,
* lib/vcauth/svnauthz/__init__.py,
* lib/vclib/__init__.py,
* lib/vclib/ccvs/blame.py,
* lib/win32popen.py,
* tests/timelog.py
Replace explicit import and use of the 'string' module with newer constructs.
* bin/standalone.py,
* lib/viewvc.py
No longer use 'compat' module. Replace explicit import and use of
the 'string' module with newer constructs.
* lib/dbi.py
Use calender.timegm() instead of compat.timegm().
* lib/vcauth/__init__.py
Lose unused module imports.
* lib/config.py,
Replace explicit import and use of the 'string' module with newer
constructs where possible. Lose old ConfigParser patch-up code for
Python 1.5.1.
* lib/vclib/ccvs/ccvs.py
Replace explicit import and use of the 'string' module with newer
constructs where possible. Import _path_join() from bincvs, and use
it instead of a bunch of copy-and-pasted string join() statements
throughout.
* lib/vclib/ccvs/__init__.py
(cvs_strptime): Moved here from the 'compat' module.
* lib/vclib/ccvs/bincvs.py
(): No longer use 'compat' module. Replace explicit import and use
of the 'string' module with newer constructs.
(_path_join): New, used now instead of a bunch of copy-and-pasted
string join() statements throughout.
* viewvc-install
Don't use the 'compat' module any more.
Also, so some rearranging of non-critical bits.
* misc/: New directory.
* misc/py2html.py: Moved from 'lib/py2html.py'.
* misc/PyFontify.py: Moved from 'lib/PyFontify.py'.
* misc/elemx/: Moved from 'elemx/'.
* misc/tparse/: Moved from 'tparse/'.
* tools/make-release
Omit 'misc' directory from releases, too.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2437 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/sapi.py
(escape): Ensure that the input is string-ified before doing string
transformations on it.
Patch by: Michael Henry <drmikehenry{__AT__}tigris.org>
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2369 8cb11bc2-c004-0410-86c3-e597b4017df7
the ViewVC codebase. Simplify, conjoin, remove, etc.
* lib/sapi.py
(escape): New function. *The* preferred HTML-escaping mechanism.
(Server.escape): New common Server object escape mechanism (which
uses the aforementioned escape(), of course).
(CgiServer.escape, WsgiServer.escape, AspServer.escape,
ModPythonServer.escape): Lose as unnecessary.
* lib/viewvc.py
(Request.get_form): Escape hidden form variable names and values.
(htmlify): Remove.
(): Replace all uses of cgi.escape() and htmlify() with (directly or
indirectly) sapi.escape().
* lib/query.py
(main): Use server.escape() instead of cgi.escape().
* lib/blame.py
(HTMLBlameSource.__getitem__): Use sapi.escape() instead of
cgi.escape().
* lib/idiff.py
(_mdiff_split, _differ_split): Use sapi.escape() instead of
cgi.escape().
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2344 8cb11bc2-c004-0410-86c3-e597b4017df7
(This doesn't really fix anything, and hopefully doesn't break anything
either, but is merely a "good programming practice" cleanup item.)
* lib/viewvc.py
(Request.run_viewvc): Ensure that server.redirect() is the last
thing this function does (when it does it).
* lib/sapi.py
(CgiServer.redirect): Avoid calling sys.exit(). Also, fix a use of
print() that should be sys.stdout.write() (for consistency).
(AspServer.redirect, ModPythonServer.redirect): Avoid calling sys.exit().
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2205 8cb11bc2-c004-0410-86c3-e597b4017df7
Dictate UTF-8 as the output character set for all ViewVC
template-driven views.
* lib/sapi.py
(CgiServer.header, ModPythonServer.header): Add "; charset=UTF-8" to
the Content-type header in ViewVC output.
(AspServer.header): If no content type is specified, set the content
type to 'text/html; charset=UTF-8'.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1450 8cb11bc2-c004-0410-86c3-e597b4017df7
* viewcvs/lib/viewcvs.py
(copy_stream): Add 'htmlize' option.
(MarkupPipeWrapper.__call__): Use copy_stream() with htmlize=1
instead of duplicating that loop logic.
(view_log): Set 'rev_selected' and 'path_selected' based on
previously acquired values.
(_re_extract_rev): Tweak regexp so it can match context diff '***'
headers, too.
(view_patch): Move request.server.header() call to just before
rendering.
(view_diff): Escape the 'patch_href' item. Move
request.server.header() call to just before rendering.
(view_error): Don't use the error template if we've already started
sending output through the server.
* viewcvs/lib/sapi.py
(ModPythonServer.__init__, ModPythonServer.header): Add and manage
new headerSent variable (like the ones used by CGIServer and
ASPServer).
* viewcvs/lib/query.py
(main): Call server headers here instead of down in the exception printer.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1136 8cb11bc2-c004-0410-86c3-e597b4017df7
<james@daa.com.au>.
* lib/viewcvs.py
(check_freshness): New.
(MarkupBuffer.close): New.
(MarkupPipeWrapper.close): New.
(MarkupPipeWrapper.__del__): Call own close() function now.
(MarkupEnscript.close): New.
(MarkupEnscript.__del__): Call own close() function now.
(view_markup, view_log, view_diff): Call new check_freshness() function.
(view_doc): Gut caching code and use check_freshness() instead.
* lib/sapi.py
(CgiServer): Fix handling of 304's in IIS.
* standalone.py
Now purge the environment of HTTP_* variables before setting our
own. Also, perhaps set the 'HTTP_IF_MODIFIED_SINCE' and
'HTTP_IF_NONE_MATCH' variables.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@857 8cb11bc2-c004-0410-86c3-e597b4017df7
reduce roundtrips. Patch by James Henstridge <james@daa.com.au>.
* viewcvs/lib/viewcvs.py
(copy_stream): Use a slightly different mechanism for falling back
to sys.stdout (for standalone.py).
(view_doc): Send Last-modified headers for static content.
* viewcvs/standalone.py
Calculate the modification time of the Apache icons module.
(StandaloneServer.do_GET): Send that modification time.
(StandaloneServer.header): Send custom headers.
* viewcvs/lib/sapi.py
(CgiServer.addheader, AspServer.addheader, ModPythonServer.addheader): New.
(CgiServer.header): Fix the way statuses are returned.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@855 8cb11bc2-c004-0410-86c3-e597b4017df7
<David.Oxley@workplace-systems.plc.uk> on Subversion dev list
* lib/sapi.py (ModPythonServer.getenv): derive SCRIPT_NAME from apache
request instead of using mod_python's value
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@700 8cb11bc2-c004-0410-86c3-e597b4017df7
* lib/sapi.py standalone.py
changed sapi implementations of header() methods to accept status arguments
set to None
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@650 8cb11bc2-c004-0410-86c3-e597b4017df7
- Filled in ModPythonServer and AspServer header() methods to make use of
the new http 'status' parameter. Also, changed CgiServer's header()
method to ignore the status parameter under IIS to prevent the server
from discarding the ViewCVS output and instead sending a static error
page.
- ModPythonFile and AspFile classes have been eliminated and replaced
with a more generic File class. All server classes have new write()
and flush() methods.
- Common code from AspServer and ModPythonServer has been moved into
a base class called ThreadedServer. AspProxy is renamed to
ThreadedServerProxy.
- All server classes now inherit from a new base class called Server
which contains the small amount of code common to all of them.
- added fix_iis_path_info() function, renamed IIS_FixURL() to
fix_iis_url()
- renamed getFile() methods to file()
* lib/viewcvs.py
- Eliminated global server variable. Changed some scattered
server.escape() calls into cgi.escape() calls. Got around other uses
of the variable by adding a server member to the Request class.
- Deleted gstein's strongly worded comment about the quality of the sapi
hack :)
- Page-global 'g_name_printed' is now passed as a normal parameter
called 'name_printed' to the augment_entry() function
- Got rid of some confusing string manipulation in human_readable_diff()
- added 'server' parameter to viewcvs.main() to avoid relying on the
sapi.server global variable
* cgi/viewcvs.cgi, windows/viewcvs.py, windows/viewcvs.asp
- Added 'server' parameter to viewcvs.main() calls
* standalone.py:
- Changed StandaloneServer.header() method to accept http status code
- Added 'server' parameter to viewcvs.main() call
* lib/query.py
- added 'server' parameter to query.main() to avoid relying on the
sapi.server global variable
- got rid of global 'server' variable and page-global 'viewcvs_link'
variable, instead those values are passed as function parameters
* cgi/query.cgi, windows/query.py, windows/query.asp
- Added 'server' parameter to query.main() calls
* lib/debug.py
- Changed PrintStackTrace(), PrintException(), and DumpChildren() not to
rely on global sapi.server variable and to use new server.write()
method
* lib/popen.py
- changed server.getFile() calls to server.file()
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@642 8cb11bc2-c004-0410-86c3-e597b4017df7
broken when sapi was introduced.
* lib/debug.py:
- import 'sys' at the global level since it is fast enough, and we
also want to be able to grab the exc_info() without any imports
(ViewCVSException.__init__): rename var to 'status' as it represents
the HTTP Response Status rather than an "http code"
(ViewCVSException.__str__): revamp the output a bit for cleaner
display within a traceback.
(PrintException): grab the exception early, so that other code can't
overwrite it. if necessary, pass an HTTP response to
server.header(). tweak a bit of the exc_info() result handling.
tweak the generated output.
* lib/sapi.py:
(CgiServer.header): take and output an HTTP response status.
(AspServer.header): take an HTTP response status. don't worry about
returning 0/1 from the call (the result is unused)
(ModPythonServer.header): take an HTTP response status. drop the
return value.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@639 8cb11bc2-c004-0410-86c3-e597b4017df7
* 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-e597b4017df7