def save_new_site(site_name, sitedir, srcdir, port, address, site_url,<EOL>passwords):
cp = ConfigParser.SafeConfigParser()<EOL>cp.read([srcdir + '<STR_LIT>'])<EOL>section_name = '<STR_LIT>' + site_name<EOL>if not cp.has_section(section_name):<EOL><INDENT>cp.add_section(section_name)<EOL><DEDENT>cp.set(section_name, '<STR_LIT:port>', str(port))<EOL>if address:<EOL><INDENT>cp.set(section_name, '<STR_LIT:address>', address)<EOL><DEDENT>if site_url:<EOL><INDENT>cp.set(section_name, '<STR_LIT>', site_url)<EOL><DEDENT>with open(srcdir + '<STR_LIT>', '<STR_LIT:w>') as config:<EOL><INDENT>cp.write(config)<EOL><DEDENT>cp = ConfigParser.SafeConfigParser()<EOL>cp.add_section('<STR_LIT>')<EOL>for n in sorted(passwords):<EOL><INDENT>cp.set('<STR_LIT>', n.lower(), passwords[n])<EOL><DEDENT>with open(sitedir + '<STR_LIT>', '<STR_LIT:w>') as config:<EOL><INDENT>cp.write(config)<EOL><DEDENT>
Add a site's configuration to the source dir and site dir