hi.

webware cvs, dated 8th Dec 2004, python 2.3.3
consider following code:

    store = MySQLObjectStore(user=logic.DatabaseConfiguration.user, 
passwd=logic.DatabaseConfiguration.password)
    
store.readModelFileNamed('/home/kuba/tiebreak/devel/tiebreak/trunk/logic/Tiebreak')
 
# relative path doesnt work
    manager = UserManagerToMiddleKit(userClass = User, store = store)
    status = manager.loginName(login, password)
    if not status:
        manager.createUser(login, password, userClass = User)
    return status

the intention of this code is to check whether given login/password is 
correct, and if not - to add an user to the database (forget the logical 
correctness, its just an example). 
unforunatelly, when a user with given login doesnt exist in the database, i 
get an error:

    manager.createUser(login, password, userClass = User)
  File "UserKit/UserManager.py", line 146, in createUser [edit]
    self.addUser(user)
  File "UserKit/UserManagerToMiddleKit.py", line 103, in addUser [edit]
    self._store.addObject(user)
  File "MiddleKit/Run/ObjectStore.py", line 139, in addObject [edit]
    object.addReferencedObjectsToStore(self)
  File "MiddleKit/Run/MiddleObject.py", line 296, in 
addReferencedObjectsToStore [edit]
    values = [self.valueForAttr(attr) for attr in 
self.klass().allDataRefAttrs()]
  File "MiddleKit/Run/MiddleObject.py", line 291, in klass [edit]
    return self._mk_klass  # If you get AttributeError, then the MK model 
wasn't loaded.
AttributeError: User instance has no attribute '_mk_klass'

i'm sure that model was loaded, because when appropriate user exists in the 
database (login and password are correct) everything works ok.
i've found out that _mk_klass attribute is set only in Klass.py, in method 
pyClass, but as i'm still not experienced in webware, i couldnt move any 
further and solve this problem myself. any hints?

-- 
regards,
kuba


-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now. 
http://productguide.itmanagersjournal.com/
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to