diff options
Diffstat (limited to 'subplot')
-rw-r--r-- | subplot/server.py | 6 | ||||
-rw-r--r-- | subplot/server.yaml | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/subplot/server.py b/subplot/server.py index 1f4506f..a604733 100644 --- a/subplot/server.py +++ b/subplot/server.py @@ -87,7 +87,9 @@ def delete_chunk_by_id(ctx, chunk_id=None): def make_chunk_file_be_empty(ctx, chunk_id=None): chunk_id = ctx["vars"][chunk_id] chunks = ctx["config"]["chunks"] - for (dirname, _, _) in os.walk(chunks): + logging.debug(f"trying to empty chunk {chunk_id}") + for (dirname, _, filenames) in os.walk(chunks): + logging.debug(f"found directory {dirname}, with {filenames}") filename = os.path.join(dirname, chunk_id + ".data") if os.path.exists(filename): logging.debug(f"emptying chunk file {filename}") @@ -136,7 +138,7 @@ def server_has_n_chunks(ctx, n=None): assert_eq = globals()["assert_eq"] n = int(n) files = find_files(ctx["config"]["chunks"]) - files = [json.load(open(x)) for x in files if x.endswith(".meta")] + files = [x for x in files if x.endswith(".data")] logging.debug(f"server_has_n_file_chunks: n={n}") logging.debug(f"server_has_n_file_chunks: len(files)={len(files)}") logging.debug(f"server_has_n_file_chunks: files={files}") diff --git a/subplot/server.yaml b/subplot/server.yaml index ac45cac..cf57931 100644 --- a/subplot/server.yaml +++ b/subplot/server.yaml @@ -17,6 +17,11 @@ - when: "I POST (?P<filename>\\S+) to (?P<path>\\S+), with (?P<header>\\S+): (?P<json>.*)" regex: true + types: + filename: word + path: word + header: word + json: text impl: python: function: post_file @@ -63,12 +68,17 @@ function: header_is - then: "the JSON body has a field {field}, henceforth {var}" + types: + field: word + var: word impl: python: function: remember_json_field - then: "the JSON body matches (?P<wanted>.*)" regex: true + types: + wanted: text impl: python: function: json_body_matches |