]> git.0d.be Git - botaradio.git/blobdiff - constants.py
also accept files according to their extension
[botaradio.git] / constants.py
index ed56effc6eadc326f5758df7df33dca28d73dc84..355112d1c00327ea3b74f882f0f152fd831b0f58 100644 (file)
@@ -2,33 +2,31 @@ import variables as var
 
 
 def strings(option, *argv, **kwargs):
-    string = ""
     try:
         string = var.config.get("strings", option)
-    except KeyError as e:
-        raise KeyError("Missed strings in configuration file: '{string}'. ".format(string=option) +
-                       "Please restore you configuration file back to default if necessary.")
+    except KeyError:
+        raise KeyError("Missed strings in configuration file: '{string}'. ".format(string=option)
+                       "Please restore you configuration file back to default if necessary.")
     if argv or kwargs:
         try:
             formatted = string.format(*argv, **kwargs)
             return formatted
         except KeyError as e:
             raise KeyError(
-                "Missed/Unexpected placeholder {{{placeholder}}} in string '{string}'. ".format(placeholder=str(e).strip("'"), string=option) +
-                "Please restore you configuration file back to default if necessary.")
-        except TypeError as e:
+                "Missed/Unexpected placeholder {{{placeholder}}} in string '{string}'. ".format(placeholder=str(e).strip("'"), string=option)
+                "Please restore you configuration file back to default if necessary.")
+        except TypeError:
             raise KeyError(
-                "Missed placeholder in string '{string}'. ".format(string=option) +
-                "Please restore you configuration file back to default if necessary.")
+                "Missed placeholder in string '{string}'. ".format(string=option)
+                "Please restore you configuration file back to default if necessary.")
     else:
         return string
 
 
 def commands(command):
-    string = ""
     try:
         string = var.config.get("commands", command)
         return string
-    except KeyError as e:
-        raise KeyError("Missed command in configuration file: '{string}'. ".format(string=command) +
-                       "Please restore you configuration file back to default if necessary.")
+    except KeyError:
+        raise KeyError("Missed command in configuration file: '{string}'. ".format(string=command)
+                       "Please restore you configuration file back to default if necessary.")