grokcore.component and grok should define a 'grok' function that can be used in a grokker
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
grok | Status tracked in 1.3 | |||||
1.3 |
New
|
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_
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) |