[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[gnue] r7871 - trunk/gnue-common/src/apps
From: |
jamest |
Subject: |
[gnue] r7871 - trunk/gnue-common/src/apps |
Date: |
Fri, 19 Aug 2005 23:19:04 -0500 (CDT) |
Author: jamest
Date: 2005-08-19 23:19:03 -0500 (Fri, 19 Aug 2005)
New Revision: 7871
Modified:
trunk/gnue-common/src/apps/GBaseApp.py
Log:
more basic cleanup trying to make pylint happy
Modified: trunk/gnue-common/src/apps/GBaseApp.py
===================================================================
--- trunk/gnue-common/src/apps/GBaseApp.py 2005-08-19 21:42:00 UTC (rev
7870)
+++ trunk/gnue-common/src/apps/GBaseApp.py 2005-08-20 04:19:03 UTC (rev
7871)
@@ -26,11 +26,11 @@
Typically, this class will not be called; rather, a tool will be a GClientApp
or GServerApp.
"""
+__revision__ = "$Id"
import sys
import os
import getopt
-import string
import types
import ConfigParser
import gc
@@ -40,7 +40,7 @@
from gnue.common.apps import errors, GConfig, GDebug
from gnue.common.datasources import GConnections
-from CommandOption import CommandOption
+from gnue.common.apps.CommandOption import CommandOption
# =============================================================================
@@ -48,6 +48,10 @@
# =============================================================================
class StartupError (errors.UserError):
+ """
+ Error raised when a gnue application fails during initial startup prior to
+ initializing to the point that better error handlers are available.
+ """
pass
@@ -265,7 +269,7 @@
# be more efficent in mod_python cases
# But not this close to a release :)
if not sys.__dict__.has_key('argv'):
- sys.argv=[]
+ sys.argv = []
try:
opt, self.ARGUMENTS = getopt.getopt (sys.argv[1:], shortoptions,
@@ -325,7 +329,7 @@
self.OPTIONS ['debug-file'])
except ValueError:
raise StartupError, \
- _('The debug_level option ("-d") expects numerical values.')
+ _('The debug_level option ("-d") expects numerical values.')
gDebug (2, "Python %s" % sys.version)
gDebug (2, "Run Options: %s" % opt)
@@ -347,8 +351,8 @@
except:
extrapaths = ""
if extrapaths:
- for path in string.split(extrapaths,','):
- p = string.strip(path)
+ for path in extrapaths.split(','):
+ p = path.strip()
if not p in sys.path:
sys.path.append(p)
@@ -383,7 +387,7 @@
u_("Unable to load the connections definition file.\n\n"
"The connections file is in an invalid format.\n%s") % msg
- except IOError, err:
+ except IOError:
raise StartupError, \
u_("Unable to load the connections definition file: %s.") \
% self.connections_file
@@ -458,7 +462,7 @@
( category == option.category ) ):
continue
- allOptions [string.upper (option.longOption)] = option
+ allOptions [option.longOption.upper ()] = option
if option.acceptsArgument:
descr = '--%s <%s>' % (option.longOption, option.argumentName)
@@ -467,13 +471,11 @@
if option.shortOption:
descr += ', -%s' % option.shortOption
- descriptors [string.upper (option.longOption)] = descr
+ descriptors [option.longOption.upper()] = descr
- if len (descr) > maxLength:
- maxLength = len (descr)
+ maxLength = max(len (descr), maxLength)
- if maxLength > 10:
- maxLength = 10
+ maxLength = min(10, maxLength)
sorted = allOptions.keys ()
sorted.sort ()
@@ -491,7 +493,7 @@
dispOptions += "\n %s %s" % (descriptors [optionKey],
" " * (maxLength - len (descriptors [optionKey])))
- for word in string.split (allOptions [optionKey].help):
+ for word in allOptions [optionKey].help.split():
if (len (word) + pos) > width:
pos = 0
dispOptions += "\n" + " " * margin
@@ -639,13 +641,13 @@
parameters = {}
for param in paramList:
- psplit = string.split (param, '=', 1)
+ psplit = param.split('=', 1)
if len (psplit) == 1:
raise StartupError, \
'Parameter "%s" specified, but no value supplied.' % psplit [0]
- parameters [string.lower (psplit [0])] = psplit [1]
+ parameters [psplit [0].lower()] = psplit [1]
- gDebug (2,'Param "%s"="%s" ' % (string.lower (psplit [0]), psplit [1]))
+ gDebug (2,'Param "%s"="%s" ' % (psplit [0].lower(), psplit [1]))
return parameters
@@ -664,11 +666,11 @@
self.printVersion ()
# if msg is multiline, then surround with dashes to set it apart
- if string.find ("%s" % msg, "\n") + 1:
+ if ("%s" % msg).find("\n") + 1:
print '-' * 60
print o(u_("Error: %s") % msg)
- if string.find ("%s" % msg, "\n") + 1:
+ if ("%s" % msg).find("\n") + 1:
print '-' * 60
print o(u_("\nFor help, type:\n %s --help\n") % self.COMMAND)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [gnue] r7871 - trunk/gnue-common/src/apps,
jamest <=