def find_orphan_products(app): ''' Print names of orphaned Products, those that do not have a corresponding module. ''' import Products product_module_names = dir(Products) product_objects = app.Control_Panel.Products.objectValues() product_objects.sort(lambda a,b: cmp(a.id,b.id)) for prod in product_objects: if not prod.id in product_module_names: print prod.id if not hasattr(prod, 'thisIsAnInstalledProduct'): print " not an installed product"