Skip to content

Commit

Permalink
19980: Adds escape_filename and escape_contained_filenames to `lo…
Browse files Browse the repository at this point in the history
…ad_entity`, MAJOR (#79)

Adds `escape_filename` and `escape_contained_filenames` to `load_entity`

---------

Co-authored-by: fulpm <[email protected]>
  • Loading branch information
cademack and fulpm authored Apr 19, 2024
1 parent 5e16a5e commit d7e07b7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
21 changes: 17 additions & 4 deletions amalgam/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -650,8 +650,11 @@ def load_entity(
self,
handle: str,
amlg_path: str,
*,
persist: bool = False,
load_contained: bool = False,
escape_filename: bool = False,
escape_contained_filenames: bool = True,
write_log: str = "",
print_log: str = ""
) -> LoadEntityStatus:
Expand All @@ -669,6 +672,11 @@ def load_entity(
saved over the original source.
load_contained : bool, default False
If set to true, contained entities will be loaded.
escape_filename : bool, default False
If set to true, the filename will be aggressively escaped.
escape_contained_filenames : bool, default True
If set to true, the filenames of contained entities will be
aggressively escaped.
write_log : str, default ""
Path to the write log. If empty string, the write log is
not generated.
Expand All @@ -682,7 +690,7 @@ def load_entity(
Status of LoadEntity call.
"""
self.amlg.LoadEntity.argtype = [
c_char_p, c_char_p, c_bool, c_bool, c_char_p, c_char_p]
c_char_p, c_char_p, c_bool, c_bool, c_bool, c_bool, c_char_p, c_char_p]
self.amlg.LoadEntity.restype = _LoadEntityStatus
handle_buf = self.str_to_char_p(handle)
amlg_path_buf = self.str_to_char_p(amlg_path)
Expand All @@ -692,11 +700,14 @@ def load_entity(
load_command_log_entry = (
f"LOAD_ENTITY \"{self.escape_double_quotes(handle)}\" "
f"\"{self.escape_double_quotes(amlg_path)}\" {str(persist).lower()} "
f"{str(load_contained).lower()} \"{write_log}\" \"{print_log}\""
f"{str(load_contained).lower()} {str(escape_filename).lower()} "
f"{str(escape_contained_filenames).lower()} \"{write_log}\" "
f"\"{print_log}\""
)
self._log_execution(load_command_log_entry)
result = LoadEntityStatus(self, self.amlg.LoadEntity(
handle_buf, amlg_path_buf, persist, load_contained,
escape_filename, escape_contained_filenames,
write_log_buf, print_log_buf))
self._log_reply(result)

Expand Down Expand Up @@ -742,6 +753,7 @@ def clone_entity(
self,
handle: str,
clone_handle: str,
*,
amlg_path: str = "",
persist: bool = False,
write_log: str = "",
Expand Down Expand Up @@ -788,8 +800,8 @@ def clone_entity(
f'"{write_log}" "{print_log}"'
)
self._log_execution(clone_command_log_entry)
result = self.amlg.LoadEntity(
handle_buf, amlg_path_buf, persist,
result = self.amlg.CloneEntity(
handle_buf, clone_handle_buf, amlg_path_buf, persist,
write_log_buf, print_log_buf)
self._log_reply(result)

Expand All @@ -806,6 +818,7 @@ def store_entity(
self,
handle: str,
amlg_path: str,
*,
update_persistence_location: bool = False,
store_contained: bool = False
) -> None:
Expand Down
2 changes: 1 addition & 1 deletion version.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"dependencies": {
"amalgam": "50.0.1"
"amalgam": "51.0.0"
}
}

0 comments on commit d7e07b7

Please sign in to comment.