minor typos fixed
authormartinko <gamato@users.sf.net>
Mon, 22 Aug 2011 11:18:36 +0000 (13:18 +0200)
committermartinko <gamato@users.sf.net>
Mon, 22 Aug 2011 11:18:36 +0000 (13:18 +0200)
python/skytools/config.py
python/skytools/scripting.py

index 089f43fa660be973631b7cc8c60d8acfec9799c2..9ec901686743f2fe4e2e886994f509378711e7e4 100644 (file)
@@ -10,7 +10,7 @@ class Config(object):
 
     Additional features:
      - Remembers section.
-     - Acceps defaults in get() functions.
+     - Accepts defaults in get() functions.
      - List value support.
     """
     def __init__(self, main_section, filename, sane_config = 1, user_defs = {}, override = {}, ignore_defs = False):
@@ -121,9 +121,9 @@ class Config(object):
 
     def getdict(self, key, default=None):
         """Reads key-value dict from parameter.
-        
+
         Key and value are separated with ':'.  If missing,
-        key iself is taken as value.
+        key itself is taken as value.
         """
         try:
             s = self.cf.get(self.main_section, key).strip()
@@ -147,7 +147,7 @@ class Config(object):
 
     def getfile(self, key, default=None):
         """Reads filename from config.
-        
+
         In addition to reading string value, expands ~ to user directory.
         """
         fn = self.get(key, default)
@@ -163,10 +163,10 @@ class Config(object):
 
     def get_wildcard(self, key, values=[], default=None):
         """Reads a wildcard property from conf and returns its string value, if not set then default."""
-        
+
         orig_key = key
         keys = [key]
-        
+
         for wild in values:
             key = key.replace('*', wild, 1)
             keys.append(key)
@@ -181,7 +181,7 @@ class Config(object):
         if default == None:
             raise Exception("Config value not set: " + orig_key)
         return default
-    
+
     def sections(self):
         """Returns list of sections in config file, excluding DEFAULT."""
         return self.cf.sections()
@@ -198,4 +198,3 @@ class Config(object):
     def has_option(self, opt):
         """Checks if option exists in main section."""
         return self.cf.has_option(self.main_section, opt)
-
index 3d175429bdc0cf680134fa6ed859bcf5b863ac86..471bbd650b5135f6a4aea560e2d2a538fca9fdc0 100644 (file)
@@ -58,7 +58,7 @@ def signal_pidfile(pidfile, sig):
 
 def daemonize():
     """Turn the process into daemon.
-    
+
     Goes background and disables all i/o.
     """
 
@@ -243,7 +243,7 @@ class BaseScript(object):
 
         NB: in case of daemon, the __init__() and startup()/work() will be
         run in different processes.  So nothing fancy should be done in __init__().
-        
+
         @param service_name: unique name for script.
             It will be also default job_name, if not specified in config.
         @param args: cmdline args (sys.argv[1:]), but can be overrided
@@ -297,7 +297,7 @@ class BaseScript(object):
 
     def print_ini(self):
         """Prints out ini file from doc string of the script of default for dbscript
-        
+
         Used by --ini option on command line.
         """
 
@@ -353,7 +353,7 @@ class BaseScript(object):
         return skytools.Config(self.service_name, conf_file, override = self.cf_operride)
 
     def init_optparse(self, parser = None):
-        """Initialize a OptionParser() instance that will be used to 
+        """Initialize a OptionParser() instance that will be used to
         parse command line arguments.
 
         Note that it can be overrided both directions - either DBScript
@@ -400,11 +400,11 @@ class BaseScript(object):
 
     def send_signal(self, sig):
         if not self.pidfile:
-            self.log.warning("No pidfile in config, nothing todo")
+            self.log.warning("No pidfile in config, nothing to do")
         elif os.path.isfile(self.pidfile):
             alive = signal_pidfile(self.pidfile, sig)
             if not alive:
-                self.log.warning("pidfile exist, but process not running")
+                self.log.warning("pidfile exists, but process not running")
         else:
             self.log.warning("No pidfile, process not running")
         sys.exit(0)
@@ -638,7 +638,7 @@ class DBScript(BaseScript):
 
         NB: in case of daemon, the __init__() and startup()/work() will be
         run in different processes.  So nothing fancy should be done in __init__().
-        
+
         @param service_name: unique name for script.
             It will be also default job_name, if not specified in config.
         @param args: cmdline args (sys.argv[1:]), but can be overrided
@@ -653,7 +653,7 @@ class DBScript(BaseScript):
     def get_database(self, dbname, autocommit = 0, isolation_level = -1,
                      cache = None, connstr = None):
         """Load cached database connection.
-        
+
         User must not store it permanently somewhere,
         as all connections will be invalidated on reset.
         """
@@ -683,7 +683,7 @@ class DBScript(BaseScript):
 
     def close_database(self, dbname):
         """Explicitly close a cached connection.
-        
+
         Next call to get_database() will reconnect.
         """
         if dbname in self.db_cache:
@@ -717,7 +717,7 @@ class DBScript(BaseScript):
             cname = d.cursor.connection.my_name
             dsn = getattr(conn, 'dsn', '?')
             sql = getattr(curs, 'query', '?')
-            if len(sql) > 200: # avoid logging londiste huge batched queries 
+            if len(sql) > 200: # avoid logging londiste huge batched queries
                 sql = sql[:60] + " ..."
             emsg = str(d).strip()
             self.log.exception("Job %s got error on connection '%s': %s.   Query: %s" % (
@@ -960,7 +960,3 @@ class DBCachedConn(object):
         """
         if self.loc != connstr:
             self.reset()
-
-
-
-