grokcore.component and grok should define a 'grok' function that can be used in a grokker

Bug #492361 reported by Martijn Faassen on 2009-12-04
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
grok
Status tracked in 1.3
1.3
Undecided
Martijn Faassen

Bug Description

Sometimes it is handy to be able to grok a component in a grokker. A component could for instance generate a View on the fly and want to register it.

Unfortunately grokcore.component doesn't present an API that allows one to do this. I have to resort to hackery like this:

        from grokcore.component import zcml
        from martian import scan

        obj_module = getattr(View, '__module__', None)
        module_info = scan.module_info_from_dotted_name(obj_module)

        zcml.the_multi_grokker.grok('view', View,
                                    module_info=module_info,
                                    config=config)

grokcore.component should have a non-testing function exposed that did something like that. grok_component in the testing module should then ideally be refactored to use this.

the grok_component functionality cannot be used directly as it immediately executes config actions.

Changed in grok:
assignee: nobody → Martijn Faassen (faassen)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers