def perform_site_op(self, site_name, op_name, verbose_opt, dry_run_opt): msgs = [] site = drupalsites.sites[site_name] operation = site.get_operation(op_name) drupalsites.set_verbose(verbose_opt) if dry_run_opt: msgs.append("Dry run for operation {} on site {}".format(operation.name, site.name)) else: operation.do_cmd() return {'msgs': msgs}
def perform_site_op(self, site_name, op_name, verbose_opt, dry_run_opt): msgs = [] site = drupalsites.sites[site_name] operation = site.get_operation(op_name) drupalsites.set_verbose(verbose_opt) if dry_run_opt: msgs.append("Dry run for operation {} on site {}".format( operation.name, site.name)) else: operation.do_cmd() return {'msgs': msgs}
def perform_site_op(site_name, op_name, verbose_opt, dry_run_opt): msgs = [] site = sites[site_name] operation = site.get_operation(op_name) set_verbose(verbose_opt) if dry_run_opt: msgs.append("Dry run for operation {} on site {}".format(operation.name, site.name)) else: std_str = StringIO.StringIO() with stdout_redirector(std_str): operation.do_cmd() msg = cgi.escape(std_str.getvalue()).replace("\n", "<br>") msg = Markup("<code>"+msg+"</code>") msgs.append(msg) std_str.close() return {'msgs': msgs}