While working on the Postgres integration, I've stumbled across a
problem that's not making any sense.  The attribute _mk_klass is not
being set in my middlekit objects. Line 237 of MiddleObject says the
attibute error means the model wasn't loaded. The demo below proves it
was, as it first makes a change to an existing middle kit object.  It
is onlly when I create a brand new object and add it to the store that 
_mk_klass is not defined.  If I understand the way things work, loading
a model creates many instances of Klass, each of which modifies the
Python class definition as it loads, adding the _mk_klass attribute. 
So it sounds like the class definition of 'Team' below is not getting
that attibute added for some reason.  Can anyone shed some light on
this?

The output from sample code below:
====================================
:!python testWritingMiddlekit.py
Original name:oldname
Committing changes
Traceback (most recent call last):
  File "testWritingMiddlekit.py", line 12, in ?
    store.addObject(newTeam)
  File
"/home/kpd/src/python/WebwareFromCvs/Webware/MiddleKit/Run/ObjectStore.py",
line 141, in add
Object
    object.addReferencedObjectsToStore(self)
  File "./MiddleKit/Run/MiddleObject.py", line 242, in
addReferencedObjectsToStore
  File "./MiddleKit/Run/MiddleObject.py", line 237, in klass
AttributeError: Team instance has no attribute '_mk_klass'  


Code that produced this:
========================

from Store import store
from Team import Team

aTeam = store.fetchObjectsOfClass("Team", clauses="where teamID=2")[0]
print "Original name:" + aTeam.name()

aTeam.setName("newName")
store.saveChanges()

newTeam = Team()
newTeam.setName("NewTeam")
store.addObject(newTeam)

=====
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Kevin Dahlhausen                          'Do' or 'do not.' There is no 'Try.' 
 http://members.nccw.net/kdahlhaus/              -Yoda

__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/


-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to