[Product-Developers] Adding an "object lock state" in CacheSetup for ETag computation

Ricardo Newbery ric at digitalmarbles.com
Sun Apr 12 11:20:31 UTC 2009


On Apr 12, 2009, at 2:07 AM, Tarek Ziadé wrote:

> On Sun, Apr 12, 2009 at 9:08 AM, Ricardo Newbery <ric at digitalmarbles.com 
> > wrote:
>>
>> On Apr 9, 2009, at 12:26 AM, Tarek Ziadé wrote:
>>
>>> Hello,
>>>
>>> to make CacheFu work properly with ETags, I had to append in the  
>>> ETag the
>>> lock state
>>> of the object:
>>>
>>> ILockable(object).locked()
>>>
>>> Otherwise, when you unlock an object the unlock panel will not  
>>> disappear
>>> even if the object is locked. I suggest adding this to CachSetup  
>>> in the list
>>> of elements that can be checked in the configuration panel to  
>>> compute Etag
>>>
>>> Cheers
>>> Tarek
>>> --
>>
>>
>> How's this...
>>
>> http://dev.plone.org/collective/changeset/84124
>>
>
> That's great !! thanks Ricardo
>
> Maybe the call "ILockable(object).locked())" can be protected from the
> TypeError, in case the object
> doesn't support the ILockable.
>
> (I don't know Plone enough for that to know if it's the way to go)
>
> Cheers



Hmm... I wonder if instead of ILockable, I should do something like  
the following instead,


if 'object_locked' in values:
     if PLONE25:
         lockable = hasattr(aq_inner(object).aq_explicit, 'wl_isLocked')
         isLocked = lockable and object.wl_isLocked()
     else:
         context_state = getMultiAdapter((object, request),  
name=u'plone_context_state')
         isLocked = context_state.is_locked()
     etag = self._addEtagComponent(etag, isLocked)


Ric









More information about the Product-Developers mailing list