[Zope-dev] Re: [Zope] [Bug] "bobobase_modification_time" unreliable to catalog

Casey Duncan c.duncan@nlada.org
Mon, 7 Jan 2002 15:24:40 -0500


On Monday 07 January 2002 07:38 am, kapil thangavelu allegedly wrote:
> On Monday 07 January 2002 06:20 am, Casey Duncan wrote:
[snippingtons]
> >
> > I am interested in seeing this code. From my perspective it seems overly
> > sophisticated. I'm interested how you derive the registration time in the
> > first place.
>
> your right, what i did was overly complex. i took your suggestions and
> simplified to the following two methods, which stores the txn registration
> time on the object as a float. it looks like an ok solution, imo. it
> doesn't do much for newly created persistent objects for which it falls
> through to the behavior of bobobase_modification_time and returns the
> current time.
>
> in PersistentUtil class in lib/python/App/PersistentExtra.py new method
>
> from Acquisition import aq_base
> def getModificationTime(self):
> 	ob = aq_base(self)
> 	if hasattr(ob, '_p_changed') and ob._p_changed:
> 		return DateTime(self._p_registration_time)
> 	else: return self.bobobase_modification_time()
>
> in Transaction class in lib/python/ZODB/Transaction.py altered register
> method
>
> def register(self, object):
> 	self._append(object)
> 	object._p_registration_time = time.time()

That looks nice and simple to me. Does anyone have a concern about the 
behavior for new objects? (I'm not sure what can be done about it...)

If no one objects I can check this into the core.

/---------------------------------------------------\
  Casey Duncan, Sr. Web Developer
  National Legal Aid and Defender Association
  c.duncan@nlada.org
\---------------------------------------------------/