[SSF] Navigation(layout.html) => S3NavigationItem(layouts.py)

This is what I'm working on,
http://ssf.sahanafoundation.org/eden/project/task/144
Everything works well /if/ those _debug lines are commented, I couldn't figure out why I was getting the error.
here's the error link,
http://pastebin.com/EdDXt1u0
As the error suggests , method[0] isn't a string but I couldn't actually traceback the error again using eclipse(too many levels of traceback). Any idea why it's giving such an error ? Am I missing something ?
This should be rolled into one class - you can detect whether this is the outermost element by checking item.parent == None.