commit-gnue
[Top][All Lists]
Advanced

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

gnue common/installer/base.py common/installer/...


From: Jason Cater
Subject: gnue common/installer/base.py common/installer/...
Date: Fri, 03 May 2002 19:07:19 -0400

CVSROOT:        /cvsroot/gnue
Module name:    gnue
Changes by:     Jason Cater <address@hidden>    02/05/03 19:07:18

Modified files:
        common/installer: base.py demo.py 
        common/src     : GConditions.py GDataObjects.py GDataSource.py 
                         GLoginHandler.py GObjects.py 
        forms/samples/zipcode: zipcode.gfd 
Added files:
        common/installer: products.py pydistutils.py 

Log message:
        um, lots and lots of miscellaneous code cleanup

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/installer/products.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/installer/pydistutils.py?rev=1.1
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/installer/base.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/installer/demo.py.diff?tr1=1.1&tr2=1.2&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GConditions.py.diff?tr1=1.13&tr2=1.14&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GDataObjects.py.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GDataSource.py.diff?tr1=1.29&tr2=1.30&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GLoginHandler.py.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/common/src/GObjects.py.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/gnue/gnue/forms/samples/zipcode/zipcode.gfd.diff?tr1=1.19&tr2=1.20&r1=text&r2=text

Patches:
Index: gnue/common/installer/base.py
diff -c gnue/common/installer/base.py:1.1 gnue/common/installer/base.py:1.2
*** gnue/common/installer/base.py:1.1   Thu Jan 10 00:30:32 2002
--- gnue/common/installer/base.py       Fri May  3 19:07:18 2002
***************
*** 1,7 ****
  Python152 = 0x01050200
  Python16  = 0x01060000
  Python2  = 0x02000000
  Python20  = 0x02000000
  Python21  = 0x02010000
  Python22  = 0x02020000
!  
--- 1,38 ----
+ 
+ #
+ # Python version constants
+ #
  Python152 = 0x01050200
  Python16  = 0x01060000
  Python2  = 0x02000000
  Python20  = 0x02000000
  Python21  = 0x02010000
  Python22  = 0x02020000
! 
! class InstallerBase:
! 
! 
!   def __init__(self):
!     self._productCats = {}
!     self._products = {}
! 
! 
!   #
!   #
!   def setApplicationParameters(self, parameters):
!      self._parameters = parameters
! 
! 
!   #
!   #
!   def addProductCategory(self, category):
!     if not self._productCats.has_key(category):
!       self._productCats[category] = {}
! 
! 
!   #
!   #
!   def run(self):
!     pass
! 
! 
Index: gnue/common/installer/demo.py
diff -c gnue/common/installer/demo.py:1.1 gnue/common/installer/demo.py:1.2
*** gnue/common/installer/demo.py:1.1   Thu Jan 10 00:30:32 2002
--- gnue/common/installer/demo.py       Fri May  3 19:07:18 2002
***************
*** 1,16 ****
  #!/bin/env python
- import installer
  
  
- class Installer(installer.InstallerBase):
  
!   Application = 'GNU Enterprise
!   Author = 'GNU Enterprise'
!   Email = 'address@hidden'
!   MinimumPythonVersion = installer.Python20
  
!   def DependencyCheck(self):
!     pass
  
  
  if __name__ == '__main__':
--- 1,20 ----
  #!/bin/env python
  
+ import gnue_installer
  
  
! class FormsProduct(product)
! 
! 
! class Installer(installer.InstallerBase):
  
!   def __init__(self):
!     self.setApplicationParameters({
!       'Application': 'GNU Enterprise',
!       'Author': 'GNU Enterprise',
!       'Email': 'address@hidden',
!       'MinimumPythonVersion': installer.Python20,
!      })
  
  
  if __name__ == '__main__':
