webserver: Coding Style.
- Extract get_summary function.
This commit is contained in:
parent
53408547f4
commit
055e1fd650
1 changed files with 13 additions and 8 deletions
|
|
@ -111,14 +111,7 @@ def run(server_class=http.server.HTTPServer, handler_class=Webserver, port=8080)
|
||||||
httpd.serve_forever()
|
httpd.serve_forever()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def get_summary(project_path):
|
||||||
global main_page, summary_page, index
|
|
||||||
if len(sys.argv) == 1:
|
|
||||||
print(USAGE)
|
|
||||||
sys.exit(1)
|
|
||||||
project_path = os.path.abspath(sys.argv[1])
|
|
||||||
os.chdir(project_path)
|
|
||||||
project_name = os.path.basename(project_path)
|
|
||||||
pickle_path = os.path.join(project_path, tools.CACHE_PATH,
|
pickle_path = os.path.join(project_path, tools.CACHE_PATH,
|
||||||
"summary.pickle")
|
"summary.pickle")
|
||||||
with gzip.open(pickle_path, "rb") as file_:
|
with gzip.open(pickle_path, "rb") as file_:
|
||||||
|
|
@ -130,6 +123,18 @@ def main():
|
||||||
if summary.is_directory_sort:
|
if summary.is_directory_sort:
|
||||||
summary.is_directory_sort = False
|
summary.is_directory_sort = False
|
||||||
summary.sort_entries()
|
summary.sort_entries()
|
||||||
|
return summary
|
||||||
|
|
||||||
|
|
||||||
|
def main():
|
||||||
|
global main_page, summary_page, index
|
||||||
|
if len(sys.argv) == 1:
|
||||||
|
print(USAGE)
|
||||||
|
sys.exit(1)
|
||||||
|
project_path = os.path.abspath(sys.argv[1])
|
||||||
|
os.chdir(project_path)
|
||||||
|
summary = get_summary(project_path)
|
||||||
|
project_name = os.path.basename(project_path)
|
||||||
summary_page = make_summary_page(project_name, summary)
|
summary_page = make_summary_page(project_name, summary)
|
||||||
index = {}
|
index = {}
|
||||||
for row in summary._entries:
|
for row in summary._entries:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue