[Grok-dev] Grok, Martian and class decorators

Jan-Wijbrand Kolman janwijbrand at gmail.com
Mon Jan 31 04:14:03 EST 2011

On 1/29/11 17:58 PM, Vincent Fretin wrote:
> On Thu, Jan 27, 2011 at 9:43 AM, Jan-Wijbrand Kolman
> <janwijbrand at gmail.com <mailto:janwijbrand at gmail.com>> wrote:
>     On 1/26/11 14:08 PM, Souheil CHELFOUH wrote:
>      > I need to add : this is very important to me :)
>      >
>      > 2011/1/25 Souheil CHELFOUH<trollfot at gmail.com
>     <mailto:trollfot at gmail.com>>:
>      >> Hello Grok,
>      >>
>      >> Recently, as I tried to migrate Dolmen to Grok 1.3, I faced some
>     problems.
>      >> Two packages of Dolmen use class decorators and, especially in
>      >> dolmen.menu, it creates problems with martian directives.
>      >> In dolmen.menu, I try to access the directive value of the class
>     being
>      >> decorated. While it used to work on martian 0.11.x, it no longer
>      >> works.
>      >> We investigated the problem with J-W and Matthias and we concluded
>      >> that Martian is not longer "class decorated safe".
>      >> It never claimed to be, obviously, but this is a real problem
>     for me,
>      >> as these packages are an important brick or the Dolmen stack,
>     for me.
>      >> What should we do ?
>     The more I think about this, the less I see a solution: directives do
>     their work at import-time as do class decorators. In other words, like
>     it is not possible to get values through a directive in another
>     directive (as the import-time has not finished yet), class decorators
>     cannot get values through directives either.
>     After import-time comes grokking-time. During grokking-time, annotations
>     left by the directives can be read from the grokked components.
>     So *maybe* there is a solution, being, have the class decorators
>     annotate the decorated components and use a grokker (registered for a
>     very generic component type, `object` perhaps, would that work?) read
>     that information and do the registrations.
>     Would this provide a way forward?
>     regards, jw
> Hi,
> Maybe http://pypi.python.org/pypi/venusian
> can help here?

Note that in venusian too, the "annotation" or "decoration" is done at 
import time and only later - in the scanning phase, AFAICT similar to 
the grokking phase - the information left by the decorator is read and 

regards, jw

More information about the Grok-dev mailing list