Re: [Zope-dev] Caching problems
Bob Pepin wrote: > > On Wed, Aug 16, 2000 at 05:31:29PM +0100, Carlos Neves wrote: > > You directly change a nonpersistence participant object. > > As stated in > > http://www.python.org/workshops/2000-01/proceedings/papers/fulton/zodb3.html : > [...] > > but mainly... RTFM ;-) > > Well, thanks, but too bad the only FM I've been able to find about Zope are > those .py files in lib/python/... > > I spent a whole day looking for documentation on ZODB internals on zope.org and > zdp.zope.org, without being able to find anything... how about adding that > paper to the search engine on zope.org? Is there more documentation like that > one out there? a couple actually, not located so that you can find them but they exist jim fulton's paper from the ipc8 (python conference) is excellent reading material. http://www.zope.org/Members/jim/Info/IPC8/ZODB3News also the uml models http://www.zope.org/Documentation/Developer/Models/ZODB/ and another excellent paper by andrew kuchling on zodb and ZEO http://starship.python.net/crew/amk/python/writing/zodb-zeo.html there is also a how-to... Cheers Kapil ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Caching problems
On Wed, Aug 16, 2000 at 05:31:29PM +0100, Carlos Neves wrote: > You directly change a nonpersistence participant object. > As stated in > http://www.python.org/workshops/2000-01/proceedings/papers/fulton/zodb3.html : [...] > but mainly... RTFM ;-) Well, thanks, but too bad the only FM I've been able to find about Zope are those .py files in lib/python/... I spent a whole day looking for documentation on ZODB internals on zope.org and zdp.zope.org, without being able to find anything... how about adding that paper to the search engine on zope.org? Is there more documentation like that one out there? ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Caching problems
that property would be set by calling... self._p_changed = 1 right after you changed anything in that list. jens on 8/16/00 9:37, R. David Murray at [EMAIL PROTECTED] wrote: > On Wed, 16 Aug 2000, Bob Pepin wrote: >> attribute of the class. When I append something to that list, it stays >> there at first, but only until I restart Zope. It disappears (==is set > > You have to let Zope know that the object has been modified so > it knows to commit it to disk. > > x = self.list > x.append('something') > self.list = x > > will do that. Hmm. Actually I suppose that > > self.list.append('something') > self.list = self.list > > would also work. (The point is for __setattr__ to get called so > Zope can notice that the object has changed). > > There's also a property you can set on self to notify zope of the > modification, but I forget it's name. > ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Caching problems
On Wed, 16 Aug 2000, Bob Pepin wrote: > attribute of the class. When I append something to that list, it stays > there at first, but only until I restart Zope. It disappears (==is set You have to let Zope know that the object has been modified so it knows to commit it to disk. x = self.list x.append('something') self.list = x will do that. Hmm. Actually I suppose that self.list.append('something') self.list = self.list would also work. (The point is for __setattr__ to get called so Zope can notice that the object has changed). There's also a property you can set on self to notify zope of the modification, but I forget it's name. --RDM ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
Re: [Zope-dev] Caching problems
You directly change a nonpersistence participant object. As stated in http://www.python.org/workshops/2000-01/proceedings/papers/fulton/zodb3.html : All sub-objects of persistent objects must be persistent or immutable. This rule is necessary because, without it, the persistence system would not be notified of persistent object state changes. Like most rules, this rule can be broken with care, as is done in the issue tracking system. A persistent object can use mutable non-persistent sub-objects if it notifies the persistence system that the sub-object has changed. It can do this in two ways. It can notify the persistence system directly by assigning a true value to the attribute _p_changed so what I think you need is to tell the object wich has the list property that it has changed, coz he can't know it by himself if you list.append or list.extend or even list[0] = something. To do this you can: 1- set self._p_changed = 1 on the object after the change (append or something) 2 - assign self.list to itself so that the object knows a change has been made to that property. but mainly... RTFM ;-) On Wed, 16 Aug 2000, Bob Pepin wrote: > > Hi, > I have a problem with a class I wrote where I have a list as an > attribute of the class. When I append something to that list, it stays > there at first, but only until I restart Zope. It disappears (==is set > to the value I assigned to it in __init__) and reappears as well when > I hit reload a few times very quickly. Whenever I flush the cache it > disappears immediately. There seems to be no transaction registered by > Zope, because it doesn't show up under 'Undo'. I observed this both > thru a dtml page and a debugging function written in python. > > I attached the code below, the method and attributes I'm talking about > are IEEShare.read_access_roles, IEEShare.write_access_roles and > IEEShare.add_user_access() > > The problem exists with both Zope 2.2.0 and 2.2.1b1. I'm running > 2.2.1b1 right now on a SuSE Linux 6.4 default installation. (standard libc, > threads etc.) > Both versions of Zope are compiled from source. > -- "Sometimes I think the surest sign that intelligent life exists elsewhere in the Universe is that none of it has tried to contact us." Carlos Neves [EMAIL PROTECTED] ___ Zope-Dev maillist - [EMAIL PROTECTED] http://lists.zope.org/mailman/listinfo/zope-dev ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope )
[Zope-dev] Caching problems
Hi, I have a problem with a class I wrote where I have a list as an attribute of the class. When I append something to that list, it stays there at first, but only until I restart Zope. It disappears (==is set to the value I assigned to it in __init__) and reappears as well when I hit reload a few times very quickly. Whenever I flush the cache it disappears immediately. There seems to be no transaction registered by Zope, because it doesn't show up under 'Undo'. I observed this both thru a dtml page and a debugging function written in python. I attached the code below, the method and attributes I'm talking about are IEEShare.read_access_roles, IEEShare.write_access_roles and IEEShare.add_user_access() The problem exists with both Zope 2.2.0 and 2.2.1b1. I'm running 2.2.1b1 right now on a SuSE Linux 6.4 default installation. (standard libc, threads etc.) Both versions of Zope are compiled from source. __doc__ = """IEEFolder product module.""" __version__ = '0.1' import string from Globals import HTMLFile,MessageDialog,Persistent import OFS.Folder import OFS.PropertyManager import Acquisition import AccessControl from AccessControl import getSecurityManager manage_addIEEFolderForm = HTMLFile('ieefolderAdd', globals()) def manage_addIEEFolder(self, id, title=None, REQUEST=None): """Add an IEE Folder to a folder.""" ob=IEEFolder() ob.id=str(id) if title: ob.title=title self._setObject(id, ob) if REQUEST is not None: return self.manage_main(self, REQUEST, update_menu=1) def findProperty(ids, props, searchterm, path='', all=0): """Find a property """ result=[] checkPermission=getSecurityManager().checkPermission for obj in ids: if hasattr(obj, '_properties') and checkPermission('Access contents information', obj): for md in getattr(obj, '_properties'): propid=md['id'] if (all or (propid in props)) and \ (string.find(str(getattr(obj, propid)),searchterm) != -1): result.append({'object': obj, 'id': path + obj.id, 'url': obj.absolute_url()}) if getattr(obj, 'isPrincipiaFolderish', None): result.extend(findProperty(obj.objectValues(), props, searchterm, \ path=path+obj.id+'.', all=all)) return result class IEEFolder(OFS.Folder.Folder, Persistent, Acquisition.Implicit, AccessControl.Role.RoleManager, OFS.PropertyManager.PropertyManager ): meta_type = 'IEE Folder' __ac_permissions__=( ('Read Access', ('manage_findPropertyForm', 'manage_findProperty', 'index_html', 'manage_main', 'manage_workspace', 'objectIds', 'objectValues', 'objectItems', '')), ('Write Access', ('manage_delObjects',))) manage_workspace__roles__=('Read Access','Write Access') manage_options = ( {'label': 'Folder View', 'action': 'index_html', 'image': 'folder-view'}, {'label': 'Search', 'action': 'manage_findPropertyForm', 'image': 'search'}, {'label': 'Undo', 'action': 'manage_UndoForm', 'image': 'undo'}) index_html = HTMLFile('index', globals()) manage_main = HTMLFile('index', globals()) manage_findPropertyForm=HTMLFile('findProperty', globals()) findPropertyResult=HTMLFile('findPropertyResult', globals()) manage_UndoForm=HTMLFile('undo', globals()) def filtered_objectIds(self): map(lambda x: x.id, filter(lambda x: getSecurityManager().checkPermission('Read Access', x), self.objectValues())) def manage_findProperty(self, searchterm, props=[], allprops='all'): """Find a property.""" if type(props) is type(''): props=[props] if allprops == 'all': allprops = 1 else: allprops = 0 return self.findPropertyResult(self, result=findProperty(self.objectValues(), props, searchterm, all=allprops), URL=self.absolute_url()) __doc__ = """IEEShare product module.""" __version__ = '0.1' import nis,traceback from Globals import HTMLFile,MessageDialog,Persistent from Products.CARS.IEEFolder import IEEFolder from Products.CARS.NisLogin import NisLogin from Products.LoginManager.LoginManager import manage_addLoginManager from Globals import HTMLFile manage_addIEEShareForm = HTMLFile('ieeshareAdd', globals()) def manage_addIEEShare(self, id, title=None, REQUEST=None): """Add an IEE Share to a folder.""" ob=IEEShare() ob.id=str(id) ob.title=title self._setObject(id, ob) ob=self._getOb(id) ob.manage_role('Read Access', permissions=('Read Access',)) ob.manage_role('Write Access', permissions=('Write Access',)) #manage_addLoginManager(ob, usource='NIS User Source') if REQUEST is not None: return self.manage_main(self,