commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r7320 - trunk/gnue-common/src/datasources


From: reinhard
Subject: [gnue] r7320 - trunk/gnue-common/src/datasources
Date: Fri, 8 Apr 2005 02:23:07 -0500 (CDT)

Author: reinhard
Date: 2005-04-08 02:23:06 -0500 (Fri, 08 Apr 2005)
New Revision: 7320

Modified:
   trunk/gnue-common/src/datasources/GDataSource.py
Log:
Added some comments and reordered definitions.


Modified: trunk/gnue-common/src/datasources/GDataSource.py
===================================================================
--- trunk/gnue-common/src/datasources/GDataSource.py    2005-04-08 07:21:13 UTC 
(rev 7319)
+++ trunk/gnue-common/src/datasources/GDataSource.py    2005-04-08 07:23:06 UTC 
(rev 7320)
@@ -1,6 +1,9 @@
+# GNU Enterprise Common Library - Datasources - Datasource Objects
 #
-# This file is part of GNU Enterprise.
+# Copyright 2001-2005 Free Software Foundation
 #
+# 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
@@ -16,29 +19,24 @@
 # write to the Free Software Foundation, Inc., 59 Temple Place
 # - Suite 330, Boston, MA 02111-1307, USA.
 #
-# Copyright 2000-2005 Free Software Foundation
-#
 # $Id$
-
 """
-Class that implements a provider-independent DataSource object
+Classes for the datasource object tree.
 """
 
-from gnue.common.apps import i18n, errors
-from gnue.common.definitions import GObjects
-import sys, string, types, cStringIO
-from gnue.common.datasources import GConnections
+import cStringIO
+import string
+import types
+
+from gnue.common.apps import errors
+from gnue.common.definitions import GObjects, GParser, GParserHelpers
 from gnue.common.formatting import GTypecast
-from gnue.common.datasources import GConditions, Exceptions
-from gnue.common.definitions.GParserHelpers import GContent
-from gnue.common.definitions.GParser import MarkupError
+from gnue.common.datasources import Exceptions, GConditions, GConnections
 
 
-########################################################################
-#
-#
-#
-########################################################################
+# =============================================================================
+# <datasource>
+# =============================================================================
 
 class GDataSource(GObjects.GObj):
   """
@@ -454,7 +452,7 @@
     # If there is both, an order_by attribute *and* a sorting-tag, we've stop
     child = self.findChildOfType ('GCSortOrder')
     if child is not None and hasattr (self, 'order_by'):
-      raise MarkupError, \
+      raise GParser.MarkupError, \
           (u_("The use of order_by is depreciated. Please use <sortorder> "
               "instead"), self._url, self._lineNumber)
 
@@ -519,7 +517,7 @@
           if len (item) > 2: element ['ignorecase'] = item [2]
 
     else:
-      raise MarkupError, \
+      raise GParser.MarkupError, \
           (u_("Unknown type/format of 'order-by' attribute"), self._url,
             self._lineNumber)
 
@@ -580,38 +578,72 @@
     self._triggerProperties = None
 
 
-######
-#
-#
-#
-######
+# =============================================================================
+# <sortorder>
+# =============================================================================
+
+class GCSortOrder (GObjects.GObj):
+  def __init__ (self, parent = None):
+    GObjects.GObj.__init__ (self, parent, 'GCSortOrder')
+    self.sorting = []
+    self._inits = [self._build]
+
+  def _build (self):
+    for item in self.findChildrenOfType ('GCSortField'):
+      self.sorting.append ({'name': item.name,
+                            'descending': item.descending,
+                            'ignorecase': item.ignorecase})
+
+
+# =============================================================================
+# <sortfield>
+# =============================================================================
+
+class GCSortField (GObjects.GObj):
+  def __init__ (self, parent = None):
+    GObjects.GObj.__init__ (self, parent, 'GCSortField')
+
+
+# =============================================================================
+# <sql>
+# =============================================================================
+
 class GSql(GObjects.GObj):
   def __init__(self, parent=None):
      GObjects.GObj.__init__(self, parent, type="GDSql")
 
-######
-#
-# Static Datasource Support
-#
-######
+
+# =============================================================================
+# <staticset>
+# =============================================================================
+
 class GStaticSet(GObjects.GObj):
   def __init__(self, parent=None):
      GObjects.GObj.__init__(self, parent, type="GDStaticSet")
 
+
+# =============================================================================
+# <staticsetrow>
+# =============================================================================
+
 class GStaticSetRow(GObjects.GObj):
   def __init__(self, parent=None):
      GObjects.GObj.__init__(self, parent, type="GDStaticSetRow")
 
+
+# =============================================================================
+# <staticsetfield>
+# =============================================================================
+
 class GStaticSetField(GObjects.GObj):
   def __init__(self, parent=None):
      GObjects.GObj.__init__(self, parent, type="GDStaticSetField")
 
 
-######
-#
-#
-#
-######
+# =============================================================================
+# <connection>
+# =============================================================================
+
 class GConnection(GObjects.GObj):
   def __init__(self, parent=None):
     GObjects.GObj.__init__(self, parent, "GCConnection")
@@ -635,20 +667,10 @@
            'host': self.host } )
 
 
+# =============================================================================
+# List of XML Elements
+# =============================================================================
 
-######
-#
-# Used by client GParsers to automatically pull supported xml tags
-#
-######
-
-#
-# Return any XML elements associated with
-# GDataSources.  Bases is a dictionary of tags
-# whose values are update dictionaries.
-# For example: bases={'datasource': {'BaseClass':myDataSource}}
-# sets xmlElements['datasource']['BaseClass'] = myDataSource
-#
 def getXMLelements(updates={}):
 
   xmlElements = {
@@ -858,37 +880,15 @@
 
 
 # =============================================================================
-# Classes for implementing sort options
+# Wrapper for standalone DataSources (i.e., not in context of a GObj tree)
 # =============================================================================
 
-class GCSortOrder (GObjects.GObj):
-  def __init__ (self, parent = None):
-    GObjects.GObj.__init__ (self, parent, 'GCSortOrder')
-    self.sorting = []
-    self._inits = [self._build]
-
-  def _build (self):
-    for item in self.findChildrenOfType ('GCSortField'):
-      self.sorting.append ({'name': item.name,
-                            'descending': item.descending,
-                            'ignorecase': item.ignorecase})
-
-
-class GCSortField (GObjects.GObj):
-  def __init__ (self, parent = None):
-    GObjects.GObj.__init__ (self, parent, 'GCSortField')
-
-
-#
-# Wrapper for standalone DataSources
-# (i.e., not in context of a GObj tree)
-#
 def DataSourceWrapper(connections=None, fields=(), attributes={}, init=True, 
unicodeMode=False, sql=""):
   source = _DataSourceWrapper()
 
   if sql:
     s = GSql(source)
-    GContent(s,sql)
+    GParserHelpers.GContent(s,sql)
     attributes['type'] = 'sql'
 
 





reply via email to

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