commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r7450 - in trunk/gnue-common/src: datasources/drivers/Base/Schema


From: reinhard
Subject: [gnue] r7450 - in trunk/gnue-common/src: datasources/drivers/Base/Schema/Creation datasources/drivers/adodbapi/Schema/Discovery datasources/drivers/appserver/Schema/Discovery datasources/drivers/file datasources/drivers/interbase/Schema/Discovery datasources/drivers/mysql/Schema/Discovery datasources/drivers/oracle/Schema/Discovery datasources/drivers/postgresql/Schema/Discovery datasources/drivers/sapdb/Schema/Creation datasources/drivers/sapdb/Schema/Discovery datasources/drivers/sqlite/Schema/Discovery schema/scripter
Date: Thu, 21 Apr 2005 04:11:44 -0500 (CDT)

Author: reinhard
Date: 2005-04-21 04:11:42 -0500 (Thu, 21 Apr 2005)
New Revision: 7450

Modified:
   trunk/gnue-common/src/datasources/drivers/Base/Schema/Creation/Creation.py
   
trunk/gnue-common/src/datasources/drivers/adodbapi/Schema/Discovery/Introspection.py
   
trunk/gnue-common/src/datasources/drivers/appserver/Schema/Discovery/Introspection.py
   trunk/gnue-common/src/datasources/drivers/file/Base.py
   
trunk/gnue-common/src/datasources/drivers/interbase/Schema/Discovery/Introspection.py
   
trunk/gnue-common/src/datasources/drivers/mysql/Schema/Discovery/Introspection.py
   
trunk/gnue-common/src/datasources/drivers/oracle/Schema/Discovery/Introspection.py
   
trunk/gnue-common/src/datasources/drivers/postgresql/Schema/Discovery/Introspection.py
   trunk/gnue-common/src/datasources/drivers/sapdb/Schema/Creation/Creation.py
   
trunk/gnue-common/src/datasources/drivers/sapdb/Schema/Discovery/Introspection.py
   
trunk/gnue-common/src/datasources/drivers/sqlite/Schema/Discovery/Introspection.py
   trunk/gnue-common/src/schema/scripter/Scripter.py
Log:
Several epydoc fixes.


Modified: 
trunk/gnue-common/src/datasources/drivers/Base/Schema/Creation/Creation.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/Base/Schema/Creation/Creation.py  
2005-04-21 06:50:58 UTC (rev 7449)
+++ trunk/gnue-common/src/datasources/drivers/Base/Schema/Creation/Creation.py  
2005-04-21 09:11:42 UTC (rev 7450)
@@ -33,25 +33,31 @@
 
 class NoCreationError (Error):
   def __init__ (self):
-    msg = _("Database creation not implemented by this driver")
-    Error.__init__ (self, msg)
+    Error.__init__ (self,
+        u_("Database creation not implemented by this driver"))
 
 class DefinitionError (Error):
   pass
 
 class MissingKeyError (DefinitionError):
-  MSG = u_("The definition has no attribute '%s'")
   def __init__ (self, attribute):
-    DefinitionError.__init__ (self, self.MSG % attribute)
+    DefinitionError.__init__ (self,
+        u_("The definition has no attribute '%s'") % attribute)
 
-class TableDefinitionError (MissingKeyError):
-  MSG = u_("The table definition has no attribute '%s'")
+class TableDefinitionError (DefinitionError):
+  def __init__ (self, attribute):
+    DefinitionError.__init__ (self,
+        u_("The table definition has no attribute '%s'") % attribute)
 
-class FieldDefinitionError (MissingKeyError):
-  MSG = u_("The field definition has no attribute '%s'")
+class FieldDefinitionError (DefinitionError):
+  def __init__ (self, attribute):
+    DefinitionError.__init__ (self,
+        u_("The field definition has no attribute '%s'") % attribute)
 
