def startup(**kwds): global view Globals.chandlerDirectory = Utility.locateChandlerDirectory() if not Globals.chandlerDirectory: print "Please set CHANDLERHOME" return None os.chdir(Globals.chandlerDirectory) Utility.initLocale('en') Globals.options = Utility.initOptions(Globals.chandlerDirectory, **kwds) profileDir = Globals.options.profileDir Utility.initLogging(Globals.options) parcelPath = Utility.initParcelEnv(Globals.chandlerDirectory, Globals.options.parcelPath) view = Utility.initRepository( Utility.locateRepositoryDirectory(profileDir), Globals.options) if not Utility.verifySchema(view): print "Schema mismatch. Try again with startup(create=True)" return None Utility.initCrypto(Globals.options.profileDir) Utility.initParcels(view, parcelPath) if Globals.options.createData: import GenerateItemsFromFile GenerateItemsFromFile.RunScript(view) return view
def setUp(self): # This setup is needed because we'd like to be able to use # --locale on the command line to test a given locale. So, # basically the code below is copy-and-pasted out of Utility.py # to make sure that everything gets initialized in the right # order. needInit = self.view is None # We always store a list of all failures, so that we can report them # all rather than fail on the first. self.failures = [] if needInit: Utility.initLogging(Globals.options) type(self).view = NullRepositoryView() parcelPath = Utility.initParcelEnv(Globals.options, Globals.chandlerDirectory) pluginEnv, pluginEggs = Utility.initPluginEnv(Globals.options, Globals.options.pluginPath) Utility.initI18n(Globals.options) Utility.initParcels(Globals.options, self.view, parcelPath) Utility.initPlugins(Globals.options, self.view, pluginEnv, pluginEggs) # We don't want to import these globally, because they will # trigger parcel loading, and that will cause i18n to be set # up before the above call to initI18n, which will mean --locale # won't work on the command line. So, instead, we stash these # in instance variables. self.Menu = schema.importString("osaf.framework.blocks.Menu") self.MenuItem = schema.importString("osaf.framework.blocks.MenuItem")
def setUp(self): # This setup is needed because we'd like to be able to use # --locale on the command line to test a given locale. So, # basically the code below is copy-and-pasted out of Utility.py # to make sure that everything gets initialized in the right # order. needInit = (self.view is None) # We always store a list of all failures, so that we can report them # all rather than fail on the first. self.failures = [] if needInit: Utility.initLogging(Globals.options) type(self).view = NullRepositoryView() parcelPath = Utility.initParcelEnv(Globals.options, Globals.chandlerDirectory) pluginEnv, pluginEggs = Utility.initPluginEnv( Globals.options, Globals.options.pluginPath) Utility.initI18n(Globals.options) Utility.initParcels(Globals.options, self.view, parcelPath) Utility.initPlugins(Globals.options, self.view, pluginEnv, pluginEggs) # We don't want to import these globally, because they will # trigger parcel loading, and that will cause i18n to be set # up before the above call to initI18n, which will mean --locale # won't work on the command line. So, instead, we stash these # in instance variables. self.Menu = schema.importString('osaf.framework.blocks.Menu') self.MenuItem = schema.importString('osaf.framework.blocks.MenuItem')
def startup(**kwds): global view Globals.chandlerDirectory = Utility.locateChandlerDirectory() if not Globals.chandlerDirectory: print "Please set CHANDLERHOME" return None os.chdir(Globals.chandlerDirectory) Utility.initLocale('en') Globals.options = Utility.initOptions(Globals.chandlerDirectory, **kwds) profileDir = Globals.options.profileDir Utility.initLogging(Globals.options) parcelPath = Utility.initParcelEnv(Globals.chandlerDirectory, Globals.options.parcelPath) view = Utility.initRepository(Utility.locateRepositoryDirectory(profileDir), Globals.options) if not Utility.verifySchema(view): print "Schema mismatch. Try again with startup(create=True)" return None Utility.initCrypto(Globals.options.profileDir) Utility.initParcels(view, parcelPath) if Globals.options.createData: import GenerateItemsFromFile GenerateItemsFromFile.RunScript(view) return view
def startup(chandlerDirectory=None, **kwds): global view, commitOnExit Globals.options = Utility.initOptions(**kwds) if chandlerDirectory is None: Globals.chandlerDirectory = Utility.locateChandlerDirectory() else: Globals.chandlerDirectory = chandlerDirectory os.chdir(Globals.chandlerDirectory) Utility.initI18n(Globals.options) profileDir = Globals.options.profileDir Utility.initLogging(Globals.options) parcelPath = Utility.initParcelEnv(Globals.options, Globals.chandlerDirectory) pluginEnv, pluginEggs = Utility.initPluginEnv(Globals.options, Globals.options.pluginPath) Globals.options.getPassword = getPassword repoDir = Utility.locateRepositoryDirectory(profileDir, Globals.options) view = Utility.initRepository(repoDir, Globals.options) verify, repoVersion, schemaVersion = Utility.verifySchema(view) if not verify: print "Schema mismatch (%s vs %s). Try again with startup(create=True)" % ( repoVersion, schemaVersion) return None Utility.initCrypto(Globals.options.profileDir) Utility.initParcels(Globals.options, view, parcelPath) Utility.initPlugins(Globals.options, view, pluginEnv, pluginEggs) Utility.initTimezone(Globals.options, view) if Globals.options.reload: from osaf import dumpreload dumpreload.reload(view, Globals.options.reload) return view
def startup(chandlerDirectory=None, **kwds): global view, commitOnExit Globals.options = Utility.initOptions(**kwds) if chandlerDirectory is None: Globals.chandlerDirectory = Utility.locateChandlerDirectory() else: Globals.chandlerDirectory = chandlerDirectory os.chdir(Globals.chandlerDirectory) Utility.initI18n(Globals.options) profileDir = Globals.options.profileDir Utility.initLogging(Globals.options) parcelPath = Utility.initParcelEnv(Globals.options, Globals.chandlerDirectory) pluginEnv, pluginEggs = Utility.initPluginEnv(Globals.options, Globals.options.pluginPath) Globals.options.getPassword = getPassword repoDir = Utility.locateRepositoryDirectory(profileDir, Globals.options) view = Utility.initRepository(repoDir, Globals.options) verify, repoVersion, schemaVersion = Utility.verifySchema(view) if not verify: print "Schema mismatch (%s vs %s). Try again with startup(create=True)" %(repoVersion, schemaVersion) return None Utility.initCrypto(Globals.options.profileDir) Utility.initParcels(Globals.options, view, parcelPath) Utility.initPlugins(Globals.options, view, pluginEnv, pluginEggs) Utility.initTimezone(Globals.options, view) if Globals.options.reload: from osaf import dumpreload dumpreload.reload(view, Globals.options.reload) return view
print Globals.chandlerDirectory print profileDir Utility.initLogging(Globals.options) parcelPath = Utility.initParcelEnv(Globals.options, Globals.chandlerDirectory) pluginEnv, pluginEggs = Utility.initPluginEnv(Globals.options, Globals.options.pluginPath) view = Utility.initRepository(profileDir, Globals.options) verify, repoVersion, schemaVersion = Utility.verifySchema(view) Utility.initCrypto(Globals.options.profileDir) Utility.initParcels(Globals.options, view, parcelPath) Utility.initPlugins(Globals.options, view, pluginEnv, pluginEggs) Utility.initTimezone(Globals.options, view) outputDir = os.path.join(Globals.chandlerDirectory, 'docs') if os.path.isfile('Chandler.py'): if not os.path.isdir(outputDir): _mkdirs(outputDir) generateModelDocs(Globals.chandlerDirectory, view, outputDir) generateDocs(outputDir) else: print "Error: Currently gen_docs.py assumes it is running in the chandler/ directory" Utility.stopWakeup()