commit-gnue
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnue common/src/GBaseApp.py common/src/GClientA...


From: Jason Cater
Subject: gnue common/src/GBaseApp.py common/src/GClientA...
Date: Wed, 18 Sep 2002 01:13:01 -0400

CVSROOT:        /home/cvs
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/09/18 01:13:01

Modified files:
        common/src     : GBaseApp.py GClientApp.py GConfig.py 
        forms/src      : GFConfig.py 
Added files:
        common/src     : GCConfig.py 

Log message:
        * Added support for a [common] section in gnue.conf
        * Moved StoreTriggersAsCDATA to [common]
        * Added ImportPath to [common] so end developers can write their own 
modules
        that can easily be referenced in, say, trigger code without adding the
        needed modules to the system python path.
        (e.g., you can have ImportPath=/usr/local/gnue/import,/home/me/mypython)
        * Misc performance improvements in GBaseApp

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/GCConfig.py?cvsroot=OldCVS&rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/GBaseApp.py.diff?cvsroot=OldCVS&tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/GClientApp.py.diff?cvsroot=OldCVS&tr1=1.15&tr2=1.16&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/common/src/GConfig.py.diff?cvsroot=OldCVS&tr1=1.26&tr2=1.27&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/forms/src/GFConfig.py.diff?cvsroot=OldCVS&tr1=1.16&tr2=1.17&r1=text&r2=text

Patches:
Index: gnue/common/src/GBaseApp.py
diff -c gnue/common/src/GBaseApp.py:1.25 gnue/common/src/GBaseApp.py:1.26
*** gnue/common/src/GBaseApp.py:1.25    Tue Sep 17 11:27:44 2002
--- gnue/common/src/GBaseApp.py Wed Sep 18 01:13:01 2002
***************
*** 1,19 ****
  #
  # This file is part of GNU Enterprise.
  #
! # GNU Enterprise is free software; you can redistribute it 
! # and/or modify it under the terms of the GNU General Public 
! # License as published by the Free Software Foundation; either 
  # version 2, or (at your option) any later version.
  #
! # GNU Enterprise is distributed in the hope that it will be 
! # useful, but WITHOUT ANY WARRANTY; without even the implied 
  # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  # PURPOSE. See the GNU General Public License for more details.
  #
! # You should have received a copy of the GNU General Public 
! # License along with program; see the file COPYING. If not, 
! # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
  # Copyright 2000-2002 Free Software Foundation
--- 1,19 ----
  #
  # This file is part of GNU Enterprise.
  #
! # GNU Enterprise is free software; you can redistribute it
! # and/or modify it under the terms of the GNU General Public
! # License as published by the Free Software Foundation; either
  # version 2, or (at your option) any later version.
  #
! # GNU Enterprise is distributed in the hope that it will be
! # useful, but WITHOUT ANY WARRANTY; without even the implied
  # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  # PURPOSE. See the GNU General Public License for more details.
  #
! # You should have received a copy of the GNU General Public
! # License along with program; see the file COPYING. If not,
! # write to the Free Software Foundation, Inc., 59 Temple Place
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
  # Copyright 2000-2002 Free Software Foundation
***************
*** 28,35 ****
  # Typically, this class will not be called; rather, a tool will
  # be a GClientApp or GServerApp.
  #
- # HISTORY:
- #
  
  import GConfig
  #
--- 28,33 ----
***************
*** 142,155 ****
      for optionset in [self._base_options, self.COMMAND_OPTIONS]:
        for option in optionset:
          self.OPTIONS[option[0]] = option[4]
!         if option[1] != None: 
!           shortoptions = shortoptions + option[1]
            lookup["-" + option[1]] = option[0]
          lookup["--" + option[2]] = option[0]
          lo = option[2]
!         if option[3]:   
!           lo = lo + '='
!           shortoptions = shortoptions + ':'
          longoptions.append(lo)
  
      try:
--- 140,153 ----
      for optionset in [self._base_options, self.COMMAND_OPTIONS]:
        for option in optionset:
          self.OPTIONS[option[0]] = option[4]
