[Grok-dev] big grok refactoring
faassen at startifact.com
Mon Dec 11 18:59:42 EST 2006
Big refactoring of grok's basic grokking mechanism. Grok now groks
bits of itself!
Grok is now prepared for easy pluggability of the basic grok mechanism,
though we have a few loose ends to tie before we're fully there. Lots is
less hardcoded now. Short summary, if you want to create a new grokkable
base class, add it to meta.py, and you should be done.
Proposed is a convention where any meta.py in any grokked packages will
be grokked first, after which everything else is grokked. meta.py can
then define new grok base classes that can be grokker. This is done
using the grok mechanism, like this:
component_class = MyClass
def register(self, context, name, factory, module_info, templates):
... register factory in some way here ...
Grok's meta.py is grokked by grok to initialize the core grok base classes.
Split out a lot of code into new modules:
* grokker.py - the basic extensibility mechanism
* templatereg.py - a template registry. (cannot be called 'template'
as that name already exists).
* meta.py - core grokkable base classes.
Some future todos:
* Some grok ordering assumptions are hardcoded into grokker.py; get
rid of them replaced by a priority mechanism.
* grokker.py also makes assumptions concerning which objects can be
a context. This should be made pluggable.
* make templating system support other template engines besides
More information about the Grok-dev