alex bodnaru wrote:
> 
> hi friends,
> 
> how could a program know of all available widgets: like those not imported?

This should work

import pkg_resources
from turbogears.widgets.base import Widget

widgets = []

for ep in pkg_resources.iter_entry_points("turbogears.widgets"):
    module = ep.load(False)
    print "loading widgets in %r" % module
    widgets.extend([v for v in module.__dict__.values()
                    if isinstance(v, Widget)])
print "All installed widgets: %r" % widgets

Alberto




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