!         if option[1] != None:
!           shortoptions += option[1]
            lookup["-" + option[1]] = option[0]
          lookup["--" + option[2]] = option[0]
          lo = option[2]
!         if option[3]:
!           lo += '='
!           shortoptions += ':'
          longoptions.append(lo)
  
      try:
***************
*** 193,200 ****
      except ValueError:
        self.handleStartupError(_('The debug_level option ("-d") expects a 
numerical value.'))
  
!         
!     
      GDebug.printMesg(1,"Python %s" % sys.version)
      GDebug.printMesg(1,"Run Options: %s" % opt)
      GDebug.printMesg(1,"Run Arguments: %s" % self.ARGUMENTS)
--- 191,198 ----
      except ValueError:
        self.handleStartupError(_('The debug_level option ("-d") expects a 
numerical value.'))
  
! 
! 
      GDebug.printMesg(1,"Python %s" % sys.version)
      GDebug.printMesg(1,"Run Options: %s" % opt)
      GDebug.printMesg(1,"Run Arguments: %s" % self.ARGUMENTS)
***************
*** 212,217 ****
--- 210,228 ----
          self.handleStartupError( \
            _('%s while reading gnue.conf: ') % type[0] \
            + '\n   %s'         % msg)
+ 
+     # Add custom import to python's namespace
+     try:
+       extrapaths = gConfig('ImportPath')
+       print extrapaths
+     except:
+       extrapaths = ""
+     if extrapaths:
+       for path in string.split(extrapaths,','):
+         p = string.strip(path)
+         if not p in sys.path:
+           sys.path.append(p)
+           print "Appending %s" % p
  
      # Get the connection definitions
      if connections != None:
Index: gnue/common/src/GClientApp.py
diff -c gnue/common/src/GClientApp.py:1.15 gnue/common/src/GClientApp.py:1.16
*** gnue/common/src/GClientApp.py:1.15  Fri May  3 11:17:46 2002
--- gnue/common/src/GClientApp.py       Wed Sep 18 01:13:01 2002
***************
*** 16,40 ****
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000, 2001 Free Software Foundation
  #
  # FILE:
  # GClientApp.py
  #
  # DESCRIPTION:
! # Class that provides a basis for GNUe client applications. 
  #
  # NOTES:
  # This will eventually have features only needed by "client"
  # applications, such as abstracted client RPC calls via
! # CORBA, RPC-XML, SOAP, etc. 
! #
! # HISTORY:
  #
  
  from GBaseApp import GBaseApp
  
! class GClientApp(GBaseApp): 
  
    #
    #  Set the login handler for this session
--- 16,38 ----
  # write to the Free Software Foundation, Inc., 59 Temple Place 
  # - Suite 330, Boston, MA 02111-1307, USA.
  #
! # Copyright 2000-2002 Free Software Foundation
  #
  # FILE:
  # GClientApp.py
  #
  # DESCRIPTION:
! # Class that provides a basis for GNUe client applications.
  #
  # NOTES:
  # This will eventually have features only needed by "client"
  # applications, such as abstracted client RPC calls via
! # CORBA, RPC-XML, SOAP, etc.
  #
  
  from GBaseApp import GBaseApp
  
! class GClientApp(GBaseApp):
  
    #
    #  Set the login handler for this session
Index: gnue/common/src/GConfig.py
diff -c gnue/common/src/GConfig.py:1.26 gnue/common/src/GConfig.py:1.27
*** gnue/common/src/GConfig.py:1.26     Tue Sep 17 11:27:44 2002
--- gnue/common/src/GConfig.py  Wed Sep 18 01:13:01 2002
***************
*** 27,39 ****
  #
  # NOTES:
  #
- # HISTORY:
- #
  
  from ConfigParser import *
  import os, sys, string
  from gnue.common.FileUtils import openResource
  from gnue.common.TextUtils import lineWrap
  import GDebug
  import copy
  
--- 27,38 ----
  #
  # NOTES:
  #
  
  from ConfigParser import *
  import os, sys, string
  from gnue.common.FileUtils import openResource
  from gnue.common.TextUtils import lineWrap
+ import GCConfig
  import GDebug
  import copy
  
***************
*** 81,90 ****
      for key in defaultValues.keys():
        self._loadedConfigs[configFilename].set(section,key,defaultValues[key])
  
      # Skip reading the files if the parser for that section already existed
      if not readFiles:
        return
!     
      # Build valid file list
      fileLocations = []
      etc_base = getInstalledBase('%s_etc' % section, 'common_etc')
--- 80,98 ----
      for key in defaultValues.keys():
        self._loadedConfigs[configFilename].set(section,key,defaultValues[key])
  
+     # Load any [common] defaults
+     defaultValues = self._buildDefaults(GCConfig.ConfigOptions)
+     try:
+       self._loadedConfigs[configFilename].add_section('common')
+     except DuplicateSectionError:
+       pass
+     for key in defaultValues.keys():
+       self._loadedConfigs[configFilename].set('common',key,defaultValues[key])
+ 
      # Skip reading the files if the parser for that section already existed
      if not readFiles:
        return
! 
      # Build valid file list
      fileLocations = []
      etc_base = getInstalledBase('%s_etc' % section, 'common_etc')
***************
*** 122,132 ****
      except NoSectionError:
        self._loadedConfigs[configFilename].add_section(section)
        return self._loadedConfigs[configFilename].get(section,varName)
  
    def gConfigDict(self, configFilename=None, section=None):
      if not configFilename: configFilename = self._defaultConfigFilename
      if not section:      section = self._defaultSection
!     
      options = {}
      for option in self._loadedConfigs[configFilename].options(section):
          options[option] =  
self._loadedConfigs[configFilename].get(section,string.lower(option))
--- 130,147 ----
      except NoSectionError:
        self._loadedConfigs[configFilename].add_section(section)
        return self._loadedConfigs[configFilename].get(section,varName)
+     except NoOptionError:
+       section = 'common'
+       try:
+         return self._loadedConfigs[configFilename].get(section,varName)
+       except NoSectionError:
+         self._loadedConfigs[configFilename].add_section(section)
+         return self._loadedConfigs[configFilename].get(section,varName)
  
    def gConfigDict(self, configFilename=None, section=None):
      if not configFilename: configFilename = self._defaultConfigFilename
      if not section:      section = self._defaultSection
! 
      options = {}
      for option in self._loadedConfigs[configFilename].options(section):
          options[option] =  
self._loadedConfigs[configFilename].get(section,string.lower(option))
Index: gnue/forms/src/GFConfig.py
diff -c gnue/forms/src/GFConfig.py:1.16 gnue/forms/src/GFConfig.py:1.17
*** gnue/forms/src/GFConfig.py:1.16     Tue Sep 10 11:30:50 2002
--- gnue/forms/src/GFConfig.py  Wed Sep 18 01:13:01 2002
***************
*** 22,30 ****
  # GFConfig.py
  #
  # DESCRIPTION:
  #
! # NOTES:
! #
  from gnue.common import GTypecast
  
  ConfigOptions = (
--- 22,31 ----
  # GFConfig.py
  #
  # DESCRIPTION:
+ # Valid configuration options for forms
+ # (appears under [forms] section in gnue.conf)
  #
! 
  from gnue.common import GTypecast
  
  ConfigOptions = (
***************
*** 59,64 ****
--- 60,66 ----
                   + 'doing an Enter-Query twice)',
      'Typecast'   : GTypecast.boolean,
      'Default'    : 1 },
+ 
    { 'Name'       : 'EnterIsNewLine',
      'Type'       : 'Setting',
      'Comment'    : 'Treat enter as shift-enter in multi-line text boxes.',
***************
*** 197,209 ****
      'Typecast'   : GTypecast.text,
      'Default'    : 'iso8859-1' },
  
- 
-   { 'Name'       : 'StoreTriggersAsCDATA',
-     'Type'       : 'Setting',
-     'Comment'    : 'Hack for db encoding',
-     'Description': 'Hack for db encoding.',
-     'Typecast'   : GTypecast.text,
-     'Default'    : 'DEFAULT' },
  
    { 'Name'       : 'SplashScreenPNG',
      'Type'       : 'Setting',
--- 199,204 ----




reply via email to

[Prev in Thread] Current Thread [Next in Thread]