diff options
author | neodarz <neodarz@neodarz.net> | 2019-05-26 12:44:46 +0200 |
---|---|---|
committer | neodarz <neodarz@neodarz.net> | 2019-05-26 12:44:46 +0200 |
commit | 075cde20b4dbc9e43924a5b469a6bf3ddeb48d38 (patch) | |
tree | 5d27d78d01f6d493deebcb5ae868b8316d0c802e | |
parent | 2e8c6dfd876d25a00897e05ae2883a47f79d3eea (diff) | |
download | my_new_personal_website-075cde20b4dbc9e43924a5b469a6bf3ddeb48d38.tar.xz my_new_personal_website-075cde20b4dbc9e43924a5b469a6bf3ddeb48d38.zip |
Move static_vars function to external file
-rwxr-xr-x | pyblog | 10 | ||||
-rw-r--r-- | utils/utils.py | 8 |
2 files changed, 9 insertions, 9 deletions
@@ -766,16 +766,8 @@ def generate_index_and_feed(): generate_sitemap(feed) -def static_vars(**kwargs): - def decorate(func): - for k in kwargs: - setattr(func, k, kwargs[k]) - return func - return decorate - - # exclude_list is only inialized once to avoid constant disk IO -@static_vars(exclude_list=None) +@utils.static_vars(exclude_list=None) def generate_blog(fresh=False, report_total_errors=True): """Generate the blog in BUILDDIR. diff --git a/utils/utils.py b/utils/utils.py index 1cabbdc8..44cf8e59 100644 --- a/utils/utils.py +++ b/utils/utils.py @@ -193,3 +193,11 @@ def postprocess_html_file(htmlfilepath): htmlfileobj.seek(0) htmlfileobj.write(str(soup)) htmlfileobj.truncate() + + +def static_vars(**kwargs): + def decorate(func): + for k in kwargs: + setattr(func, k, kwargs[k]) + return func + return decorate |