"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "lib/sapi.py" between
viewvc-1.1.28.tar.gz and viewvc-1.2.1.tar.gz

About: ViewVC is a browser interface for CVS and Subversion version control repositories.

sapi.py  (viewvc-1.1.28):sapi.py  (viewvc-1.2.1)
skipping to change at line 19 skipping to change at line 19
# For more information, visit http://viewvc.org/ # For more information, visit http://viewvc.org/
# #
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
# #
# generic server api - currently supports normal cgi, mod_python, and # generic server api - currently supports normal cgi, mod_python, and
# active server pages # active server pages
# #
# ----------------------------------------------------------------------- # -----------------------------------------------------------------------
import types import types
import string
import os import os
import sys import sys
import re import re
import cgi import cgi
# global server object. It will be either a CgiServer, a WsgiServer, # global server object. It will be either a CgiServer, a WsgiServer,
# or a proxy to an AspServer or ModPythonServer object. # or a proxy to an AspServer or ModPythonServer object.
server = None server = None
# Simple HTML string escaping. Note that we always escape the # Simple HTML string escaping. Note that we always escape the
# double-quote character -- ViewVC shouldn't ever need to preserve # double-quote character -- ViewVC shouldn't ever need to preserve
# that character as-is, and sometimes needs to embed escaped values # that character as-is, and sometimes needs to embed escaped values
# into HTML attributes. # into HTML attributes.
def escape(s): def escape(s):
s = str(s) s = str(s)
s = string.replace(s, '&', '&') s = s.replace('&', '&')
s = string.replace(s, '>', '>') s = s.replace('>', '>')
s = string.replace(s, '<', '&lt;') s = s.replace('<', '&lt;')
s = string.replace(s, '"', "&quot;") s = s.replace('"', "&quot;")
return s return s
class Server: class Server:
def __init__(self): def __init__(self):
self.pageGlobals = {} self.pageGlobals = {}
def self(self): def self(self):
return self return self
def escape(self, s): def escape(self, s):
skipping to change at line 206 skipping to change at line 205
self._environ = environ self._environ = environ
self._start_response = start_response; self._start_response = start_response;
self._headers = [] self._headers = []
self._wsgi_write = None self._wsgi_write = None
self.headerSent = False self.headerSent = False
global server global server
server = self server = self
global cgi
import cgi
def addheader(self, name, value): def addheader(self, name, value):
self._headers.append((name, value)) self._headers.append((name, value))
def header(self, content_type='text/html; charset=UTF-8', status=None): def header(self, content_type='text/html; charset=UTF-8', status=None):
if not status: if not status:
status = "200 OK" status = "200 OK"
if not self.headerSent: if not self.headerSent:
self.headerSent = True self.headerSent = True
self._headers.insert(0, ("Content-Type", content_type),) self._headers.insert(0, ("Content-Type", content_type),)
self._wsgi_write = self._start_response("%s" % status, self._headers) self._wsgi_write = self._start_response("%s" % status, self._headers)
 End of changes. 3 change blocks. 
8 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)