commit-gnue
[Top][All Lists]
Advanced

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

[gnue] r8031 - trunk/gnue-designer/src/base


From: jamest
Subject: [gnue] r8031 - trunk/gnue-designer/src/base
Date: Thu, 29 Sep 2005 07:18:28 -0500 (CDT)

Author: jamest
Date: 2005-09-29 07:18:28 -0500 (Thu, 29 Sep 2005)
New Revision: 8031

Modified:
   trunk/gnue-designer/src/base/TemplateBase.py
Log:
fix table list cache


Modified: trunk/gnue-designer/src/base/TemplateBase.py
===================================================================
--- trunk/gnue-designer/src/base/TemplateBase.py        2005-09-29 10:56:22 UTC 
(rev 8030)
+++ trunk/gnue-designer/src/base/TemplateBase.py        2005-09-29 12:18:28 UTC 
(rev 8031)
@@ -22,29 +22,33 @@
 # TemplateBase.py
 #
 # DESCRIPTION:
-# Provides a base class for templates
 #
 # NOTES:
 #
-# Guidelines for writing templates:
-#   Never, ever, EVER overwrite the __init__ method.
-#   However, you can overwrite the Start method which
-#   is called when your template should do its trick.
-#   Anything normally occurring in an __init__ can
-#   occur at the beginning of Start.
-#
-#   You can be guaranteed to have an empty <form|report>
-#   object passed to the Start method.  If you successfully
-#   created your object, you should return a TRUE value in
-#   GetFinal.  Otherwise, return false.  If a TRUE value is
-#   returned, Designer assumes that the passed <Form|Report>
-#   object now contains a valid object.
-#
-# NOTE: It is VERY important that in any reference to a
-#   "<insert type here> wizard", the word "wizard" must be
-#   in lower case, as many "Xyz Wizards" (proper name) have
-#   been trademarked. (No, I'm not kidding :)
+"""
+Provides a base class for templates
 
+Guidelines for writing templates:
+  Never, ever, EVER overwrite the __init__ method.
+  However, you can overwrite the Start method which
+  is called when your template should do its trick.
+  Anything normally occurring in an __init__ can
+  occur at the beginning of Start.
+
+  You can be guaranteed to have an empty <form|report>
+  object passed to the Start method.  If you successfully
+  created your object, you should return a TRUE value in
+  GetFinal.  Otherwise, return false.  If a TRUE value is
+  returned, Designer assumes that the passed <Form|Report>
+  object now contains a valid object.
+
+NOTE: It is VERY important that in any reference to a
+  "<insert type here> wizard", the word "wizard" must be
+  in lower case, as many "Xyz Wizards" (proper name) have
+  been trademarked. (No, I'm not kidding :)
+"""
+__revision__ = "$Id$"
+
 from gnue.common.formatting import GTypecast
 from gnue.common.definitions.GParserHelpers import GContent
 
@@ -54,18 +58,18 @@
 # the TemplateInformation hash's "Behavior" attribute:
 #
 
-TEMPLATE=0      # This is a template that does not prompt
-                # for user input.  Designer only calls
-                # the Start() and GetFinal() methods.
+TEMPLATE = 0      # This is a template that does not prompt
+                  # for user input.  Designer only calls
+                  # the Start() and GetFinal() methods.
 
-WIZARD=1        # This is a template that prompts the
-                # user for input in a wizard fashion.
-                # Designer calls Start(), then calls
-                # GetStep() to get a step. After a user
-                # clicks next, Designer calls ValidateStep()
-                # and if this returns true, calls GetStep()
-                # if there are more steps to complete,
-                # or, if no more steps, calls GetFinal().
+WIZARD = 1        # This is a template that prompts the
+                  # user for input in a wizard fashion.
+                  # Designer calls Start(), then calls
+                  # GetStep() to get a step. After a user
+                  # clicks next, Designer calls ValidateStep()
+                  # and if this returns true, calls GetStep()
+                  # if there are more steps to complete,
+                  # or, if no more steps, calls GetFinal().
 
 
 #
@@ -131,7 +135,7 @@
         element._children.pop(i)
       else:
         i += 1
-    content = GContent(element,content)
+    content = GContent(element, content)
 
 
   def ModifyElement(self, element, **modifications):
@@ -162,12 +166,14 @@
 
   def GetTemporaryConnection(self, connection_name):
     
-    return self._connections.getConnection(connection_name,1)
+    return self._connections.getConnection(connection_name, 1)
 
 
   def GetAvailableSources (self, connection_name):
 
-    if not self.__cachedSources.has_key (connection_name):
+    try:
+      tables = self.__cachedSources[connection_name]
+    except KeyError:      
       self.__cachedSources [connection_name] = tables = \
         self.GetTemporaryConnection (connection_name).readSchema ()
 
@@ -220,8 +226,8 @@
     self.parser = parser
     self.instance = parser.instance
     self._connections = parser.instance._app.connections
-    self.__cachedConnections= {}
-    self.__cachedSources= {}
+    self.__cachedConnections = {}
+    self.__cachedSources = {}
 
 
 





reply via email to

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