[Grok-dev] more changes in martian, grokcore.component

Martijn Faassen faassen at startifact.com
Fri Jun 6 13:16:54 EDT 2008

Hi there,

I've just released Martian 0.10. Martian 0.10 follows up on some recent 
Martian changes. What's new:

* new tutorial content, replacing the old README.txt. Those tests have 
moved to core.txt. The new tutorial is shorter and should explain 
Martian better to beginners.

* new directives: martian.component, replaces component_class 
class-level attribute on grokkers. martian.priority replaces priority 
class level attribute on grokkers, and martian.directive replaces the 
new 'directives' list. It takes a directive (class) as an argument, and 
optionally the further parameters to bind() (name, default, get_default).

* combined martian.GrokRegistry that makes martian more easy to use from 
Python code.

The new directives allow you to write a grokker in the same style as the 
classes you're actually grokking:

class FooGrokker(martian.ClassGrokker):
     martian.directive(context, get_default=default_context)

     def execute(self, class_, name, context, **kw):

I've also updated grokcore.component trunk to work with the new version 
of Martian. I haven't updated the Grok trunk yet. Someone else will have 
to update five.grok; the changes aren't difficult but if you have 
questions, please ask them here!

This set of changes was driven also to simplify classix, a new library 
I'm developing that provides a Martian-based glue for lxml 
element-specific classes:


It's a simple library, and I considered it when considering how to 
improve Martian.

All this is yet another step to improve Martian. While reviewing things 
I got another idea: I think we need a (decorated) module-level function 
grokker in Martian itself, to replace the ugliness that is in 
grokcore.component.decorator now. Hopefully we can simply use grok 
directives for the subscribe, adapter decorators and also replace some 
of the GlobalGrokkers with FunctionGrokker.



P.S. yes, an actual feature version bump to martian 0.10, we shouldn't 
be doing major changes to the way martian works in the third number!

More information about the Grok-dev mailing list