[Checkins] SVN: grokui.admin/trunk/ We are now using the Grok `create_application` util function in order to create an application.

Souheil CHELFOUH souheil at chelfouh.com
Sun Jul 4 08:20:30 EDT 2010


Log message for revision 114176:
  We are now using the Grok `create_application` util function in order to create an application.
  It triggers all the needed events.
  

Changed:
  U   grokui.admin/trunk/CHANGES.txt
  U   grokui.admin/trunk/src/grokui/admin/views.py

-=-
Modified: grokui.admin/trunk/CHANGES.txt
===================================================================
--- grokui.admin/trunk/CHANGES.txt	2010-07-04 12:18:52 UTC (rev 114175)
+++ grokui.admin/trunk/CHANGES.txt	2010-07-04 12:20:30 UTC (rev 114176)
@@ -4,11 +4,12 @@
 0.7.0 (unreleased)
 ==================
 
-* The ApplicationInitializedEvent newly introduced in Grok is now
-  triggered while an application is created and persisted. This is an
-  important event, allowing to hook handlers that need local utilities
-  and catalog indexes that are not yet present at the
-  ObjectCreatedEvent stage.
+* The application creation view now uses the Grok util function
+  `create_application`. Therefore, the `ApplicationInitializedEvent`,
+  recently introduced in Grok, is now triggered while an application is
+  created and persisted. This is an important event, allowing to hook
+  handlers that need local utilities and catalog indexes that are not
+  yet present at the ObjectCreatedEvent stage.
 
 * ...
 

Modified: grokui.admin/trunk/src/grokui/admin/views.py
===================================================================
--- grokui.admin/trunk/src/grokui/admin/views.py	2010-07-04 12:18:52 UTC (rev 114175)
+++ grokui.admin/trunk/src/grokui/admin/views.py	2010-07-04 12:20:30 UTC (rev 114176)
@@ -3,6 +3,7 @@
 
 import grok
 from BTrees.OOBTree import OOBTree
+from grok.util import create_application
 from grokui.base import IGrokUIRealm
 from grokui.admin.interfaces import ISecurityNotifier
 from grokui.admin.utilities import getVersion, getURLWithParams
@@ -71,10 +72,7 @@
             return
         app = getUtility(grok.interfaces.IApplication, name=application)
         try:
-            new_app = app()
-            grok.notify(grok.ObjectCreatedEvent(new_app))
-            self.context.root[name] = new_app
-            grok.notify(grok.ApplicationInitializedEvent(new_app))
+            new_app = create_application(app, self.context.root, name)
             self.flash(u'Added %s `%s`.' % (application, name))
         except (DuplicationError, KeyError):
             self.flash(u'Name `%s` already in use. '



More information about the checkins mailing list