Index: gnue/common/src/GConditions.py
diff -c gnue/common/src/GConditions.py:1.13 gnue/common/src/GConditions.py:1.14
*** gnue/common/src/GConditions.py:1.13 Fri May  3 11:31:22 2002
--- gnue/common/src/GConditions.py      Fri May  3 19:07:18 2002
***************
*** 122,180 ****
      self.value = value
  
  class GCand(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GCand')
  
  class GCor(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GCor')
  
  class GCnot(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GCnot')
  
  class GCnegate(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GCnegate')
  
  class GCeq(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GCeq')
  
  class GCne(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GCne')
  
  class GCgt(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GCgt')
  
  class GCge(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GCge')
  
  class GClt(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GClt')
  
  class GCle(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GCle')
  
  class GClike(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GClike')
  
  class GCnotlike(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GCnotlike')
  
  class GCbetween(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GCbetween')
  
  class GCnotbetween(GConditionElement):
!   def __init__(self, parent):
      GConditionElement.__init__(self, parent, 'GCnotbetween')
  
  
--- 122,180 ----
      self.value = value
  
  class GCand(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GCand')
  
  class GCor(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GCor')
  
  class GCnot(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GCnot')
  
  class GCnegate(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GCnegate')
  
  class GCeq(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GCeq')
  
  class GCne(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GCne')
  
  class GCgt(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GCgt')
  
  class GCge(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GCge')
  
  class GClt(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GClt')
  
  class GCle(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GCle')
  
  class GClike(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GClike')
  
  class GCnotlike(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GCnotlike')
  
  class GCbetween(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GCbetween')
  
  class GCnotbetween(GConditionElement):
!   def __init__(self, parent=None):
      GConditionElement.__init__(self, parent, 'GCnotbetween')
  
  
Index: gnue/common/src/GDataObjects.py
diff -c gnue/common/src/GDataObjects.py:1.49 
gnue/common/src/GDataObjects.py:1.50
*** gnue/common/src/GDataObjects.py:1.49        Fri May  3 13:13:29 2002
--- gnue/common/src/GDataObjects.py     Fri May  3 19:07:18 2002
***************
*** 84,90 ****
  class DataObject:
  
    def __init__(self):
!     # Set by
      self.masterlink = ""
      self.detaillink = ""
  
--- 84,90 ----
  class DataObject:
  
    def __init__(self):
!     # Set by parser
      self.masterlink = ""
      self.detaillink = ""
  
***************
*** 437,443 ****
      recordPosition = 0
      while recordPosition < len(self._cachedRecords):
        record = self._cachedRecords[recordPosition]
!       
        delete = record._emptyFlag or record._deleteFlag
        if not delete:
          # Flip the flag for 'default' values to true so that hidden
--- 437,443 ----
      recordPosition = 0
      while recordPosition < len(self._cachedRecords):
        record = self._cachedRecords[recordPosition]
! 
        delete = record._emptyFlag or record._deleteFlag
        if not delete:
          # Flip the flag for 'default' values to true so that hidden
Index: gnue/common/src/GDataSource.py
diff -c gnue/common/src/GDataSource.py:1.29 gnue/common/src/GDataSource.py:1.30
*** gnue/common/src/GDataSource.py:1.29 Fri May  3 13:15:55 2002
--- gnue/common/src/GDataSource.py      Fri May  3 19:07:18 2002
***************
*** 50,58 ****
  
    def __init__(self, parent=None, type="GDataSource"):
      GObjects.GObj.__init__(self, parent, type)
!     self.type = ""
      self.database = None
!     self._connectionManager = None
      self._dataObject = None
      self._connectionComment = ""
      self._fieldReferences = {}
--- 50,58 ----
  
    def __init__(self, parent=None, type="GDataSource"):
      GObjects.GObj.__init__(self, parent, type)
!     self.type = "object"
      self.database = None
!     self._connections = None
      self._dataObject = None
      self._connectionComment = ""
      self._fieldReferences = {}
***************
*** 62,69 ****
      self._inits =[self.primaryInit, self.secondaryInit]
      self._currentResultSet = None
      self._resultSetListeners = []
!     self._toplevelParent = None # Needs set by subclass so
!                                 # that _topObject gets set
      self._topObject = None
  
      #
--- 62,69 ----
      self._inits =[self.primaryInit, self.secondaryInit]
      self._currentResultSet = None
      self._resultSetListeners = []
!     self._toplevelParent = self._type # Needs to be set by subclass
!                                       # so that _topObject gets set
      self._topObject = None
  
      #
***************
*** 76,81 ****
--- 76,88 ----
                                               },
                                }
  
+   def __getattr__(self, attr):
+     print "Calling __getattr__('%s')" % attr
+     if self._dataObject and attr[1] != '_':
+       return getattr(self._dataObject,attr)
+     else:
+       raise AttributeError
+ 
  
    def triggerSimpleQuery(self,maskDict):
      queryDict = {}
***************
*** 105,111 ****
    # but before any other methods are called
    #
    def setConnectionManager(self, connectionManager):
!     self._connectionManager = connectionManager
  
    def initialize(self):
  
--- 112,118 ----
    # but before any other methods are called
    #
    def setConnectionManager(self, connectionManager):
!     self._connections = connectionManager
  
    def initialize(self):
  
***************
*** 116,137 ****
        GDebug.printMesg (7, 'Using empty data driver')
        self._dataObject = DBdriver.supportedDataObjects['object']()
  
!     elif self._connectionManager:
        self.database = string.lower(self.database)
        # This will throw a GConnections.NotFoundError if an unknown
        # connection name is specified.  The calling method should
        # catch this exception and handle it properly (exit w/message)
!       self._dataObject = \
!          self._connectionManager.getDataObject(self.database, self.type)
        GDebug.printMesg (7, "GDataSource.py bound to %s " % self._dataObject)
  
!     self._dataObject._fieldReferences = self._fieldReferences
!     self._dataObject._unboundFieldReferences = self._unboundFieldReferences
!     self._dataObject._defaultValues = self._defaultValues
!     self._dataObject._dataSource = self
      for child in self._children:
        if isinstance(child, GConditions.GCondition):
!         self._dataObject._staticCondition = child
          break
  
  
--- 123,144 ----
        GDebug.printMesg (7, 'Using empty data driver')
        self._dataObject = DBdriver.supportedDataObjects['object']()
  
!     elif self._connections:
        self.database = string.lower(self.database)
        # This will throw a GConnections.NotFoundError if an unknown
        # connection name is specified.  The calling method should
        # catch this exception and handle it properly (exit w/message)
!       dataObject = \
!          self._connections.getDataObject(self.database, self.type)
        GDebug.printMesg (7, "GDataSource.py bound to %s " % self._dataObject)
  
!     dataObject._fieldReferences = self._fieldReferences
!     dataObject._unboundFieldReferences = self._unboundFieldReferences
!     dataObject._defaultValues = self._defaultValues
!     dataObject._dataSource = self
      for child in self._children:
        if isinstance(child, GConditions.GCondition):
!         dataObject._staticCondition = child
          break
  
  
***************
*** 139,150 ****
      tagAttributes = getXMLelements()['datasource']['Attributes']
      for attribute in tagAttributes.keys():
        if hasattr(self, attribute):
!         self._dataObject.__dict__[attribute] = self.__dict__[attribute]
  
  
    def connect(self):
      if self.database != None:
!       self._connectionManager.\
             requestConnection(self._dataObject, self.database)
  
    def getDataObject(self):
--- 146,163 ----
      tagAttributes = getXMLelements()['datasource']['Attributes']
      for attribute in tagAttributes.keys():
        if hasattr(self, attribute):
!         dataObject.__dict__[attribute] = self.__dict__[attribute]
!       else:
!         try:
!           dataObject.__dict__[attribute] = tagAttributes[attribute]['Default']
!         except KeyError:
!           pass
!     self._dataObject = dataObject
  
  
    def connect(self):
      if self.database != None:
!       self._connections.\
             requestConnection(self._dataObject, self.database)
  
    def getDataObject(self):
Index: gnue/common/src/GLoginHandler.py
diff -c gnue/common/src/GLoginHandler.py:1.4 
gnue/common/src/GLoginHandler.py:1.5
*** gnue/common/src/GLoginHandler.py:1.4        Fri Mar  1 23:10:24 2002
--- gnue/common/src/GLoginHandler.py    Fri May  3 19:07:18 2002
***************
*** 57,59 ****
--- 57,62 ----
      pass
  
  
+   # Called when the app no longer needs the login handler
+   def destroyLoginDialog(self):
+     pass
Index: gnue/common/src/GObjects.py
diff -c gnue/common/src/GObjects.py:1.35 gnue/common/src/GObjects.py:1.36
*** gnue/common/src/GObjects.py:1.35    Sun Apr 28 21:52:53 2002
--- gnue/common/src/GObjects.py Fri May  3 19:07:18 2002
***************
*** 65,70 ****
--- 65,85 ----
      if parent :
        parent.addChild(self)
  
+ 
+   # This is a convenience function for applications
+   # NOT using GParser to load an object tree.
+   def buildObject(self, **params):
+     self.__dict__.update(params)
+     return self._buildObject()
+ 
+     
+   # This is a convenience function for applications
+   # NOT using GParser to load an object tree.
+   def buildAndInitObject(self, **params):
+     self.phaseInit(self.buildObject(**params))
+ 
+ 
+ 
    #
    # phaseInit
    #
***************
*** 102,108 ****
      return content
  
    def showTree(self, indent=0):
!     print ' ' * indent + `self._type` + `self`
      for child in self._children:
         child.showTree(indent + 2)
  
--- 117,123 ----
      return content
  
    def showTree(self, indent=0):
!     print ' ' * indent + `self._type`
      for child in self._children:
         child.showTree(indent + 2)
  
Index: gnue/forms/samples/zipcode/zipcode.gfd
diff -c gnue/forms/samples/zipcode/zipcode.gfd:1.19 
gnue/forms/samples/zipcode/zipcode.gfd:1.20
*** gnue/forms/samples/zipcode/zipcode.gfd:1.19 Sun Mar 31 15:41:20 2002
--- gnue/forms/samples/zipcode/zipcode.gfd      Fri May  3 19:07:18 2002
***************
*** 21,27 ****
          </options>
        </entry>
        <label x="17" y="1" name="Label_2" text="State"/>
!       <entry x="17" y="2" field="state" name="state" width="15"
                foreign_key="validator.state"
               foreign_key_description="description"> 
          <options>
--- 21,27 ----
          </options>
        </entry>
        <label x="17" y="1" name="Label_2" text="State"/>
!       <entry x="17" y="2" field="state" style="dropdown" name="state" 
width="15"
                foreign_key="validator.state"
               foreign_key_description="description"> 
          <options>



reply via email to

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