Re: Trellis on_commit and Performers

"Sergey Schetinin" <[email protected]>
Newsgroups gmane.comp.python.peak
Message-ID <[email protected]>
> Something is odd with them though. Following test prints "maintain" three times.
>
> class Test(trellis.Component):
>    @trellis.maintain
>    def value(self):
>        print 'maintain'
>
>    @value.connector
>    def _watch(self, sensor):
>       pass
>
>    @value.disconnector
>    def _unwatch(self, sensor, key):
>        pass
>
>
> t = Test()

Found a reason for this. In CellAttribute._hook_method it says:

        if func is not None:
            setattr(self, methodname, func)
            return self

Certainly it has to return func instead. Otherwise Test ends up with
three identical items in CellFactories for each of value, _watch and
_unwatch.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.