Commits

Anonymous committed 4416cf0

- remove unused parameter from add_commands()
- minor clean up

Comments (0)

Files changed (5)

+# coding=utf-8
 from setuptools import setup
 
 setup(
     ]
 
 
-def add_commands(cmds, name=None):
+def add_commands(cmds):
     """
     Adds one or more commands to the module namespace.
     Commands must end in "Command" to be added.
     sievelib.commands.add_commands(MytestCommand)
 
     :param cmds: a single Command Object or list of Command Objects
-    :param name: optional parameter under which to insert the Command
     """
     if not isinstance(cmds, Iterable):
         cmds = [cmds]
     """
     cname = "%sCommand" % name.lower().capitalize()
     if not globals().has_key(cname) or \
-            (checkexists and globals()[cname].is_extension and \
+            (checkexists and globals()[cname].is_extension and
                  not name in RequireCommand.loaded_extensions):
         raise UnknownCommand(name)
     return globals()[cname](parent)
         
         Simply checks if the filter is surrounded by a "if false" test.
 
-        :param name: the filter's name
+        :param fcontent: the filter's name
         """
         if not isinstance(fcontent, IfCommand):
             return False
                 return True
         return False
 
-    def replacefilter(self, oldname, filter, newname=None, description=None):
-        """replace a specific filter
+    def replacefilter(self, oldname, sieve_filter, newname=None, description=None):
+        """replace a specific sieve_filter
 
-        Instead of removing and re-creating the filter, we update the
+        Instead of removing and re-creating the sieve_filter, we update the
         content in order to keep the original order between filters.
 
-        :param oldname: the filter's current name
-        :param newname: the filter's new name
-        :param filter: the filter object as get from FiltersSet.getfilter()
+        :param oldname: the sieve_filter's current name
+        :param newname: the sieve_filter's new name
+        :param sieve_filter: the sieve_filter object as get from FiltersSet.getfilter()
         """
-        if newname == None:
+        if newname is None:
             newname = oldname
         for f in self.filters:
             if f["name"] == oldname:
                 f["name"] = newname
-                f["content"] = filter
-                if description != None:
+                f["content"] = sieve_filter
+                if description is not None:
                     f['description'] = description
                 if not f["enabled"]:
                     return self.disablefilter(newname)

sievelib/managesieve.py

             return False
 
         (active_script, scripts) = self.listscripts()
-        if scripts == None or not oldname in scripts:
+        if scripts is None or not oldname in scripts:
             self.errmsg = "Old script does not exist"
             return False
         if newname in scripts:
 
             m = self.regexp.match(text, self.pos)
             if m is None:
-                lineno = self.curlineno()
                 raise ParseError("unknown token %s" % text[self.pos:])
 
             self.pos = m.end()
 
         ctype = self.__curcommand.get_type()
         if ctype == "action" or \
-                (ctype == "control" and \
+                (ctype == "control" and
                      not self.__curcommand.accept_children):
             if testsemicolon:
                 self.__set_expected("semicolon")