[Dev] Initializing Globals outside of Application.py
Morgen Sagen
morgen at osafoundation.org
Tue Jun 22 11:15:47 PDT 2004
Code running outside of Chandler, such as unit tests, now has to
include the following few lines:
# to make parcels/osaf/contentmodel/Query.py happy
Globals.repository = rep
# to make parcels/osaf/framework/notifications/schema/Event.py happy
from osaf.framework.notifications.NotificationManager import
NotificationManager
Globals.notificationManager = NotificationManager()
Over time I can see the code required to properly set up of Globals
getting bigger and bigger, and this code needs to be replicated outside
of Application.py and kept in sync (for example, in
chandler/repository/tests/RepositoryTestCase.py).
We could try to write our code to gracefully handle the condition where
Globals.repository and Globals.notificationManager, etc. aren't there.
However it's probably better to make it easier for code outside of
Application.py to set up Globals correctly (perhaps with some method in
Application.py the unit tests could call to do this). Shall I break
out these required lines into a method living somewhere outside of
Application.py (and modify Application.py to use this method too)?
~morgen
More information about the Dev
mailing list