-class PrimaryKeyDefinitionError (MissingKeyError):
-  MSG = u_("Primarykey definition has no attribute '%s'")
+class PrimaryKeyDefinitionError (DefinitionError):
+  def __init__ (self, attribute):
+    DefinitionError.__init__ (self,
+        u_("Primarykey definition has no attribute '%s'") % attribute)
 
 class PrimaryKeyFieldsError (Error):
   def __init__ (self, table, name):
@@ -66,8 +72,10 @@
              "table modification") % table
     DefinitionError.__init__ (self, msg)
 
-class IndexDefinitionError (MissingKeyError):
-  MSG = u_("Index definition has no attribute '%s'")
+class IndexDefinitionError (DefinitionError):
+  def __init__ (self, attribute):
+    DefinitionError.__init__ (self,
+        u_("Index definition has no attribute '%s'") % attribute)
 
 class IndexFieldsError (Error):
   def __init__ (self, table, name):
@@ -76,8 +84,10 @@
              'table': table}
     Error.__init__ (self, msg)
 
-class ConstraintDefinitionError (MissingKeyError):
-  MSG = u_("Constraint definition has no attribute '%s'")
+class ConstraintDefinitionError (DefinitionError):
+  def __init__ (self, attribute):
+    DefinitionError.__init__ (self,
+        u_("Constraint definition has no attribute '%s'") % attribute)
 
 class ConstraintFieldsError (Error):
   def __init__ (self, table, name, fields):

Modified: 
trunk/gnue-common/src/datasources/drivers/adodbapi/Schema/Discovery/Introspection.py
===================================================================
--- 
trunk/gnue-common/src/datasources/drivers/adodbapi/Schema/Discovery/Introspection.py
        2005-04-21 06:50:58 UTC (rev 7449)
+++ 
trunk/gnue-common/src/datasources/drivers/adodbapi/Schema/Discovery/Introspection.py
        2005-04-21 09:11:42 UTC (rev 7450)
@@ -53,9 +53,11 @@
 
 class Introspection(GIntrospection.Introspection):
 
-  # list of the types of Schema objects this driver provides
-  types =[ ('view',_('Views'),1),
-           ('table',_('Tables'),1) ]
+  def __init__ (self, connection):
+    GIntrospection.Introspection.__init__ (self, connection)
+    self.types = [
+        ('view',  _('Views'),  True),
+        ('table', _('Tables'), True)]
 
   #
   # TODO: This is a quick hack to get this class

Modified: 
trunk/gnue-common/src/datasources/drivers/appserver/Schema/Discovery/Introspection.py
===================================================================
--- 
trunk/gnue-common/src/datasources/drivers/appserver/Schema/Discovery/Introspection.py
       2005-04-21 06:50:58 UTC (rev 7449)
+++ 
trunk/gnue-common/src/datasources/drivers/appserver/Schema/Discovery/Introspection.py
       2005-04-21 09:11:42 UTC (rev 7450)
@@ -31,6 +31,7 @@
 
 import string
 
+from gnue.common.apps import errors
 from gnue.common.datasources import GIntrospection
 
 # =============================================================================
@@ -40,7 +41,7 @@
 # -----------------------------------------------------------------------------
 # Base class for all Introspection exceptions
 # -----------------------------------------------------------------------------
-class IntrospectionError (gException):
+class IntrospectionError (errors.gException):
   pass
 
 # -----------------------------------------------------------------------------
@@ -58,10 +59,16 @@
 # =============================================================================
 class Introspection (GIntrospection.Introspection):
 
-  # list of the types of Schema objects this driver provides
-  types = [('object',_('Business Object Class'),1)]
+  # -------------------------------------------------------------------------
+  # Constructor
+  # -------------------------------------------------------------------------
 
+  def __init__ (self, connection):
 
+    GIntrospection.Introspection.__init__ (self, connection)
+    self.types = [('object', _('Business Object Class'), True)]
+
+
   # -------------------------------------------------------------------------
   # Get a list of schema objects for name (and type)
   # -------------------------------------------------------------------------

