Commit Graph

28 Commits (f48add83f7d3ee999dc582312f9b3afc7fdb2a5c)

Author SHA1 Message Date
cmpilato f48add83f7 Bump copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2820 8cb11bc2-c004-0410-86c3-e597b4017df7
2013-01-04 19:01:54 +00:00
cmpilato 9e9b82218c Bump copyright years.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2720 8cb11bc2-c004-0410-86c3-e597b4017df7
2012-01-23 17:52:47 +00:00
cmpilato d6a4d294fb Fix the query script's WSGI and FastCGI deployments.
* 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
2010-09-09 14:10:35 +00:00
cmpilato a5df176395 Wow. Drop a "general code cleanup" kind of bomb on the codebase. All
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
2010-09-03 16:49:52 +00:00
cmpilato b922b3604d Fix issue #454 - AttributeError exception trying to escape non-string input.
* 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
2010-05-06 13:51:30 +00:00
cmpilato 1da4f1a0e3 Copyright bumps only.
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2349 8cb11bc2-c004-0410-86c3-e597b4017df7
2010-03-29 15:30:00 +00:00
cmpilato 8af29de901 There were too many ways to do something as simple as HTML escaping in
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
2010-03-11 19:56:22 +00:00
cmpilato f182d12e97 As part of issue #397, add initial support for mod_wsgi deployments.
* lib/sapi.py
  (WsgiServer): New class.

* bin/wsgi,
* bin/wsgi/viewvc.wsgi,
* bin/wsgi/query.wsgi
  New stubs.

* viewvc-install
  (FILE_INFO_LIST): Also install WSGI scripts.

* INSTALL
  Add instructions for WSGI deployment.

Patch (mostly) by: Rune Halvorsen <runefh{_AT_}gmail.com>

