Integrating hurry.resource into BFG
Back in PyCon APAC last week I was introduced to hurry.resource by its author, which is also one of the founder behind Grok, Martijn Faassen.
So, what does it do?.
Read Here
Lets go to the fun part
Setting Up
Assuming you are using one of the default BFG templates
First, enable ZCA. (or just do this in run.py):
...
config = Configurator(root_factory=get_root, settings=settings)
config.hook_zca()
config.begin()
...
Do this little modification on the get_root function in model.py:
from repoze.bfg.interfaces import IRequest
def get_root(request):
request.registry.registerUtility(request,provided=IRequest)
return root
Add some component codes, name the file resource.py
from hurry.resource.interfaces import ICurrentNeededInclusions
from hurry.resource.interfaces import ILibraryUrl
from zope.interface import implements,implementer
from zope.component import getUtility,adapter
from hurry.resource import NeededInclusions
from repoze.bfg.interfaces import IRequest
from hurry.resource.core import …
So, what does it do?.
Read Here
Lets go to the fun part
Setting Up
Assuming you are using one of the default BFG templates
First, enable ZCA. (or just do this in run.py):
...
config = Configurator(root_factory=get_root, settings=settings)
config.hook_zca()
config.begin()
...
Do this little modification on the get_root function in model.py:
from repoze.bfg.interfaces import IRequest
def get_root(request):
request.registry.registerUtility(request,provided=IRequest)
return root
Add some component codes, name the file resource.py
from hurry.resource.interfaces import ICurrentNeededInclusions
from hurry.resource.interfaces import ILibraryUrl
from zope.interface import implements,implementer
from zope.component import getUtility,adapter
from hurry.resource import NeededInclusions
from repoze.bfg.interfaces import IRequest
from hurry.resource.core import …