[Mpuls-commits] r286 - in wasko/trunk: . waskaweb/lib waskaweb/model waskaweb/model/io

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Mon Feb 23 16:26:32 CET 2009


Author: teichmann
Date: 2009-02-23 16:26:28 +0100 (Mon, 23 Feb 2009)
New Revision: 286

Modified:
   wasko/trunk/ChangeLog.txt
   wasko/trunk/waskaweb/lib/app_globals.py
   wasko/trunk/waskaweb/model/casedocument.py
   wasko/trunk/waskaweb/model/io/document.py
   wasko/trunk/waskaweb/model/io/factories.py
Log:
Make warning mechanism wor on pages.



Modified: wasko/trunk/ChangeLog.txt
===================================================================
--- wasko/trunk/ChangeLog.txt	2009-02-23 13:56:23 UTC (rev 285)
+++ wasko/trunk/ChangeLog.txt	2009-02-23 15:26:28 UTC (rev 286)
@@ -1,3 +1,15 @@
+2009-02-23	Sascha L. Teichmann <teichmann at intevation.de>
+
+	Make warning mechanism wor on pages.
+
+	* waskaweb/model/casedocument.py: Fixed problem with accessing pages.
+
+	* waskaweb/model/io/document.py: allow loading douments with user defined documents.
+
+	* waskaweb/model/io/factories.py: remove hard wired loading of case documents.
+
+	* waskaweb/lib/app_globals.py: Special factory for case documents.
+
 2009-02-23	Torsten Irlaender  <torsten.irlaender at intevation.de> 
 	Fixed issue36 (WASKO-Online)
 

Modified: wasko/trunk/waskaweb/lib/app_globals.py
===================================================================
--- wasko/trunk/waskaweb/lib/app_globals.py	2009-02-23 13:56:23 UTC (rev 285)
+++ wasko/trunk/waskaweb/lib/app_globals.py	2009-02-23 15:26:28 UTC (rev 286)
@@ -34,6 +34,17 @@
 
 import os, sys, traceback
 
+from waskaweb.model.io.factories   import NodeFactory, SimpleCreator
+from waskaweb.model.casedocument   import CaseDocument
+from waskaweb.model.nodecomponents import RootNode
+
+class CaseDocumentFactory(NodeFactory):
+
+    def reduce(self, ctx):
+        root = NodeFactory.reduce(self, ctx)
+        return CaseDocument(root)
+
+
 class Globals(object):
     """Globals acts as a container for objects available throughout the
     life of the application
@@ -52,7 +63,9 @@
         # XXX: Check why the following throws key exceptions. Is config var not
         # availiable in Globals?!?
         #treeFile = os.path.join(os.path.dirname(__file__), config['formed_tree'])
-        self.formedTree = openDocument(treeFile)
+        self.formedTree = openDocument(
+            treeFile,
+            SimpleCreator(CaseDocumentFactory, RootNode))
         try:
             self.helpData = AnnotationsProvider(annonFile) 
         except:

Modified: wasko/trunk/waskaweb/model/casedocument.py
===================================================================
--- wasko/trunk/waskaweb/model/casedocument.py	2009-02-23 13:56:23 UTC (rev 285)
+++ wasko/trunk/waskaweb/model/casedocument.py	2009-02-23 15:26:28 UTC (rev 286)
@@ -76,7 +76,7 @@
         widgets2pages = {}
         for widget in collector.widgets:
             page = widget
-            while page and not isinstance(page, PageStore):
+            while page and not isinstance(page, PageNode):
                 page = page.parent
             if page:
                 widgets2pages[widget.getName()] = page.getName()

Modified: wasko/trunk/waskaweb/model/io/document.py
===================================================================
--- wasko/trunk/waskaweb/model/io/document.py	2009-02-23 13:56:23 UTC (rev 285)
+++ wasko/trunk/waskaweb/model/io/document.py	2009-02-23 15:26:28 UTC (rev 286)
@@ -109,10 +109,17 @@
     RuleLeaf:               RULE_TAG,
     BoolLeaf:               BOOL_TAG }
 
-def openDocument(path):
+def openDocument(path, documentFactoryCreator = None):
     builder = SAXBuilder()
 
-    builder.setCreators(factoryCreators)
+    if documentFactoryCreator:
+        factories = factoryCreators.copy()
+        factories[DOCUMENT_TAG] = documentFactoryCreator
+    else:
+        factories = factoryCreators
+
+    builder.setCreators(factories)
+
     f = None
     try:
         f = file(path, "rb")

Modified: wasko/trunk/waskaweb/model/io/factories.py
===================================================================
--- wasko/trunk/waskaweb/model/io/factories.py	2009-02-23 13:56:23 UTC (rev 285)
+++ wasko/trunk/waskaweb/model/io/factories.py	2009-02-23 15:26:28 UTC (rev 286)
@@ -30,7 +30,7 @@
 
 from parser import Factory, Creator
 
-from waskaweb.model.casedocument import CaseDocument
+from waskaweb.model.nodecomponents import Document
 
 class SimpleCreator(Creator):
 
@@ -61,6 +61,6 @@
 
     def reduce(self, ctx):
         root = NodeFactory.reduce(self, ctx)
-        return CaseDocument(root)
+        return Document(root)
 
 # vim:set ts=4 sw=4 si et sta sts=4:



More information about the Mpuls-commits mailing list