Modified: trunk/gnue-common/src/datasources/drivers/file/Base.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/file/Base.py      2005-04-21 
06:50:58 UTC (rev 7449)
+++ trunk/gnue-common/src/datasources/drivers/file/Base.py      2005-04-21 
09:11:42 UTC (rev 7450)
@@ -27,7 +27,6 @@
 import os
 
 from gnue import paths
-from gnue.common.apps import i18n
 from gnue.common.datasources import GIntrospection
 from gnue.common.datasources.drivers import Base
 
@@ -38,9 +37,16 @@
 
 class Introspection (GIntrospection.Introspection):
 
-  # We must use i18n.translate instead of _ here so epydoc can parse it...
-  types = [('table', i18n.translate ('Tables'), 1)]
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
 
+  def __init__ (self, connection):
+
+    GIntrospection.__init__ (self, connection)
+    self.types = [('table', _('Tables'), 1)]
+
+
   # ---------------------------------------------------------------------------
   # Find a schema element by name and/or type
   # ---------------------------------------------------------------------------

Modified: 
trunk/gnue-common/src/datasources/drivers/interbase/Schema/Discovery/Introspection.py
===================================================================
--- 
trunk/gnue-common/src/datasources/drivers/interbase/Schema/Discovery/Introspection.py
       2005-04-21 06:50:58 UTC (rev 7449)
+++ 
trunk/gnue-common/src/datasources/drivers/interbase/Schema/Discovery/Introspection.py
       2005-04-21 09:11:42 UTC (rev 7450)
@@ -34,13 +34,20 @@
 
 class Introspection (GIntrospection.Introspection):
 
-  # list of the types of Schema objects this driver provides
-  types = [('table', _('Tables'), 1),
-           ('view' , _('Views') , 1)]
-
   _NOW = re.compile ("'(NOW\s*\(\)\s*)'", re.IGNORECASE)
 
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
 
+  def __init__ (self, connection):
+
+    GIntrospection.Introspection.__init__ (self, connection)
+    self.types = [
+        ('table', _('Tables'), 1),
+        ('view' , _('Views') , 1)]
+
+
   # ---------------------------------------------------------------------------
   # Find a schema element by name and/or type
   # ---------------------------------------------------------------------------

Modified: 
trunk/gnue-common/src/datasources/drivers/mysql/Schema/Discovery/Introspection.py
===================================================================
--- 
trunk/gnue-common/src/datasources/drivers/mysql/Schema/Discovery/Introspection.py
   2005-04-21 06:50:58 UTC (rev 7449)
+++ 
trunk/gnue-common/src/datasources/drivers/mysql/Schema/Discovery/Introspection.py
   2005-04-21 09:11:42 UTC (rev 7450)
@@ -33,14 +33,20 @@
 
 class Introspection (GIntrospection.Introspection):
 
-  # list of the types of Schema objects this driver provides
-  types = [('table', _('Tables'), 1)]
-
   _TYPES = {'number': ['int','integer','bigint','mediumint',
                        'smallint','tinyint','float','real', 
'double','decimal'],
             'date'  : ['date','time','timestamp','datetime']}
 
   # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
+
+  def __init__ (self, connection):
+
+    GIntrospection.Introspection.__init__ (self, connection)
+    self.types = [('table', _('Tables'), True)]
+
+  # ---------------------------------------------------------------------------
   # Find a schema element by name and/or type
   # ---------------------------------------------------------------------------
 

Modified: 
trunk/gnue-common/src/datasources/drivers/oracle/Schema/Discovery/Introspection.py
===================================================================
--- 
trunk/gnue-common/src/datasources/drivers/oracle/Schema/Discovery/Introspection.py
  2005-04-21 06:50:58 UTC (rev 7449)
+++ 
trunk/gnue-common/src/datasources/drivers/oracle/Schema/Discovery/Introspection.py
  2005-04-21 09:11:42 UTC (rev 7450)
