[Zope] TransientObjectContainer.keys()
Shannon -jj Behrens
jj@nttmcl.com
Fri, 14 Mar 2003 10:21:41 -0800
On Wed, Mar 12, 2003 at 10:01:23PM -0600, Edward Muller wrote:
> Agreed. doesn't this work:
> keys = TransientObjectContainerInstance.keys()
> for key in keys:
> print key
No, unfortunately, it doesn't. Despite the fact that I'm logged in as a
manager, it asks me for my username and password. See below.
> The above should print the TransientObjects in the
> TransientObjectContainerInstance....
>
> Again ... I've never read the code ... but that's the way session
> works...
I think the problem is in Zope/lib/python/Products/Transcience. Whereas
the get method is declared as:
security.declareProtected(ACCESS_TRANSIENTS_PERM, 'get')
def get(self, k, default=_marker):
the keys method is declared as:
def keys(self):
Notice that there is no security declaration. I think that this combined with
the line:
security.setDefaultAccess('deny')
is locking me out.
Of course, this is my first time looking at the Zope code, so I could be wrong.
In any case, it's not working. :(
Thanks,
-jj
> On Wed, 2003-03-12 at 20:42, Chris McDonough wrote:
> > Whether it's in the API or not, a TransientObjectContainer does have a
> > keys method. I presume you can use this.
> >
> > - C
> >
> >
> > On Wed, 2003-03-12 at 21:37, Shannon -jj Behrens wrote:
> > > On Fri, Mar 07, 2003 at 12:22:13AM -0600, Edward Muller wrote:
> > > > Isn't TransientObjectContainer a container for TransientObjects ?
> > >
> > > Yes.
> > >
> > > > You get the auto-delete from TransientObjectContainer. I assume (without
> > > > looking at the code) that the dict in TransientObjectContainer stores
> > > > some sort of references to TransientObjects ... which you then use ...
> > >
> > > Yes.
> > >
> > > > I could be very wrong ... since I'm not taking the time to read the
> > > > code.
> > >
> > > All of your statements are correct. However, I still know of no way to way to
> > > get a complete list of TransientObject's from the TransientObjectContainer.
> > > (This should not be confused with getting a list of keys from *an individual*
> > > TransientObject). Please set me straight if I'm wrong.
> > >
> > > Thanks,
> > > -jj
> > >
> > > > On Thu, 2003-03-06 at 19:02, Shannon -jj Behrens wrote:
> > > > > Chris,
> > > > >
> > > > > Thank you for your reply! I'm using 2.6. According to the API docs,
> > > > > TransientObject has a keys method, but TransientObjectContainer doesn't.
> > > > > Looking at TransienceInterfaces.py confirms that TransientObject implements
> > > > > DictionaryLike whereas TransientObjectContainer doesn't. Am I confused?
> > > > >
> > > > > Best Regards,
> > > > > -jj
> > > > >
> > > > > On Thu, Mar 06, 2003 at 07:40:51PM -0500, Chris McDonough wrote:
> > > > > > TransientObjectContainer does have a keys method. At least in Zope 2.6
> > > > > > and the Zope trunk it does...
> > > > > >
> > > > > > On Thu, 2003-03-06 at 16:53, Shannon -jj Behrens wrote:
> > > > > > > Hi,
> > > > > > >
> > > > > > > I'm using Zope as an application server for some weird, non-Web-related stuff.
> > > > > > > TransientObjectContainer really matches my needs for a particular problem
> > > > > > > (the dict-like interface and the auto-delete feature are quite useful), but
> > > > > > > TransientObjectContainer has no keys() method. I can see why this is the case
> > > > > > > considering sessions, but it's something that I absolutely need for my
> > > > > > > application. I assume my options are:
> > > > > > >
> > > > > > > o Hack Zope and submit a patch.
> > > > > > > o Hack Zope and don't submit a patch, because it won't be accepted.
> > > > > > > o Figure out some (really inconvenient) way to store a list of keys in the
> > > > > > > TransientObjectContainer.
> > > > > > > o Don't use TransientObjectContainer, just use normal Zope objects. Use a cron
> > > > > > > job to implement auto-delete.
> > > > > > >
> > > > > > > I welcome your advice.
> > > > > > >
> > > > > > > Best Regards,
> > > > > > > -jj
> > >
> > > --
> > > Hacker is to software engineer as
> > > Climbing Mt. Everest is to building a Denny's there.
> --
> Edward Muller
>
> Interlix - President
>
> Web Hosting - PC Service & Support
> Custom Programming - Network Service & Support
>
> Phone: 417-862-0573
> Cell: 417-844-2435
> Fax: 417-862-0572
>
> http://www.interlix.com
--
Hacker is to software engineer as
Climbing Mt. Everest is to building a Denny's there.