Hi,

upgrading to 0.8 broke my application, please see test code below. The problem
is that MiddleObjects don't seem to get a Klass assigned if created within the
Application server.

Below is a test code that runs as a "Page" subclass servelet as well as from
the command line. In the first case, a newly creatend MiddleObject instance
(which is created after initializing the Store) has no Klass, in the second
case, it does.

In 0.7, the newly created MiddleObject instance have a Klass() in both
cases,

M

-----------------------------------------------------------snip
import sys

if not '/usr/local/Webware' in sys.path :
        sys.path.append('/usr/local/Webware')

if not '/usr/local/Bottino' in sys.path :
        sys.path.append('/usr/local/Bottino')

def getstore() :
    from MiddleKit.Run.MySQLObjectStore import MySQLObjectStore
    sto=MySQLObjectStore(user="wwwrun",passwd="*****",host="localhost")
    sto.readModelFileNamed("/usr/local/Bottino/Bottino")
    return sto

def getss() :
    # this can be any MiddleObject
    from StorySet import StorySet
    return StorySet()


from WebKit.Page import Page
from Misc import htmlEncode

# ------------ within ApplicationServer

class page(Page):


    def writeContent(self) :
        sto=getstore()
        ss=getss()
        try :
            self.write("ss.klass(): %s" % htmlEncode(ss.klass()))
        except Exception, e :
            self.write("klass() raised %s" % htmlEncode(e))
        self.write("<BR>")
        self.write("<PRE>")
        sto.dumpKlassIds(out=self)
        self.write("</PRE>")


# --------- without application server

if __name__ == '__main__' :
    sto=getstore()
    ss=getss()
    # this one works!
    print ss.klass()
    sto.dumpKlassIds()

-----------------------------------------------------------snip



-- Martin Virtel
[EMAIL PROTECTED]
aim / yahoo messenger mvftd
tel. +49 177 242 2889


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to