>
> that is a beautiful recursive function.
>

For the structure of the example dictionary, it seems there's no way of 
separating a file from an empty folder, so I'd change the structure to 
something like

{"foo": {"bar": None, "foo": {}}}

That would be converted to

foo (folder)
    bar (file)
    foo (empty folder)

And the fixed recursive function would now be

def ulmaker(val):
    ul = UL()
    for k, v in val.iteritems():
        if isinstance(v, dict):
            ul.append(LI(k, ulmaker(v)))
        else:
            ul.append(LI(k))
    return ul


-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to