本文整理汇总了Python中managers.model_managers.WorkspaceManager.openDefaultWorkspace方法的典型用法代码示例。如果您正苦于以下问题:Python WorkspaceManager.openDefaultWorkspace方法的具体用法?Python WorkspaceManager.openDefaultWorkspace怎么用?Python WorkspaceManager.openDefaultWorkspace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类managers.model_managers.WorkspaceManager
的用法示例。
在下文中一共展示了WorkspaceManager.openDefaultWorkspace方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: MainApplication
# 需要导入模块: from managers.model_managers import WorkspaceManager [as 别名]
# 或者: from managers.model_managers.WorkspaceManager import openDefaultWorkspace [as 别名]
class MainApplication(object):
"""
"""
def __init__(self, args):
self._original_excepthook = sys.excepthook
self._configuration = CONF
self._security_manager = SecurityManager()
self._mappers_manager = MapperManager()
self._changes_controller = ChangeController()
self._db_manager = DbManager()
self._model_controller = ModelController(self._security_manager, self._mappers_manager)
self._plugin_manager = PluginManager(os.path.join(CONF.getConfigPath(), "plugins"), self._mappers_manager)
self._reports_manager = ReportManager(10, self._plugin_manager.createController("ReportManager"))
self._workspace_manager = WorkspaceManager(
self._db_manager, self._mappers_manager, self._changes_controller, self._reports_manager
)
self.gui_app = UiFactory.create(self._model_controller, self._plugin_manager, self._workspace_manager, args.gui)
self.gui_app.setSplashImage(os.path.join(CONF.getImagePath(), "splash2.png"))
self.timer = TimerClass()
self.timer.start()
def enableExceptHook(self):
sys.excepthook = exception_handler
installThreadExcepthook()
def disableLogin(self):
CONF.setAuth(sys.disablelogin)
def start(self):
try:
self.gui_app.startSplashScreen()
self.gui_app.splashMessage("Starting Faraday")
signal.signal(signal.SIGINT, self.ctrlC)
logged = True
while True:
username, password = "usuario", "password"
if username is None and password is None:
break
result = self._security_manager.authenticateUser(username, password)
if result == codes.successfulLogin:
logged = True
break
if logged:
model.api.devlog("Starting application...")
model.api.devlog("Setting up remote API's...")
# We need to create the last used workspace (or the default
# workspace) before we start the model controller and the
# report manager
last_workspace = CONF.getLastWorkspace()
try:
if not self._workspace_manager.workspaceExists(last_workspace):
getLogger(self).info(
"Your last workspace ("
+ str(last_workspace)
+ ") wasn't accessible, check configuration..."
)
self._workspace_manager.openDefaultWorkspace()
# self._workspace_manager.createWorkspace(last_workspace, 'default workspace, probably created already in couchb')
else:
self._workspace_manager.openWorkspace(last_workspace)
except restkit.errors.Unauthorized:
print "You are trying to enter CouchDB with authentication"
print "Add your credentials to your user configuration file in $HOME/.faraday/config/user.xml"
print "For example: <couch_uri>http://john:[email protected]:5984</couch_uri>"
return
model.api.setUpAPIs(
self._model_controller, self._workspace_manager, CONF.getApiConInfoHost(), CONF.getApiConInfoPort()
)
model.guiapi.setUpGUIAPIs(self._model_controller)
model.api.devlog("Starting model controller daemon...")
self._model_controller.start()
model.api.startAPIServer()
restapi.startAPIs(
self._plugin_manager,
self._model_controller,
self._mappers_manager,
CONF.getApiConInfoHost(),
CONF.getApiRestfulConInfoPort(),
)
#.........这里部分代码省略.........