commit-gnue
[Top][All Lists]
Advanced

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

r6428 - trunk/gnue-appserver/src/classrep


From: johannes
Subject: r6428 - trunk/gnue-appserver/src/classrep
Date: Thu, 30 Sep 2004 09:32:05 -0500 (CDT)

Author: johannes
Date: 2004-09-30 09:32:04 -0500 (Thu, 30 Sep 2004)
New Revision: 6428

Modified:
   trunk/gnue-appserver/src/classrep/Base.py
Log:
Added option for loading global dictionaries without replacing keys


Modified: trunk/gnue-appserver/src/classrep/Base.py
===================================================================
--- trunk/gnue-appserver/src/classrep/Base.py   2004-09-30 07:26:38 UTC (rev 
6427)
+++ trunk/gnue-appserver/src/classrep/Base.py   2004-09-30 14:32:04 UTC (rev 
6428)
@@ -73,7 +73,7 @@
   # Reload the dictionary from the database by merging new records in
   # ---------------------------------------------------------------------------
 
-  def reload (self):
+  def reload (self, idAsKey = False):
     """
     This function fetches a list of all available items of the dictionaries
     table and merges them into the objectlist.
@@ -81,14 +81,14 @@
     rlist = self._session.find (self.table, self._getReloadCondition (),
                                             self._getSortorder (),
                                             self._getColumns ())
-    self.mergeIntoList (rlist)
+    self.mergeIntoList (rlist, idAsKey)
 
 
   # ---------------------------------------------------------------------------
   # Merge a given object list with the dictionaries list
   # ---------------------------------------------------------------------------
 
-  def mergeIntoList (self, addList):
+  def mergeIntoList (self, addList, idAsKey = False):
     """
     Merge all language interface objects from @addList into the dictionaries
     objectlist. If an object is new in the list, use _getNewItem () to build a
@@ -104,9 +104,14 @@
 
       if not found:
         newItem = self._getNewItem (obj)
-        self._items [newItem.fullName.lower ()] = newItem
 
+        # idAsKey is set to TRUE if we'd like to create a global dictionary,
+        # which means holding properties of all classes for example. This is
+        # neccessary for booting the initial class repository.
+        key = idAsKey and newItem.gnue_id or newItem.fullName
+        self [key] = newItem
 
+
   # ---------------------------------------------------------------------------
   # Return the conditions to be used on reload ()
   # ---------------------------------------------------------------------------





reply via email to

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