src/eric7/Project/Project.py

branch
eric7-maintenance
changeset 9940
a57c188857e9
parent 9832
3885b9d7bd31
parent 9925
a267ac36dd69
child 10004
983477114d3c
diff -r 9308099b7d38 -r a57c188857e9 src/eric7/Project/Project.py
--- a/src/eric7/Project/Project.py	Wed Mar 01 09:06:13 2023 +0100
+++ b/src/eric7/Project/Project.py	Wed Mar 29 10:03:06 2023 +0200
@@ -634,14 +634,18 @@
                 self.setDirty(True)
             self.__pdata[dataKey] = data
 
-    def getData(self, category, key):
+    def getData(self, category, key, default=None):
         """
         Public method to get data out of the project data store.
 
-        @param category category of the data to get (string, one of
+        @param category category of the data to get (one of
             PROJECTTYPESPECIFICDATA, CHECKERSPARMS, PACKAGERSPARMS,
             DOCUMENTATIONPARMS or OTHERTOOLSPARMS)
-        @param key key of the data entry to get (string).
+        @type str
+        @param key key of the data entry to get
+        @type str
+        @param default value to return in case the key is not found (defaults to None)
+        @type Any (optional)
         @return a copy of the requested data or None
         """
         # __IGNORE_WARNING_D202__
@@ -658,7 +662,7 @@
         ):
             return copy.deepcopy(self.__pdata[category][key])
         else:
-            return None
+            return default
 
     def setData(self, category, key, data):
         """
@@ -3835,6 +3839,9 @@
         @return project relative path or unchanged path, if path doesn't
             belong to the project (string)
         """
+        if path is None:
+            return ""
+
         try:
             return str(pathlib.Path(path).relative_to(self.ppath))
         except ValueError:

eric ide

mercurial