@@ -37,13 +37,15 @@
 
 class Introspection(GIntrospection.Introspection):
 
-  # list of the types of Schema objects this driver provides
-  types =  [ ('user_table',   _('User Tables'),1),
-             ('user_view',    _('User Views'),1),
-             ('user_synonym', _('User Synonyms'),1),
-             ('all_table',    _('System Tables'),1),
-             ('all_view',     _('System Views'),1),
-             ('all_synonym',  _('System Synonyms'),1) ]
+  def __init__ (self, connection):
+    GIntrospection.Introspection.__init__ (self, connection)
+    self.types = [
+        ('user_table',   _('User Tables')    , True),
+        ('user_view',    _('User Views')     , True),
+        ('user_synonym', _('User Synonyms')  , True),
+        ('all_table',    _('System Tables')  , True),
+        ('all_view',     _('System Views')   , True),
+        ('all_synonym',  _('System Synonyms'), True)]
 
   #
   # TODO: This is a quick hack to get this class

Modified: 
trunk/gnue-common/src/datasources/drivers/postgresql/Schema/Discovery/Introspection.py
===================================================================
--- 
trunk/gnue-common/src/datasources/drivers/postgresql/Schema/Discovery/Introspection.py
      2005-04-21 06:50:58 UTC (rev 7449)
+++ 
trunk/gnue-common/src/datasources/drivers/postgresql/Schema/Discovery/Introspection.py
      2005-04-21 09:11:42 UTC (rev 7450)
@@ -33,12 +33,18 @@
 
 class Introspection (GIntrospection.Introspection):
 
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
 
-  # list of the types of Schema objects this driver provides
-  types = [ ('view' , _('Views') , 1),
-            ('table', _('Tables'), 1) ]
+  def __init__ (self, connection):
 
+    GIntrospection.Introspection.__init__ (self, connection)
+    self.types = [
+        ('view' , _('Views') , True),
+        ('table', _('Tables'), True)]
 
+
   # ---------------------------------------------------------------------------
   # Find a schema element by name and/or type
   # ---------------------------------------------------------------------------

Modified: 
trunk/gnue-common/src/datasources/drivers/sapdb/Schema/Creation/Creation.py
===================================================================
--- trunk/gnue-common/src/datasources/drivers/sapdb/Schema/Creation/Creation.py 
2005-04-21 06:50:58 UTC (rev 7449)
+++ trunk/gnue-common/src/datasources/drivers/sapdb/Schema/Creation/Creation.py 
2005-04-21 09:11:42 UTC (rev 7450)
@@ -21,8 +21,6 @@
 #
 # $Id$
 
-import sapdb.dbm
-
 from gnue.common.apps import errors
 from gnue.common.datasources.GLoginHandler import BasicLoginHandler
 from gnue.common.datasources.drivers.DBSIG2.Schema.Creation import \
