Zitat von Ian Bicking <[EMAIL PROTECTED]>:   
   
> On Wed, 2003-03-19 at 11:01, Russell von Blank wrote:   
> > I do not mean to ask the question a second time, but I have looked over   
> the   
> > existing documentation and have not discovered any reference to   
> customizing   
> > the error page.  I can change the code inside webkit, but then that would   
> > have to be adjusted everytime there is a new release, etc.  Is there a   
> > "standard" way to implement a custom error page through inheritence?   
>    
> Sorry no one answered your question before.  Disappointingly, no, there   
> isn't any good way to do this.  The code in question is in   
> WebKit.ExceptionHandler, if that's any help.   
>    
>   Ian   
>    
   
Hi Ian,   
   
I think there is a way of elegance to customize Webware-core-code: by using  
the function contextInitialize in the context __init__.py ;-)   
   
Combined with the MixIn-class in MiscUtils.MixIn it's possible to reimplement   
anything you want, as long as you know that it must be thread-saved.   
   
--- start snippet __init__.py of context ---   
  
# Necessary futures  
  
# Necessary imports  
import sys  
import os  
import socket  
import errno  
from types import *  
  
from MiscUtils.MixIn import MixIn  
from WebKit.Common import *  
from WebKit.ThreadedAppServer import TASASStreamOut  
# Necessary module constants  
  
# For testing and debugging purposes:  
  
  
  
def contextInitialize(appServer, path):  
    """  
      
    """  
    sys.path.append(os.path.abspath('.'))  
    MixIn(TASASStreamOut, TASASStreamOutMixIn)  
    MixIn(Application, ApplicationMixIn)  
    MixIn(ExceptionHandler, ExceptionHandlerMixIn)  
      
  
from WebKit.ExceptionHandler import ExceptionHandler  
class ExceptionHandlerMixIn(Object):  
      
    """  
      
      
    """  
      
    def writeHTML(self):  
        self.writeFancyTraceback()  
        self.writeMiscInfo()  
        self.writeTransaction()  
        self.writeEnvironment()  
        self.writeIds()  
        self.writeTraceback()  
  
          
from WebKit.ASStreamOut import ASStreamOut  
class TASASStreamOutMixIn(ASStreamOut):  
  
    """  
  
    """  
      
    def __init__(self, sock):  
  
        ASStreamOut.__init__(self)  
        self._socket = sock  
  
    def flush(self):  
  
        debug=0  
        result = ASStreamOut.flush(self)  
        if result: ##a true return value means we can send  
            reslen = len(self._buffer)  
            if debug: print "TASASStreamout is sending %s bytes" % reslen  
            sent = 0  
              
            while sent < reslen:  
                try:  
                    sent = sent +  
self._socket.send(self._buffer[sent:sent+8192])  
                      
                    #if __test__:  
                    #traceExpression.watch('data send...')  
                      
                except socket.error, e:  
                    if e[0]==errno.EPIPE: #broken pipe  
                          
                        # ^ @@ 2002.01.25 ede: Necessary for client  
abortion!!!  
                        raise  
                         #pass  
                    else:  
                        print "StreamOut Error: ", e  
                    break  
            self.pop(sent)  
  
  
from WebKit.Application import Application  
class ApplicationMixIn:  
    """  
    """  
      
    def shutDown(self):  
        """  
        Called by AppServer when it is shuting down.  The __del__ function of  
Application probably won't be called due to circular references.  
        """  
        print "Application is Shutting Down"  
        self.running = 0  
        if hasattr(self, '_sessSweepThread'):  
            # We don't always have this, hence the 'if' above  
            self._closeEvent.set()  
            self._sessSweepThread.join()  
            del self._sessSweepThread  
            self._sessions.storeAllSessions()  
            if self._server.isPersistent():  
                self.taskManager().stop()  
            del self._sessions  
            del self._factoryByExt  
            del self._factoryList  
            del self._server  
            del self._servletCacheByPath  
            # @@ 2002.02.18: Close all connection to database  
            if getattr(self, '_dbPool', None):  
                self._dbPool.shutDown()  
                          
            print "Application has been succesfully shutdown."  
                  
    def getDbConnection(self):  
        """  
        """  
        if not getattr(self, '_dbPool', None):  
            from MiscUtils.DBPool import DBPool  
            self._dbPool = DBPool(  
                           # our DB-API v2.0 module:  
                           __import__('DCOracle2'),  
                           # number of concurrent connections:  
                           5,  
                           # DB module connection string:  
                           'BUGTRACK/<xxx>@<xxx>')  
                          
                                  
        return self._dbPool.getConnection()     # may block   
  
--- end snippet ---  
  
Ian, now my question: is the getDbConnection-method thread-saved? I hope so...  
  
Greetings,  
  
Markus  
   
>    
>    
>    
> -------------------------------------------------------   
> This SF.net email is sponsored by: Tablet PC.     
> Does your code think in ink? You could win a Tablet PC.    
> Get a free Tablet PC hat just for playing. What are you waiting for?    
> http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en   
> _______________________________________________   
> Webware-devel mailing list   
> [EMAIL PROTECTED]   
> https://lists.sourceforge.net/lists/listinfo/webware-devel   
>    
   
   
--    
merlin.zwo InfoDesign GmbH & Co KG    
Tagloehnergaerten 43    
76228 Karlsruhe    
    
Email: [EMAIL PROTECTED]    
Fon:   0721 / 7907171    
Fax:   0721 / 7907199    
WWW:   http://www.merlin-zwo.de    
    
    

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/


-------------------------------------------------------
This SF.net email is sponsored by: Tablet PC.  
Does your code think in ink? You could win a Tablet PC. 
Get a free Tablet PC hat just for playing. What are you waiting for? 
http://ads.sourceforge.net/cgi-bin/redirect.pl?micr5043en
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to