derks/cement — Issue #73: Hooks broken in Python 3
Author: derks
Created: 2011-11-07 23:09:13+00:00
State: open
Labels: 2.x, bug

Having two functions registered to the same hook results in a TypeError when backend.hook attempts to order the tuples:

Traceback (most recent call last):
File "test.py", line 7, in
app.setup()
File "/Users/wdierkes/devel/cement/src/cement2/cement2/core/foundation.py", line 87, in setup
for res in hook.run('cement_post_setup_hook', self):
File "/Users/wdierkes/devel/cement/src/cement2/cement2/core/hook.py", line 120, in run
backend.hooks[name].sort() # Will order based on weight
TypeError: unorderable types: function() < function()

In python 3 it appears the entire tuple is compared rather than just the first item in the tuple (weight) in Python < 3.