As it turns out, reading the code and introspecting the object were
rather much a waste of your time, honestly.

Per http://bitbucket.org/pedersen/tgext.menu/wiki/Home there is a
section named "Appending and Removing Entries", which shows the
methods to remove a menu entry:

menu_remove('menu path', 'menu name')
navbar_remove('menu path')
sidebar_remove('menu path')



On Wed, Oct 6, 2010 at 1:06 AM, Tim Black <[email protected]> wrote:
> 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.
>



-- 
Michael J. Pedersen
My IM IDs: Jabber/[email protected], ICQ/103345809, AIM/pedermj022171
          Yahoo/pedermj2002, MSN/[email protected]

-- 
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