def write_files(self):
		frappe.local.flags.home_page = "index"

		# clear the user, current folder in target
		shutil.rmtree(os.path.join(self.target, "user"), ignore_errors=True)
		shutil.rmtree(os.path.join(self.target, "current"), ignore_errors=True)

		cnt = 0
		for page in frappe.db.sql("""select parent_website_route,
			page_name from `tabWeb Page` where ifnull(template_path, '')!=''""", as_dict=True):

			if page.parent_website_route:
				path = page.parent_website_route + "/" + page.page_name
			else:
				path = page.page_name

			print "Writing {0}".format(path)

			# set this for get_context / website libs
			frappe.local.path = path

			context = {
				"page_links_with_extn": True,
				"relative_links": True,
				"docs_base_url": self.docs_base_url,
				"url_prefix": self.docs_base_url,
			}

			context.update(self.app_context)

			context = get_context(path, context)

			target_path_fragment = context.template_path.split('/docs/', 1)[1]
			target_filename = os.path.join(self.target, target_path_fragment)

			# rename .md files to .html
			if target_filename.rsplit(".", 1)[1]=="md":
				target_filename = target_filename[:-3] + ".html"

			context.brand_html = context.top_bar_items = context.favicon = None

			self.docs_config.get_context(context)

			if not context.brand_html:
				if context.docs_icon:
					context.brand_html = '<i class="{0}"></i> {1}'.format(context.docs_icon, context.app.title)
				else:
					context.brand_html = context.app.title

			if not context.top_bar_items:
				context.top_bar_items = [
					# {"label": "Contents", "url": self.docs_base_url + "/contents.html", "right": 1},
					{"label": "User Guide", "url": self.docs_base_url + "/user", "right": 1},
					{"label": "Developer Docs", "url": self.docs_base_url + "/current", "right": 1},
				]

			context.top_bar_items = [{"label": '<i class="octicon octicon-search"></i>', "url": "#",
				"right": 1}] + context.top_bar_items

			if not context.favicon:
				context.favicon = "/assets/img/favicon.ico"

			context.only_static = True
			context.base_template_path = "templates/autodoc/base_template.html"

			html = frappe.get_template("templates/generators/web_page.html").render(context)

			if not "<!-- autodoc -->" in html:
				html = html.replace('<!-- edit-link -->',
					edit_link.format(\
						source_link = self.docs_config.source_link,
						app_name = self.app,
						branch = context.app.branch,
						target = target_path_fragment))

			if not os.path.exists(os.path.dirname(target_filename)):
				os.makedirs(os.path.dirname(target_filename))

			with open(target_filename, "w") as htmlfile:
				htmlfile.write(html.encode("utf-8"))

				cnt += 1

		print "Wrote {0} files".format(cnt)
Tests the end to end encrypted communicators.
dataset/ETHPy150Open frappe/frappe/frappe/utils/setup_docs.py/setup_docs.write_files--crossover with--dataset/ETHPy150Open google/grr/grr/lib/communicator_test.py/ClientCommsTest.ClientServerCommunicate