-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thursday 16 January 2003 09:05 pm, Luke Holden wrote:
> I dont know if this is a bug... or I am doing something wrong or something.
>
> One of my utils classes looks somewhat like this:

Changed the class to have a single state...:

class UserUtils(object):
        __shared_state = {}
                
        def __init__(self):
                self.__dict__ = self.__shared_state
                if not self.__shared_state:
                        print "Store == None"
                        self._store = MySQLObjectStore(user='USER', passwd='PASS')
                        self._store.readModelFileNamed('PATH')

        def store(self):
                print "I have pending changes!"
                return self._store


And it still happens.. It looks like ObjectStore knows when it has changes 
pending... And actually writes the changes out to the database... but it is 
not changing its in memory copy of the data to reflect those changes.

Here is my log:

    1  0.00 secs            /security/roles

    2  2003-01-16 21:47:42  /security/roles/
Store == None
    2  0.48 secs            /security/roles/

    3  2003-01-16 21:47:45  /security/roles/listPermissions?id=4
    3  0.16 secs            /security/roles/listPermissions?id=4

    4  2003-01-16 21:47:47  
/security/roles/action/ModifyRolePermissions?_action_delete=Delete&id=4&permid=1
Delete: Found requested item to delete <Security.Permission.Permission 
instance at 0x83cb874>
Delete: called deleteObject
Store: I have pending changes!
Delete: called saveChanges
Delete: Object still exists in memory! <Security.Permission.Permission 
instance at 0x83cb874>
    4  0.05 secs            
/security/roles/action/ModifyRolePermissions?_action_delete=Delete&id=4&permid=1


Here is the code that produces most of that output:

                        for rolePerm in role.permissions():
                                if rolePerm.detail().serialNum() == 
permission.serialNum():
                                        print "Found requested item to delete", 
rolePerm.detail()
                                        UserUtils().store().deleteObject(rolePerm)
                                        print "Delete: called deleteObject"
                                        UserUtils().store().saveChanges()
                                        print "Delete: called saveChanges"

                        for rolePerm in role.permissions():
                                if rolePerm.detail().serialNum() == 
permission.serialNum():
                                        print "Object still exists in memory!", 
rolePerm.detail()

And again... if I look at the database. The data was infact deleted.
- -- 
Luke Holden
eBI Solutions
Main: (949) 387-5182
Email: [EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQE+J5qX3q5xXfLZTQkRAn9MAKDCCnlrhdkQtu3Ltb8fSWYobQ7XSACgtRwS
ctcSWJy3QpYH4l5tl/5cZGs=
=nIct
-----END PGP SIGNATURE-----



-------------------------------------------------------
This SF.NET email is sponsored by: Thawte.com
Understand how to protect your customers personal information by implementing
SSL on your Apache Web Server. Click here to get our FREE Thawte Apache 
Guide: http://ads.sourceforge.net/cgi-bin/redirect.pl?thaw0029en
_______________________________________________
Webware-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-devel

Reply via email to