dexter has submitted this change. (
https://gerrit.osmocom.org/c/pysim/+/37775?usp=email )
(
1 is the latest approved patch-set.
No files were changed between the latest approved patch-set and the submitted
one.
)Change subject: filesystem: add placeholder export method in CardFile base
class
......................................................................
filesystem: add placeholder export method in CardFile base class
We add export methods in subclasses of CardFile but the base class
itself lacks an export method. To make the code more readable and
to avoid unnecessary exceptions, les's add a default export method
that just returns a comment.
Related: OS#6092
Change-Id: Ife2a9bad14750db84a87fab907297028c33f1f7d
---
M pySim/filesystem.py
1 file changed, 11 insertions(+), 0 deletions(-)
Approvals:
laforge: Looks good to me, approved
Jenkins Builder: Verified
fixeria: Looks good to me, but someone else must approve
diff --git a/pySim/filesystem.py b/pySim/filesystem.py
index 2151c21..a4659cf 100644
--- a/pySim/filesystem.py
+++ b/pySim/filesystem.py
@@ -298,6 +298,17 @@
return True
raise ValueError("self.service must be either int or list or tuple")
+ @staticmethod
+ def export(as_json: bool, lchan):
+ """
+ Export file contents in the form of commandline script. This method is
meant to be overloaded by a subclass in
+ case any exportable contents are present. The generated script may
contain multiple command lines separated by
+ line breaks ("\n"), where the last commandline shall have no line
break at the end
+ (e.g. "update_record 1 112233\nupdate_record 1 445566"). Naturally
this export method will always refer to the
+ currently selected file of the presented lchan.
+ """
+ return "# %s has no exportable contents" % str(lchan.selected_file)
+
class CardDF(CardFile):
"""DF (Dedicated File) in the smart card filesystem. Those are basically
sub-directories."""
--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37775?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ife2a9bad14750db84a87fab907297028c33f1f7d
Gerrit-Change-Number: 37775
Gerrit-PatchSet: 2
Gerrit-Owner: dexter <[email protected]>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <[email protected]>
Gerrit-Reviewer: fixeria <[email protected]>
Gerrit-Reviewer: laforge <[email protected]>