@@ -52,6 +50,10 @@
     takes place.
     """
 
+    # Import here so epydoc can import this module even if sapdb is not
+    # installed
+    import sapdb.dbm
+
     host     = self.connection.parameters.get ('host', 'localhost')
     dbname   = self.connection.parameters.get ('dbname', None)
     username = self.connection.parameters.get ('username', 'gnue')

Modified: 
trunk/gnue-common/src/datasources/drivers/sapdb/Schema/Discovery/Introspection.py
===================================================================
--- 
trunk/gnue-common/src/datasources/drivers/sapdb/Schema/Discovery/Introspection.py
   2005-04-21 06:50:58 UTC (rev 7449)
+++ 
trunk/gnue-common/src/datasources/drivers/sapdb/Schema/Discovery/Introspection.py
   2005-04-21 09:11:42 UTC (rev 7450)
@@ -34,12 +34,20 @@
 
 class Introspection (GIntrospection.Introspection):
 
-  # list of the types of Schema objects this driver provides
-  types =[ ('table',   _('Tables'),       1),
-           ('view',    _('Views'),        1),
-           ('synonym', _('Synonyms'),     1),
-           ('result',  _('Result Table'), 1) ]
+  # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
 
+  def __init__ (self, connection):
+
+    GIntrospection.Introspection.__init__ (self, connection)
+    self.types =[
+        ('table',   _('Tables'),       True),
+        ('view',    _('Views'),        True),
+        ('synonym', _('Synonyms'),     True),
+        ('result',  _('Result Table'), True)]
+
+
   # ---------------------------------------------------------------------------
   # Find a schema element by name or type
   # ---------------------------------------------------------------------------

Modified: 
trunk/gnue-common/src/datasources/drivers/sqlite/Schema/Discovery/Introspection.py
===================================================================
--- 
trunk/gnue-common/src/datasources/drivers/sqlite/Schema/Discovery/Introspection.py
  2005-04-21 06:50:58 UTC (rev 7449)
+++ 
trunk/gnue-common/src/datasources/drivers/sqlite/Schema/Discovery/Introspection.py
  2005-04-21 09:11:42 UTC (rev 7450)
@@ -34,9 +34,6 @@
 
 class Introspection (GIntrospection.Introspection):
 
-  # list of the types of Schema objects this driver provides
-  types      = [ ('view', _('Views'), True), ('table', _('Tables'), True) ]
-
   _REPCOMMAS = re.compile ('\(\s*(\d+)\s*,\s*(\d+)\s*\)')
   _ALIGN     = re.compile ('\s*\(\s*(.*?)\s*\)')
   _LEN_SCALE = re.compile ('^\s*(\w+)\s*\((\d+)[;]{0,1}(\d*)\)\s*')
@@ -50,6 +47,18 @@
                        '\((.*?)\).*', re.IGNORECASE)
 
   # ---------------------------------------------------------------------------
+  # Constructor
+  # ---------------------------------------------------------------------------
+
+  def __init__ (self, connection):
+
+    GIntrospection.Introspection.__init__ (self, connection)
+    self.types = [
+        ('view' , _('Views') , True),
+        ('table', _('Tables'), True)]
+
+
+  # ---------------------------------------------------------------------------
   # Get a schema object matching name and type
   # ---------------------------------------------------------------------------
 

Modified: trunk/gnue-common/src/schema/scripter/Scripter.py
===================================================================
--- trunk/gnue-common/src/schema/scripter/Scripter.py   2005-04-21 06:50:58 UTC 
(rev 7449)
+++ trunk/gnue-common/src/schema/scripter/Scripter.py   2005-04-21 09:11:42 UTC 
(rev 7450)
@@ -58,20 +58,18 @@
 
 class Scripter (GClientApp):
 
-  from gnue.common import VERSION
-
-  COMMAND = "gnue-schema"
-  NAME    = "GNUe Schema Scripter"
-  USAGE   = "[options] gsd-file [gsd-file gsd-file ...]"
-  SUMMARY = _("GNUe Schema Scripter creates database schemas based on GNUe "
-              "Schema Definitions.")
-
-
   # ---------------------------------------------------------------------------
   # Constructor
   # ---------------------------------------------------------------------------
 
   def __init__ (self, connections = None):
+
+    self.COMMAND = "gnue-schema"
+    self.NAME    = "GNUe Schema Scripter"
+    self.USAGE   = "[options] gsd-file [gsd-file gsd-file ...]"
+    self.SUMMARY = _("GNUe Schema Scripter creates database schemas based on "
+                     "GNUe Schema Definitions.")
+
     self.addCommandOption ('connection', 'c', argument='connectionname',
         default = "gnue",
         help = _("Use the connection <connectionname> for creating the 
schema"))
@@ -112,7 +110,6 @@
     GClientApp.__init__ (self, connections, 'schema', ConfigOptions)
 
 
-
   # ---------------------------------------------------------------------------
   # Main program
   # ---------------------------------------------------------------------------





reply via email to

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