[Zope] (Fwd) Re: [Zope] Pluggable brains aren't seen by first-nnn in - SOLUTION

Brad Clements bkc@murkworks.com
Sat, 5 Aug 2000 14:50:24 -0400


On 4 Aug 2000, at 22:10, Dieter Maurer wrote:

> Brad Clements writes:
>  > However first-eventday is ALWAYS true, however when I print &dtml-
>  > eventday; the output value is always the same for each row, so first-
>  > >
>  eventday shouldn't be true on any row except the first.
> 
> Almost surely, the "in" tag does not call a callable object
> (because it does not expect, they could be callable).
> You, therefore, get the method itself.
> It is identical for all records.


So true, the solution is to define an __init__ class in the brain class,
then use that to populate "self".

class   PackageEvent:
    """Package Event Pluggable Brain"""
    def __init__(self):
        """initialize"""
        self.__dict__['eday'] = self.eventday()

    def eventday(self):
        return
        DateTime(apply(time.mktime,self.eventtime.tuple()[:3]+(0,0,0,0,0,-1
        )))


Now 'first-eday' works.


Brad Clements,                bkc@murkworks.com   (315)268-1000
http://www.murkworks.com                          (315)268-9812 Fax
netmeeting: ils://ils.murkworks.com               AOL-IM: BKClements