Browse Source

Don't repeat module name in class names

Alois Mahdal 10 years ago
parent
commit
776b48ca1e
1 changed files with 6 additions and 6 deletions
  1. 6
    6
      include/sardine.py

+ 6
- 6
include/sardine.py View File

5
 import sys
5
 import sys
6
 
6
 
7
 
7
 
8
-class SardinePluginError(Exception):
8
+class PluginError(Exception):
9
     pass
9
     pass
10
 
10
 
11
 
11
 
12
-class SardinePluginUsageError(SardinePluginError):
12
+class PluginUsageError(PluginError):
13
     pass
13
     pass
14
 
14
 
15
 
15
 
41
         method_n = "render_" + self.data.fmt
41
         method_n = "render_" + self.data.fmt
42
 
42
 
43
         def ex(__):
43
         def ex(__):
44
-            raise SardinePluginError("plugin method not defined: " + method_n)
44
+            raise PluginError("plugin method not defined: " + method_n)
45
 
45
 
46
         render_fn = getattr(self, method_n, ex)
46
         render_fn = getattr(self, method_n, ex)
47
         return render_fn()
47
         return render_fn()
84
                 module = imp.load_module(self.name, fh, modpath,
84
                 module = imp.load_module(self.name, fh, modpath,
85
                                          (".py", "r", imp.PY_SOURCE))
85
                                          (".py", "r", imp.PY_SOURCE))
86
         except IOError:
86
         except IOError:
87
-            raise SardinePluginError("no such plugin: %s" % self.name)
87
+            raise PluginError("no such plugin: %s" % self.name)
88
         self.plugin = module.Plugin(self.plugindata)
88
         self.plugin = module.Plugin(self.plugindata)
89
 
89
 
90
     def _format_output(self, raw):
90
     def _format_output(self, raw):
125
         try:
125
         try:
126
             self.subcommand = Subcommand(self.cmdargs, self.pluginpath)
126
             self.subcommand = Subcommand(self.cmdargs, self.pluginpath)
127
             print self.subcommand.get_output()
127
             print self.subcommand.get_output()
128
-        except SardinePluginUsageError as e:
128
+        except PluginUsageError as e:
129
             msg = ("plugin usage: %s %s %s"
129
             msg = ("plugin usage: %s %s %s"
130
                    % (self.name, self.subcommand.name, e))
130
                    % (self.name, self.subcommand.name, e))
131
             self.die(msg, 11)
131
             self.die(msg, 11)
132
-        except SardinePluginError as e:
132
+        except PluginError as e:
133
             self.die(e, 10)
133
             self.die(e, 10)