[Zope-dev] SessionDataManager oddness
Chris McDonough
chrism@digicool.com
Fri, 2 Mar 2001 10:58:09 -0500
Mark,
Try putting the code which adds the session data manager from your class'
__init__ into a manage_afterAdd method of your class, e.g.:
def manage_afterAdd(self, item, container):
ob = SessionDataManager(
id='session_data_mgr', title='', path=None, timeout_mins=20)
self._setObject('session_data_mgr', ob)
manage_afterAdd is called automagically by the _setObject machinery at init
time, but it gets the object in its acquisition-wrapped context.
----- Original Message -----
From: "Matt Hamilton" <matth@netsight.co.uk>
To: <zope-dev@zope.org>
Sent: Friday, March 02, 2001 5:19 AM
Subject: [Zope-dev] SessionDataManager oddness
> Dear All,
> I am trying to add session tracking to a Product of mine. I am trying
> to add a SessionDataManager to a Folderish object in the __init__ method
> of the class, but having troubles. I think I am importing everything:
>
> from Globals import HTMLFile
> from Globals import Persistent
> from Globals import default__class_init__
> import Acquisition
> import AccessControl.Role
> import OFS.Folder
> from Products.ZCatalog import ZCatalog
> from Products.BTreeFolder import BTreeFolder
> from Products.CoreSessionTracking.SessionDataManager import
SessionDataManager
> from Products.CoreSessionTracking.SessionDataContainer import
SessionDataContainerMount
> from Products.CoreSessionTracking.SessionData import SessionData
> try:
> from Products.CoreSessionTracking.SessioningInterfaces import
SessionDataManagerInterface
> except:
> # pre-2.3 Zopes don't have an Interfaces module
> class SessionDataManagerInterface:
> pass
>
> then in my __init__ method:
>
> ob = SessionDataManager(
> id='session_data_mgr', title='', path=None, timeout_mins=20)
> self._setObject('session_data_mgr', ob)
>
> However I get an attribute error when trying to add an intance of the
> product. _sdc not found.
>
> I have traced it using pdb, and from what I can find out it appears as if
> it fails in _setObject. More specifically SessionDataContainerMount
> seems to not returning the correct thing.
>
> I have tried tracing the normal addition of a SessionDataManager in Zope
> and it works fine. SessionDataContainerMount doesn't have an __init__
> method, but it looks like when I add a S.D.M via the normal web interface
> __of__ gets called, but when my product tries to add it __del__ gets
> called.
>
> Any ideas? I am at the end of my Zope internals knowledge.... if there is
> anything else I can provide to help diagnose, let me know.
>
> TIA,
> Matt
>
> --
> Matt Hamilton matth@netsight.co.uk
> Netsight Internet Solutions, Ltd. Business Vision on the Internet
> http://www.netsight.co.uk +44 (0)117 9090901
> Web Hosting | Web Design | Domain Names | Co-location | DB Integration
>
>
>
> _______________________________________________
> Zope-Dev maillist - Zope-Dev@zope.org
> 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 )
>