git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@2271 8cb11bc2-c004-0410-86c3-e597b4017df7
2009-10-08 14:56:25 +00:00
cmpilato 8e848a4025 Finish issue #415 - ModPythonServer shouldn't call sys.exit().
(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
2009-06-16 15:04:24 +00:00
cmpilato 8845bc551f Merge security fix made in r1446 from 1.0.x to trunk. That log message read:
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
2006-10-13 20:48:05 +00:00
rey4 3efd3fa040 Clean for file headers and copyright notices for issue 167
* bin/asp/query.asp
* bin/asp/viewvc.asp
* bin/cgi/query.cgi
* bin/cgi/viewvc.cgi
* bin/cvsdbadmin
* bin/loginfo-handler
* bin/make-database
* bin/mod_python/handler.py
* bin/mod_python/query.py
* bin/mod_python/viewvc.py
* bin/standalone.py
* bin/svndbadmin
* lib/accept.py
* lib/blame.py
* lib/compat.py
* lib/config.py
* lib/cvsdb.py
* lib/dbi.py
* lib/debug.py
* lib/idiff.py
* lib/popen.py
* lib/query.py
* lib/sapi.py
* lib/vclib/__init__.py
* lib/vclib/bincvs/__init__.py
* lib/vclib/ccvs/__init__.py
* lib/vclib/ccvs/blame.py
* lib/vclib/ccvs/rcsparse/__init__.py
* lib/vclib/ccvs/rcsparse/common.py
* lib/vclib/ccvs/rcsparse/debug.py
* lib/vclib/ccvs/rcsparse/default.py
* lib/vclib/ccvs/rcsparse/texttools.py
* lib/vclib/svn/__init__.py
* lib/vclib/svn_ra/__init__.py
* lib/viewvc.py
* lib/win32popen.py
* tools/make-release
* tparse/tparse.cpp
* tparse/tparse.h
* tparse/tparsemodule.cpp
* tparse/tparsemodule.h
* viewcvs-install


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1288 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-18 02:07:36 +00:00
rey4 f74711446f Finish issue 168, the project rename. Change is mostly based on the patch
from Gerard Gerritsen (sigcafe), with some other stuff thrown in.

* bin/asp/viewcvs.asp
* bin/asp/viewvc.asp
* bin/cgi/viewcvs-strace.sh
* bin/cgi/viewvc-strace.sh
* bin/cgi/viewcvs.cgi
* bin/cgi/viewvc.cgi
* bin/mod_python/viewcvs.py
* bin/mod_python/viewvc.py
* lib/viewcvs.py
* lib/viewvc.py
* viewcvs.conf.dist
* viewvc.conf.dist
    the file renames

* bin/cvsdbadmin
* bin/loginfo-handler
* bin/svndbadmin
* bin/asp/query.asp
* bin/cgi/query.cgi
* bin/mod_python/query.py
* bin/make-database
* bin/standalone.py
* lib/debug.py
* lib/compat.py
* lib/blame.py
* lib/vclib/ccvs/rcsparse/debug.py
* lib/vclib/bincvs/__init__.py
* lib/query.py
* lib/config.py
* lib/dbi.py
* lib/sapi.py
* INSTALL
* TODO
* cvsgraph.conf.dist
* tests/timelog.py
* tools/make-release
* tparse/tparsemodule.h
* tparse/Setup.py
* tparse/INSTALL
* tparse/tparsemodule.cpp
* tparse/tparse.h
* tparse/tparse.cpp
* windows/README
* viewcvs-install
* viewvc.org/index.html
* viewvc.org/contributing.html
* viewvc.org/template-authoring-guide.html
* viewvc.org/upgrading.html
* viewvc.org/license-1.html
    the other changes



git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1287 8cb11bc2-c004-0410-86c3-e597b4017df7
2006-03-18 00:33:54 +00:00
rey4 b91146fee0 Work on issue 168, s/ViewCVS/ViewVC. This patch changes references to
ViewCVS in comments, strings, and documentation. References to ViewCVS
in filenames and urls still need to be fixed. Also, logo.png (the blimp)
needs to be updated or replaced.

This patch is by Gerard Gerritsen (sigcafe), the only change I've made is
to restore a reference to ViewCVS in a comment about backwards compatibility.

* windows/README
* viewcvs-install
* README
* templates/include/footer.ezt
* templates/include/header.ezt
* templates/error.ezt
* templates/query.ezt
* templates/docroot/help.css
* templates/docroot/help_query.html
* templates/docroot/help_dirview.html
* templates/docroot/help_rootview.html
* templates/docroot/styles.css
* templates/docroot/help_log.html
* templates/diff.ezt
* tools/make-release
* lib/sapi.py
* lib/dbi.py
* lib/accept.py
* lib/cvsdb.py
* lib/config.py
* lib/query.py
* lib/vclib/bincvs/__init__.py
* lib/vclib/svn/__init__.py
* lib/vclib/__init__.py
* lib/vclib/svn_ra/__init__.py
* lib/vclib/ccvs/rcsparse/common.py
* lib/vclib/ccvs/rcsparse/__init__.py
* lib/vclib/ccvs/rcsparse/default.py
* lib/vclib/ccvs/rcsparse/texttools.py
* lib/vclib/ccvs/rcsparse/debug.py
* lib/vclib/ccvs/__init__.py
* lib/vclib/ccvs/blame.py
* lib/blame.py
* lib/popen.py
* lib/compat.py
* lib/viewcvs.py
* lib/debug.py
* INSTALL
* bin/standalone.py
* bin/make-database
* bin/mod_python/query.py
* bin/mod_python/viewcvs.py
* bin/cgi/query.cgi
* bin/cgi/viewcvs.cgi
* bin/asp/query.asp
* bin/asp/viewcvs.asp
* bin/svndbadmin
* bin/loginfo-handler
* bin/cvsdbadmin
* viewcvs.conf.dist


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1200 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-12-17 17:19:28 +00:00
cmpilato a27d1016c9 Miscellaneous tweaks.
* 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
2005-10-19 20:38:33 +00:00
rey4 4504b5fc3d Make redirects work better with the standalone server
* lib/sapi.py
  (CgiServer.redirect):
    use addheader() method instead of printing headers literally


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@1018 8cb11bc2-c004-0410-86c3-e597b4017df7
2005-02-03 13:07:16 +00:00
cmpilato 8f9c8de036 Make ViewCVS more cache-friendly. Patch by James Henstridge
<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
2004-06-03 15:42:04 +00:00
cmpilato da2822ecf0 Sending caching headers back to the browser for static content to
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
2004-05-24 22:57:30 +00:00
rey4 e891a6f0ca Remove workaround for Mod_Python bug fixed in new version 3.0.4
* lib/sapi.py:
  (ModPythonServer.getenv):
    Farewell SCRIPT_NAME bug, we hardly knew ye.


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@776 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-12-10 07:53:42 +00:00
rey4 bdc40661f6 fixed mod_python bug reported by David Oxley
<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
2003-08-18 15:01:36 +00:00
rey4 d35d170619 explicitly set mod_python's default content-type to text/html to prevent
it from automatically deducing different values


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@654 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-06-02 04:42:30 +00:00
rey4 870580afb4 cvs ci standalone.py lib/sapi.py
* 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
2003-05-27 02:46:53 +00:00
rey4 459ed3fea3 * lib/sapi.py
- 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
2003-03-12 23:08:09 +00:00
gstein f30b808cc7 Restore the ability for errors to generate non-200 responses. This was
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
2003-03-11 23:11:57 +00:00
gstein d51c87a71a 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-e597b4017df7
2003-03-11 20:43:06 +00:00
rey4 358a5c2aa5 got rid of unneccessary imports
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@619 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-19 05:33:07 +00:00
rey4 5a7ae45fa1 minor changes to sapi interface for mod_python support
git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@611 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-18 11:54:41 +00:00
rey4 0ecbd1d45d - added sapi.server.pageGlobals dictionary to hold values and objects that
need to be kept for the duration of a page load


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@596 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-11 02:54:53 +00:00
rey4 e7cb800f6d added new sapi module which abstracts away differences between the different
server environments that ViewCVS runs on (CGI, ASP, standalone)


git-svn-id: http://viewvc.tigris.org/svn/viewvc/trunk@589 8cb11bc2-c004-0410-86c3-e597b4017df7
2003-02-09 09:48:05 +00:00