Author: johannes Date: 2007-11-15 02:28:26 -0600 (Thu, 15 Nov 2007) New Revision: 9808
Modified: trunk/gnue-common/src/apps/GServerApp.py Log: Some minor changes to make pylint more happy with this file Modified: trunk/gnue-common/src/apps/GServerApp.py =================================================================== --- trunk/gnue-common/src/apps/GServerApp.py 2007-11-15 08:06:04 UTC (rev 9807) +++ trunk/gnue-common/src/apps/GServerApp.py 2007-11-15 08:28:26 UTC (rev 9808) @@ -20,6 +20,9 @@ # - Suite 330, Boston, MA 02111-1307, USA. # # $Id$ +""" +This module provides the base class for server applications in GNU Enterprise. +""" import sys import os @@ -27,9 +30,9 @@ import signal from gnue.common.apps.GBaseApp import GBaseApp -from gnue.common.apps import GConfig, errors -from gnue.common.apps.GLogger import Logger +from gnue.common.base import errors +__all__ = ['ServerRunningError', 'GServerApp'] # ============================================================================= # Exceptions @@ -58,7 +61,7 @@ def __init__(self, connections=None, application=None, defaults=None): self.COMMAND_OPTIONS.append( - ['foreground','Z','no-detach',0,0, None, + ['foreground', 'Z', 'no-detach', 0, 0, None, u_("Do not send the server into the background. For a POSIX system, " "this option keeps the server process from forking and detaching " "from its controlling terminal.")], @@ -73,8 +76,8 @@ if not self.OPTIONS['foreground']: if os.name == 'posix': - self.__removeStaleFile() - self.__createPidFile(0) + self.__remove_stale_file() + self.__create_pid_file(0) try: signal.signal(signal.SIGTERM, self._terminate) @@ -132,7 +135,7 @@ # We enclose these actions in try: blocks so that this doesn't fail on # non-Unix environments. - self.__removeStaleFile() + self.__remove_stale_file() try: # Fork #1 @@ -164,7 +167,7 @@ # Fork #2 pid = os.fork() if pid != 0: - self.__createPidFile(pid) + self.__create_pid_file(pid) sys.exit(0) except OSError: @@ -181,7 +184,7 @@ sys.stdout = open('/dev/null','w') os.close(sys.stderr.fileno()) - sys.stderr = serr = open('/dev/null','w') + sys.stderr = open('/dev/null','w') except AttributeError: pass @@ -193,7 +196,7 @@ # Create a new pid file # ------------------------------------------------------------------------- - def __createPidFile(self, pid): + def __create_pid_file(self, pid): """ This function creates a new pid file for the current process. @@ -213,7 +216,7 @@ # Remove a stale pid file # ------------------------------------------------------------------------- - def __removeStaleFile(self): + def __remove_stale_file(self): """ This function checks for a stale pid file. If a file exists, this function raises a ServerRunningError exception if the process is till @@ -245,7 +248,7 @@ # Handle a SIGTERM signal # ------------------------------------------------------------------------- - def _terminate(self, signal, frame): + def _terminate(self, signalnum, stack_frame): """ This function handles a SIGTERM signal and removes the pid-file if the server is running in the background. _______________________________________________ commit-gnue mailing list commit-gnue@gnu.org http://lists.gnu.org/mailman/listinfo/commit-gnue