def do_newcategory(self, cat): "create a new category" if not self.validcat.match(cat): print "invalid category name. must match %s" % validcat_expr return newcat = Category.create(cat) print (('Created "%s". Note that this new category is empty,' +'and will need to be trained') % newcat.name)