What is the best way to populate a tgext.menu with new data on every
page refresh so it contains only those records returned by a particular
database query?  Here's how I'm trying to do it:

class RootController(BaseController):
    def __init__(self):
        for p in DBSession.query(model.Project):
            navbar_append("Projects || " + p.name, url='/project/' +
str(p.id))

This DOES add a new project to the menu when I add a project to the
database, which is great.  But it does NOT do another thing I need it to
do:  remove a project from the menu when I delete a project from the
database.  That makes me think I need to iterate through existing menu
items and selectively delete those that should no longer exist.  If this
is the solution, where can I find that list of menu items?  I've read
the tgext.menu code and tried to introspect the navbar object, but can't
figure out the answer to that question.

Or is there a better way to solve this problem?

Thanks for your help!

Tim













-- 
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to