Update of /cvsroot/webware/Webware/WebKit
In directory sc8-pr-cvs1:/tmp/cvs-serv10158
Modified Files:
ASStreamOut.py Cookie.py ExceptionHandler.py
ThreadedAppServerService.py
Log Message:
docstring work
Index: ASStreamOut.py
===================================================================
RCS file: /cvsroot/webware/Webware/WebKit/ASStreamOut.py,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** ASStreamOut.py 27 Jan 2003 16:06:08 -0000 1.6
--- ASStreamOut.py 26 Mar 2003 00:49:32 -0000 1.7
***************
*** 15,30 ****
"""
This is a response stream to the client.
The key attributes of this class are:
! autoCommit: if True (1), the stream will automatically start sending data once
! it has accumulated bufferSize data. This means that it will ask the response
! to commit itself, without developer interaction.
!
! bufferSize: The size of the data buffer. This is only used when autocommit is true (1).
! If not using autocommit, the whole response is buffered and sent in one shot when the
! servlet is done..
!
! flush(): Send the accumulated response data now. Will ask the Response to commit if
! it hasn't already done so.
"""
--- 15,33 ----
"""
This is a response stream to the client.
+
The key attributes of this class are:
! `_autoCommit`:
! if True (1), the stream will automatically start sending data
! once it has accumulated `_bufferSize` data. This means that
! it will ask the response to commit itself, without developer
! interaction.
! `_bufferSize`:
! The size of the data buffer. This is only used when autocommit
! is true (1). If not using autocommit, the whole response is
! buffered and sent in one shot when the servlet is done.
! `flush()`:
! Send the accumulated response data now. Will ask the `Response`
! to commit if it hasn't already done so.
"""
***************
*** 39,45 ****
self._closed = 0
-
def autoCommit(self, val=0):
! """Get/Set the value of autoCommit."""
assert type(val) is types.IntType, "autoCommit must be an integer"
self._autoCommit = val
--- 42,52 ----
self._closed = 0
def autoCommit(self, val=0):
! # @@ 2003-03 ib: doing both get and set in the same
! # function is not good.
! """
! Get/Set the value of _autoCommit.
! """
!
assert type(val) is types.IntType, "autoCommit must be an integer"
self._autoCommit = val
***************
*** 47,50 ****
--- 54,58 ----
def bufferSize(self, size=8192):
+ # @@ 2003-03 ib: again, get/set not good
"""
Returns the size of the buffer, and sets a new size if one is
***************
*** 58,62 ****
"""
Send available data as soon as possible, ie Now
! Returns 1 if we are ready to send, otherwise 0
"""
assert not self._closed, "Trying to flush when already closed"
--- 66,71 ----
"""
Send available data as soon as possible, ie Now
! Returns 1 if we are ready to send, otherwise 0 (i.e.,
! if the buffer is full enough).
"""
assert not self._closed, "Trying to flush when already closed"
***************
*** 90,94 ****
def clear(self):
"""
! Try to clear any accumulated response data. Will fail if the response is already sommitted.
"""
if debug: print ">>> strmOut clear called"
--- 99,104 ----
def clear(self):
"""
! Try to clear any accumulated response data. Will fail
! if the response is already sommitted.
"""
if debug: print ">>> strmOut clear called"
***************
*** 151,155 ****
def needCommit(self):
"""
! Called by the HTTPResponse instance that is using this instance
to ask if the response needs to be prepared to be delivered.
The response should then commit it's headers, etc.
--- 161,165 ----
def needCommit(self):
"""
! Called by the `HTTPResponse` instance that is using this instance
to ask if the response needs to be prepared to be delivered.
The response should then commit it's headers, etc.
***************
*** 159,165 ****
def commit(self, autoCommit=1):
"""
! Called by the Response to tell us to go.
! If autoCommit is 1, then we will be placed into autoCommit mode.
"""
if debug: print ">>> ASStreamOut Committing"
self._committed = 1
--- 169,176 ----
def commit(self, autoCommit=1):
"""
! Called by the Response to tell us to go. If `_autoCommit`
! is 1, then we will be placed into autoCommit mode.
"""
+
if debug: print ">>> ASStreamOut Committing"
self._committed = 1
***************
*** 171,174 ****
--- 182,186 ----
Write a string to the buffer.
"""
+
if debug: print ">>> ASStreamOut writing %s characters" % len(charstr)
assert not self._closed, "Stream Already Closed"
Index: Cookie.py
===================================================================
RCS file: /cvsroot/webware/Webware/WebKit/Cookie.py,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** Cookie.py 8 Jan 2003 05:47:42 -0000 1.8
--- Cookie.py 26 Mar 2003 00:49:32 -0000 1.9
***************
*** 1,16 ****
from Common import *
! # If this is Python 2.2 or greater, import the standard Cookie module as CookieEngine.
! # Otherwise, import WebUtils.Cookie as CookieEngine. This is because there is a nasty
! # bug in the Cookie.py module included in Python 2.1 and earlier, and Python 1.5.2
! # doesn't even include Cookie.py at all.
pyVer = getattr(sys, 'version_info', None)
if pyVer and pyVer[:2] >= (2, 2):
! # Get Python's Cookie module.
! # We have to do some work since it has the same name as we do. So we'll strip out
! # anything from the path that might cause us to import from the WebKit directory, then
! # import Cookie using that restricted path -- that ought to ensure that we're using Python's
! # module.
import imp, string, sys
def ok(directory):
--- 1,17 ----
from Common import *
! # If this is Python 2.2 or greater, import the standard Cookie module
! # as CookieEngine. Otherwise, import WebUtils.Cookie as CookieEngine.
! # This is because there is a nasty bug in the Cookie.py module
! # included in Python 2.1 and earlier, and Python 1.5.2 doesn't even
! # include Cookie.py at all.
pyVer = getattr(sys, 'version_info', None)
if pyVer and pyVer[:2] >= (2, 2):
! # Get Python's Cookie module. We have to do some work since
! # it has the same name as we do. So we'll strip out anything
! # from the path that might cause us to import from the WebKit
! # directory, then import Cookie using that restricted path --
! # that ought to ensure that we're using Python's module.
import imp, string, sys
def ok(directory):
***************
*** 24,29 ****
file.close()
else:
! # For Python versions < 2.2, we are including a copy of the standard Cookie.py module from
! # Python 2.2, but modified to work with Python 1.5.2 and up.
from WebUtils import Cookie
CookieEngine = Cookie
--- 25,31 ----
file.close()
else:
! # For Python versions < 2.2, we are including a copy of the
! # standard Cookie.py module from Python 2.2, but modified to
! # work with Python 1.5.2 and up.
from WebUtils import Cookie
CookieEngine = Cookie
***************
*** 33,57 ****
class Cookie(Object):
"""
! Cookie is used to create cookies that have additional attributes beyond their value.
!
! Note that web browsers don't typically send any information with the cookie other than it's value. Therefore, in HTTPRequest, cookie() simply returns a value such as an integer or a string.
!
! When the server sends cookies back to the browser, it can send a cookie that simply has a value, or the cookie can be accompanied by various attributes (domain, path, max-age, ...) as described in RFC 2109. Therefore, in HTTPResponse, setCookie() can take either an instance of the Cookie class, as defined in this module, or a value.
!
! Note that Cookies values get pickled (see the pickle module), so you can set and get cookies that are integers, lists, dictionaries, etc.
! HTTP Cookies are officially described in RFC 2109:
! ftp://ftp.isi.edu/in-notes/rfc2109.txt
! FUTURE
! * This class should provide error checking in the setFoo() methods. Or maybe our internal Cookie implementation already does that?
! * This implementation is probably not as efficient as it should be, [a] it works and [b] the interface is stable. We can optimize later.
"""
! ## Init ##
def __init__(self, name, value):
self._cookies = CookieEngine.SmartCookie()
self._name = name
--- 35,75 ----
class Cookie(Object):
"""
! Cookie is used to create cookies that have additional
! attributes beyond their value.
! Note that web browsers don't typically send any information
! with the cookie other than it's value. Therefore
! `HTTPRequest.cookie` simply returns a value such as an
! integer or a string.
! When the server sends cookies back to the browser, it can send
! a cookie that simply has a value, or the cookie can be
! accompanied by various attributes (domain, path, max-age, ...)
! as described in `RFC 2109`_. Therefore, in HTTPResponse,
! `setCookie` can take either an instance of the Cookie class,
! as defined in this module, or a value.
! Note that Cookies values get pickled (see the `pickle` module),
! so you can set and get cookies that are integers, lists,
! dictionaries, etc.
! .. _`RFC 2109`: ftp://ftp.isi.edu/in-notes/rfc2109.txt
"""
! ## Future
! ##
! ## * This class should provide error checking in the setFoo()
! ## methods. Or maybe our internal Cookie implementation
! ## already does that?
! ## * This implementation is probably not as efficient as it
! ## should be, [a] it works and [b] the interface is stable.
! ## We can optimize later.
def __init__(self, name, value):
+ """
+ Create a cookie -- properties other than `name` and
+ `value` are set with methods.
+ """
+
self._cookies = CookieEngine.SmartCookie()
self._name = name
***************
*** 60,65 ****
self._cookie = self._cookies[name]
!
! ## Access attributes ##
def comment(self):
--- 78,84 ----
self._cookie = self._cookies[name]
! """
! **Accessors**
! """
def comment(self):
***************
*** 91,95 ****
! ## Setting attributes ##
def setComment(self, comment):
--- 110,116 ----
! """
! **Setters**
! """
def setComment(self, comment):
***************
*** 118,123 ****
self._cookie['version'] = version
! ## Convenience ##
def delete(self):
self._value = ''
self._cookie['expires'] = "Mon, 01-Jan-1900 00:00:00 GMT"
--- 139,156 ----
self._cookie['version'] = version
!
! """
! **Misc**
! """
!
def delete(self):
+ """
+ When sent, this should delete the cookie from the user's
+ browser, by making it empty, expiring it in the past,
+ and setting its max-age to 0. One of these will delete
+ the cookie for any browser (which one actually works
+ depends on the browser).
+ """
+
self._value = ''
self._cookie['expires'] = "Mon, 01-Jan-1900 00:00:00 GMT"
***************
*** 126,133 ****
- ## HTTP Headers ##
-
def headerValue(self):
! """ Returns a string with the value that should be used in the HTTP headers. """
items = self._cookies.items()
assert(len(items)==1)
--- 159,167 ----
def headerValue(self):
! """
! Returns a string with the value that should be
! used in the HTTP headers. """
!
items = self._cookies.items()
assert(len(items)==1)
***************
*** 135,138 ****
def headerString(self):
! """ @@ 2000-06-09 ce: Not typically needed now that raw responses are structured dictionaries instead of opaque strigns. headerValue() is used instead. """
return str(self._cookies)
--- 169,178 ----
def headerString(self):
! """ @@ 2000-06-09 ce: Not typically needed now that
! raw responses are structured dictionaries instead of
! opaque strigns. headerValue() is used instead.
!
! :ignore:
! """
!
return str(self._cookies)
Index: ExceptionHandler.py
===================================================================
RCS file: /cvsroot/webware/Webware/WebKit/ExceptionHandler.py,v
retrieving revision 1.28
retrieving revision 1.29
diff -C2 -d -r1.28 -r1.29
*** ExceptionHandler.py 4 Mar 2003 02:11:05 -0000 1.28
--- ExceptionHandler.py 26 Mar 2003 00:49:32 -0000 1.29
***************
*** 17,39 ****
After handling an exception, it should be removed.
! At some point, the exception handler sends "writeExceptionReport"
! to the transaction (if present), which in turn sends it to the other
! transactional objects (application, request, response, etc.)
! The handler is the single argument for this message.
! Classes may find it useful to do things like this:
! exceptionReportAttrs = 'foo bar baz'.split()
! def writeExceptionReport(self, handler):
! handler.writeTitle(self.__class__.__name__)
! handler.writeAttrs(self, self.exceptionReportAttrs)
The handler write methods that may be useful are:
! def write(self, s):
! def writeln(self, s):
! def writeTitle(self, s):
! def writeDict(self, d):
! def writeTable(self, listOfDicts, keys=None):
! def writeAttrs(self, obj, attrNames):
Derived classes must not assume that the error occured in a
--- 17,40 ----
After handling an exception, it should be removed.
! At some point, the exception handler sends
! `writeExceptionReport` to the transaction (if present), which
! in turn sends it to the other transactional objects
! (application, request, response, etc.) The handler is the
! single argument for this message.
! Classes may find it useful to do things like this::
! exceptionReportAttrs = 'foo bar baz'.split()
! def writeExceptionReport(self, handler):
! handler.writeTitle(self.__class__.__name__)
! handler.writeAttrs(self, self.exceptionReportAttrs)
The handler write methods that may be useful are:
!
! .. inline:: write
! .. inline:: writeTitle
! .. inline:: writeDict
! .. inline:: writeTable
! .. inline: writeAttrs
Derived classes must not assume that the error occured in a
***************
*** 41,50 ****
of transactions.
! See the WebKit.html documentation for other information.
!
!
! HOW TO CREATE A CUSTOM EXCEPTION HANDLER
! In the __init__.py of your context:
from WebKit.ExceptionHandler import ExceptionHandler as _ExceptionHandler
--- 42,48 ----
of transactions.
! **HOW TO CREATE A CUSTOM EXCEPTION HANDLER**
! In the ``__init__.py`` of your context::
from WebKit.ExceptionHandler import ExceptionHandler as _ExceptionHandler
***************
*** 75,78 ****
--- 73,83 ----
def __init__(self, application, transaction, excInfo,
formatOptions=None):
+ """
+ ExceptionHandler instances are created anew for
+ each exception. Instantiating ExceptionHandler
+ completes the process -- the caller need not
+ do anything else.
+ """
+
Object.__init__(self)
***************
*** 89,95 ****
self._formatOptions = formatOptions
! # Make some repairs, if needed. We use the transaction & response to get the error page back out
! # @@ 2000-05-09 ce: Maybe a fresh transaction and response should always be made for that purpose
! ## @@ 2003-01-10 sd: This requires a transaction which we do not have.
## Making remaining code safe for no transaction.
##
--- 94,106 ----
self._formatOptions = formatOptions
! # Make some repairs, if needed. We use the transaction
! # & response to get the error page back out
!
! # @@ 2000-05-09 ce: Maybe a fresh transaction and
! # response should always be made for that purpose
!
! ## @@ 2003-01-10 sd: This requires a transaction which
! ## we do not have.
!
## Making remaining code safe for no transaction.
##
***************
*** 107,117 ****
self.work()
!
! ## Utilities ##
def setting(self, name):
return self._app.setting(name)
def servletPathname(self):
try:
return self._tra.request().serverSidePath()
--- 118,136 ----
self.work()
! """
! **Accessors**
! """
def setting(self, name):
+ """
+ Settings are inherited from Application.
+ """
return self._app.setting(name)
def servletPathname(self):
+ """
+ The full filesystem path for the servlet.
+ """
+
try:
return self._tra.request().serverSidePath()
***************
*** 121,124 ****
--- 140,146 ----
def basicServletName(self):
+ """
+ The base name for the servlet (sans directory).
+ """
name = self.servletPathname()
if name is None:
***************
*** 127,135 ****
return os.path.basename(name)
!
! ## Exception handling ##
def work(self):
! ''' Invoked by __init__ to do the main work. '''
if self._res:
--- 149,167 ----
return os.path.basename(name)
! """
! **Exception Handling**
! """
def work(self):
! """
! Invoked by `__init__` to do the main work.
! This calls `logExceptionToConsole`, then checks
! settings to see if it should call `saveErrorPage`
! (to save the error to disk) and `emailException`.
!
! It also sends gives a page from `privateErrorPage`
! or `publicErrorPage` (which one based on
! ``ShowDebugInfoOnErrors``).
! """
if self._res:
***************
*** 164,168 ****
def logExceptionToConsole(self, stderr=None):
! ''' Logs the time, servlet name and traceback to the console (typically stderr). This usually results in the information appearing in console/terminal from which AppServer was launched. '''
if stderr is None:
stderr = sys.stderr
--- 196,206 ----
def logExceptionToConsole(self, stderr=None):
! """
! Logs the time, servlet name and traceback to the
! console (typically stderr). This usually results in
! the information appearing in console/terminal from
! which AppServer was launched.
! """
!
if stderr is None:
stderr = sys.stderr
***************
*** 172,175 ****
--- 210,219 ----
def publicErrorPage(self):
+ """
+ Returns a brief error pae telling the user that an
+ error has occurred. Body of the message comes from
+ ``UserErrorMessage`` setting.
+ """
+
return '''<html>
<head>
***************
*** 184,188 ****
def privateErrorPage(self):
! ''' Returns an HTML page intended for the developer with useful information such as the traceback. '''
html = ['''
<html>
--- 228,238 ----
def privateErrorPage(self):
! """
! Returns an HTML page intended for the developer with
! useful information such as the traceback. '''
!
! Most of the contents are generated in `htmlDebugInfo`.
! """
!
html = ['''
<html>
***************
*** 200,204 ****
def htmlDebugInfo(self):
! ''' Return HTML-formatted debugging information about the current exception. '''
self.html = []
self.writeHTML()
--- 250,259 ----
def htmlDebugInfo(self):
! """
! Return HTML-formatted debugging information about the
! current exception. Calls `writeHTML`, which uses
! ``self.write(...)`` to add content.
! """
!
self.html = []
self.writeHTML()
***************
*** 208,211 ****
--- 263,275 ----
def writeHTML(self):
+ """
+ Writes all the parts of the traceback, invoking:
+ * `writeTraceback`
+ * `writeMiscInfo`
+ * `writeTransaction`
+ * `writeEnvironment`
+ * `writeIds`
+ * `writeFancyTraceback`
+ """
self.writeTraceback()
self.writeMiscInfo()
***************
*** 215,248 ****
self.writeFancyTraceback()
!
! ## Write utility methods ##
def write(self, s):
self.html.append(str(s))
def writeln(self, s):
self.html.append(str(s))
self.html.append('\n')
def writeTitle(self, s):
self.writeln(htTitle(s))
def writeDict(self, d):
self.writeln(htmlForDict(d, filterValueCallBack=self.filterDictValue, maxValueLength=self._maxValueLength))
def writeTable(self, listOfDicts, keys=None):
"""
! Writes a table whose contents are given by listOfDicts. The
! keys of each dictionary are expected to be the same. If the
! keys arg is None, the headings are taken in alphabetical order
! from the first dictionary. If listOfDicts is "false", nothing
happens.
! The keys and values are already considered to be HTML.
Caveat: There's no way to influence the formatting or to use
column titles that are different than the keys.
! Note: Used by writeAttrs().
"""
if not listOfDicts:
--- 279,328 ----
self.writeFancyTraceback()
! """
! **Write Methods**
! """
def write(self, s):
+ """
+ Write `s` to the body
+ """
self.html.append(str(s))
def writeln(self, s):
+ """
+ Write `s` plus a newline
+ """
self.html.append(str(s))
self.html.append('\n')
def writeTitle(self, s):
+ """
+ Write a title line (a sub-heading, really, to define
+ a section)
+ """
self.writeln(htTitle(s))
def writeDict(self, d):
+ """
+ Write a table-formated dictionary
+ """
self.writeln(htmlForDict(d, filterValueCallBack=self.filterDictValue, maxValueLength=self._maxValueLength))
def writeTable(self, listOfDicts, keys=None):
"""
! Writes a table whose contents are given by
! `listOfDicts`. The keys of each dictionary are
! expected to be the same. If the `keys` arg is None,
! the headings are taken in alphabetical order from the
! first dictionary. If listOfDicts is false, nothing
happens.
! The keys and values are already considered to be HTML,
! and no quoting is applied.
Caveat: There's no way to influence the formatting or to use
column titles that are different than the keys.
! Used by `writeAttrs`
"""
if not listOfDicts:
***************
*** 270,275 ****
"""
Writes the attributes of the object as given by attrNames.
! Tries obj._name first, followed by obj.name(). Is resilient
! regarding exceptions so as not to spoil the exception report.
"""
rows = []
--- 350,356 ----
"""
Writes the attributes of the object as given by attrNames.
! Tries ``obj._name` first, followed by ``obj.name()``.
! Is resilient regarding exceptions so as not to spoil the
! exception report.
"""
rows = []
***************
*** 295,302 ****
self.writeTable(rows, ('attr', 'value'))
!
! ## Write specific parts ##
def writeTraceback(self):
self.writeTitle('Traceback')
self.write('<p> <i>%s</i>' % self.servletPathname())
--- 376,389 ----
self.writeTable(rows, ('attr', 'value'))
! """
! **Traceback sections**
! """
def writeTraceback(self):
+ """
+ Writes the traceback, with most of the work done
+ by `WebUtils.HTMLForException.HTMLForException`
+ """
+
self.writeTitle('Traceback')
self.write('<p> <i>%s</i>' % self.servletPathname())
***************
*** 304,307 ****
--- 391,399 ----
def writeMiscInfo(self):
+ """
+ Write a couple little pieces of information about
+ the environment.
+ """
+
self.writeTitle('MiscInfo')
info = {
***************
*** 314,317 ****
--- 406,413 ----
def writeTransaction(self):
+ """
+ Lets the transaction talk about itself, using
+ `Transaction.writeExceptionReport`
+ """
if self._tra:
self._tra.writeExceptionReport(self)
***************
*** 321,332 ****
--- 417,442 ----
def writeEnvironment(self):
+ """
+ Writes the environment this is being run in. This
+ is *not* the environment that was passed in with
+ the request (holding the CGI information) -- it's
+ just the information from the environment that the
+ AppServer is being executed in.
+ """
self.writeTitle('Environment')
self.writeDict(os.environ)
def writeIds(self):
+ """
+ Prints some values from the OS (like processor ID)
+ """
self.writeTitle('Ids')
self.writeTable(osIdTable(), ['name', 'value'])
def writeFancyTraceback(self):
+ """
+ Writes a fancy traceback, using cgitb
+ """
+
if self.setting('IncludeFancyTraceback'):
self.writeTitle('Fancy Traceback')
***************
*** 342,346 ****
def saveErrorPage(self, html):
! ''' Saves the given HTML error page for later viewing by the developer, and returns the filename used. '''
filename = self._app.serverSidePath(os.path.join(self.setting('ErrorMessagesDir'), self.errorPageFilename()))
f = open(filename, 'w')
--- 452,459 ----
def saveErrorPage(self, html):
! """
! Saves the given HTML error page for later viewing by
! the developer, and returns the filename used. """
!
filename = self._app.serverSidePath(os.path.join(self.setting('ErrorMessagesDir'), self.errorPageFilename()))
f = open(filename, 'w')
***************
*** 350,362 ****
def errorPageFilename(self):
! ''' Construct a filename for an HTML error page, not including the 'ErrorMessagesDir' setting. '''
return 'Error-%s-%s-%d.html' % (
self.basicServletName(),
string.join(map(lambda x: '%02d' % x, localtime(self._time)[:6]), '-'),
whrandom.whrandom().randint(10000, 99999))
! # @@ 2000-04-21 ce: Using the timestamp & a random number is a poor technique for filename uniqueness, but this works for now
def logExceptionToDisk(self, errorMsgFilename=''):
! ''' Writes a tuple containing (date-time, filename, pathname, exception-name, exception-data,error report filename) to the errors file (typically 'Errors.csv') in CSV format. Invoked by handleException(). '''
logline = (
asctime(localtime(self._time)),
--- 463,486 ----
def errorPageFilename(self):
! """
! Construct a filename for an HTML error page, not
! including the ``ErrorMessagesDir`` setting
! (which `saveError` adds on)"""
!
return 'Error-%s-%s-%d.html' % (
self.basicServletName(),
string.join(map(lambda x: '%02d' % x, localtime(self._time)[:6]), '-'),
whrandom.whrandom().randint(10000, 99999))
! # @@ 2000-04-21 ce: Using the timestamp & a
! # random number is a poor technique for
! # filename uniqueness, but this works for now
def logExceptionToDisk(self, errorMsgFilename=''):
! """
! Writes a tuple containing (date-time, filename,
! pathname, exception-name, exception-data,error report
! filename) to the errors file (typically 'Errors.csv')
! in CSV format. Invoked by `handleException`. """
!
logline = (
asctime(localtime(self._time)),
***************
*** 386,389 ****
--- 510,518 ----
def emailException(self, htmlErrMsg):
+ """
+ Emails the exception, either as an attachment, or in the
+ body of the mail.
+ """
+
message = StringIO.StringIO()
writer = MimeWriter.MimeWriter(message)
***************
*** 437,443 ****
! ## Filtering Values ##
def filterDictValue(self, value, key, dict):
return self.filterValue(value, key)
--- 566,579 ----
! """
! **Filtering**
! """
def filterDictValue(self, value, key, dict):
+ """
+ Filters keys from a dict. Currently ignores the
+ dictionary, and just filters based on the key.
+ """
+
return self.filterValue(value, key)
***************
*** 467,477 ****
! ## Self utility ##
def repr(self, x):
"""
! Returns the repr() of x already html encoded. As a special case, dictionaries are nicely formatted in table.
! This is a utility method for writeAttrs.
"""
if type(x) is DictType:
--- 603,617 ----
! """
! **Utility**
! """
def repr(self, x):
"""
! Returns the repr() of x already html encoded. As a
! special case, dictionaries are nicely formatted in
! table.
! This is a utility method for `writeAttrs`.
"""
if type(x) is DictType:
***************
*** 486,489 ****
--- 626,633 ----
# Some misc functions
def htTitle(name):
+ """
+ Formats a `name` as a section title
+ """
+
return '''
<p> <br> <table border=0 cellpadding=4 cellspacing=0 bgcolor=#A00000 width=100%%> <tr> <td align=center>
***************
*** 493,499 ****
def osIdTable():
! ''' Returns a list of dictionaries contained id information such as uid, gid, etc.,
! all obtained from the os module. Dictionary keys are 'name' and 'value'. '''
! funcs = ['getegid', 'geteuid', 'getgid', 'getpgrp', 'getpid', 'getppid', 'getuid']
table = []
for funcName in funcs:
--- 637,647 ----
def osIdTable():
! """
! Returns a list of dictionaries contained id information such
! as uid, gid, etc., all obtained from the os module. Dictionary
! keys are ``"name"`` and ``"value"``. """
!
! funcs = ['getegid', 'geteuid', 'getgid', 'getpgrp', 'getpid',
! 'getppid', 'getuid']
table = []
for funcName in funcs:
Index: ThreadedAppServerService.py
===================================================================
RCS file: /cvsroot/webware/Webware/WebKit/ThreadedAppServerService.py,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** ThreadedAppServerService.py 6 Dec 2002 20:09:26 -0000 1.9
--- ThreadedAppServerService.py 26 Mar 2003 00:49:32 -0000 1.10
***************
*** 3,12 ****
ThreadedAppServerService
! For general notes, see ThreadedAppServer.py.
This version of the app server is a threaded app server that runs as
a Windows NT Service. This means it can be started and stopped from
! the Control Panel or from the command line using "net start" and
! "net stop", and it can be configured in the Control Panel to
auto-start when the machine boots.
--- 3,12 ----
ThreadedAppServerService
! For general notes, see `ThreadedAppServer`.
This version of the app server is a threaded app server that runs as
a Windows NT Service. This means it can be started and stopped from
! the Control Panel or from the command line using ``net start`` and
! ``net stop``, and it can be configured in the Control Panel to
auto-start when the machine boots.
***************
*** 16,53 ****
the service, just run this program with no arguments. Typical usage is
to install the service to run under a particular user account and startup
! automatically on reboot with
! python ThreadedAppServerService.py --username mydomain\myusername --password mypassword --startup auto install
Then, you can start the service from the Services applet in the Control Panel,
where it will be listed as "WebKit Threaded Application Server". Or, from
! the command line, it can be started with either of the following commands:
!
! net start WebKit
! python ThreadedAppServerService.py start
! The service can be stopped from the Control Panel or with:
! net stop WebKit
! python ThreadedAppServerService.py stop
! And finally, to uninstall the service, stop it and then run:
! python ThreadedAppServerService.py remove
! FUTURE
! * This shares a lot of code with ThreadedAppServer.py --
! instead it should inherit from ThreadedAppServer and have
! very little code of its own.
! * Have an option for sys.stdout and sys.stderr to go to a logfile instead
! of going nowhere.
! * Optional NT event log messages on start, stop, and errors.
! * Allow the option of installing multiple copies of WebKit with
! different configurations and different service names.
! * Figure out why I need the Python service hacks marked with ### below.
! * Allow it to work with wkMonitor, or some other fault tolerance
! mechanism.
"""
import time
startTime = time.time()
--- 16,55 ----
the service, just run this program with no arguments. Typical usage is
to install the service to run under a particular user account and startup
! automatically on reboot with::
! python ThreadedAppServerService.py --username mydomain\myusername \
! --password mypassword --startup auto install
Then, you can start the service from the Services applet in the Control Panel,
where it will be listed as "WebKit Threaded Application Server". Or, from
! the command line, it can be started with either of the following commands::
! net start WebKit
! python ThreadedAppServerService.py start
! The service can be stopped from the Control Panel or with::
! net stop WebKit
! python ThreadedAppServerService.py stop
! And finally, to uninstall the service, stop it and then run::
! python ThreadedAppServerService.py remove
"""
+ ## FUTURE
+ ## * This shares a lot of code with ThreadedAppServer.py --
+ ## instead it should inherit from ThreadedAppServer and have
+ ## very little code of its own.
+ ## * Have an option for sys.stdout and sys.stderr to go to a logfile
+ ## instead of going nowhere.
+ ## * Optional NT event log messages on start, stop, and errors.
+ ## * Allow the option of installing multiple copies of WebKit with
+ ## different configurations and different service names.
+ ## * Figure out why I need the Python service hacks marked with ### below.
+ ## * Allow it to work with wkMonitor, or some other fault tolerance
+ ## mechanism.
+
+
import time
startTime = time.time()
***************
*** 57,60 ****
--- 59,63 ----
class ThreadedAppServerService(win32serviceutil.ServiceFramework):
+
_svc_name_ = 'WebKit'
_svc_display_name_ = 'WebKit Threaded Application Server'
|