Hi, I think there may be a bug in the generation of MK objects. Based on my previous email (see below), the generated code looks like this:
29 def company(self): 30 if self._company is not None and type(self._company) is not InstanceType: 31 self.__dict__['_company'] = self._mk_store.fetchObjRef(self._company) 32 return self._company Line 30 should read (notice the "is not None") 30 if self._company is None and type(self._company) is not InstanceType: Is anyone else seeing this ? Thanks Huy > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Huy Do > Sent: Thursday, 31 January 2002 4:10 PM > To: webware-discuss > Subject: [Webware-discuss] MiddleKit Question > > > Hi, > > I am having two problems with MiddleKit. > > 1. When i try and run the following code in a Webware servlet, I get an > error saying there is no such module 'model.Client' > ---------------------------------------------- > clients = store.fetchObjectsOfClass('Client') > ---------------------------------------------- > > however if i add this line before it, it works. > ---------------------------------------------- > path = os.path.normpath(self.request().serverSideContextPath()) > sys.path.insert(0, path) > ---------------------------------------------- > > Do I really need to do this to get it to work. > My directory structure looks like this. > ---------------------------------------------- > /web/Apps/ # this is a webware context > myapp/ > control/ # this is where my servlets > model/ # this is where my model is > myapp.mkmodel/ > ---------------------------------------------- > > 2. I notice that middle kit auto creates a Primary Key for every class we > define in the CSV file. > Does this mean we should not be using our own primary keys (eg. composite > keys) ? > > If i have a schema like this, > > Employee > name char(30) > company Company > > Company > name char(30) > > should the following code give me the company name ? (after middle kit > generates the above mk objects) > ---------------------------------------------- > employees = store.fetchObjectsOfClass('Employee') > for emp in employees > emp.company().name() > ---------------------------------------------- > > Many Thanks > > Huy > > > _______________________________________________ > Webware-discuss mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/webware-discuss > _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss
