def detail(name): try: id = int(name) except: id = 0 table = PluginTable() if id > 0: plugin = table.findById(id) else: plugin = table.findByName(name) if plugin: printPlugin(plugin) else: print "Sorry, we cannot find plugin %s for you" % name
def grade(name=None): grader = Grader() if not name: count = grader.calc() print "jobs done, scores of %d plugins updated" % count return try: id = int(name) except: id = 0 table = PluginTable() if id: plugin = table.findById(id) else: plugin = table.findByName(name) if plugin: grader.calc(data=plugin) else: print "Sorry, we cannot find plugin %s" % name