[Grok-dev] hurry.resource breakage and how to fix it

Martijn Faassen faassen at startifact.com
Thu Jul 29 12:35:25 EDT 2010


Hi there,

In hurry.resource 0.10, we've introduced some changes that broke 
hurry.resource usage in Grok. Why were those changes made? To make 
hurry.resource more compatible with web frameworks that are not based on 
the Zope Component Architecture. Particularly, libraries are now 
registered as entry points and they know their own path, as opposed to 
the earlier situation where only configure.zcml knew where the actual 
library to publish was stored.

Just now I've released hurry.zoperesource 0.6, which should make things 
work again with those hurry.resource packages that have released updated 
to hurry.resource 0.10. At the time of this writing this is 
hurry.jquery, hurry.yui, hurry.jqueryui, hurry.jquerylayout, 
hurry.datatables and hurry.jstree. But other packages need to be updated 
(I will update hurry.jqgrid when I get around to it, ping me if you need 
it).

Compatibility with megrok.resource is likely also broken as of 
hurry.zoperesource 0.6. This needs to be fixed too by the authors (I 
already talked to Souheil a bit about this). I recommend that 
megrok.resource goes to instance grokkers.

To get some idea on how to do this with Martian, you can look at the 
serf source code (it's important to provide __grok_module__, and for 
Library subclasses you need to reconstruct path...). Serf is a little 
web server which basically only exists to work with hurry.resource-based 
packages easily.

http://pypi.python.org/pypi/serf

Here's how to update your hurry.resource based package to hurry.resource 
0.10:

* include a hurry.resource.libraries entry point that points to the 
library your package publishes (or more entry points for more libraries)

* modify the place where you instantiate Library with a second argument 
which points to the directory in which your resources are shipped.

* remove the configure.zcml file from your package; the directory 
resource registration will instead be performed by hurry.zoperesource 
based on your entry point.

* put a dependency in the package's setup.py that says hurry.resource >= 
0.10

Regards,

Martijn



More information about the Grok-dev mailing list