diff MoinMoin/app.py @ 854:c9a78e5a58c4 storage-ng

fix script startup deadlock, add script params to create storage and index, fix fs store To build an index, use this: moin index-build -s -i moin index-build --storage-create --index-create Usually moin would expect an existing index and storage when starting up and fail if it is not there. This is a problem for moin index-* commands, which are used to build an index. By giving -s, you force it to create the storage where specified by the config. By giving -i, you force it to create the index where specified by the config. fs storage used os.mkdir. use os.makedirs to support multiple levels of dirs getting create. catch exception if the dir is already there.
author Thomas Waldmann <tw AT waldmann-edv DOT de>
date Sat, 24 Sep 2011 02:54:21 +0200
parents 5ad4ae0b1e09
children e1a68b3721cc
line wrap: on
line diff
--- a/MoinMoin/app.py	Sat Sep 24 01:52:32 2011 +0200
+++ b/MoinMoin/app.py	Sat Sep 24 02:54:21 2011 +0200
@@ -40,11 +40,13 @@
 from MoinMoin.util.clock import Clock
 
 
-def create_app(config=None):
+def create_app(config=None, create_index=False, create_storage=False):
     """
     simple wrapper around create_app_ext() for flask-script
     """
-    return create_app_ext(flask_config_file=config)
+    return create_app_ext(flask_config_file=config,
+                          create_index=create_index,
+                          create_storage=create_storage)
 
 
 def create_app_ext(flask_config_file=None, flask_config_dict=None,
@@ -170,15 +172,16 @@
         app.router.create()
     app.router.open()
     app.storage = indexing.IndexingMiddleware(app.cfg.index_dir, app.router, wiki_name=app.cfg.interwikiname) # XXX give user name etc.
-    if app.cfg.create_storage:
+    if app.cfg.create_index:
         app.storage.create()
     app.storage.open()
 
 def deinit_backends(app):
     app.storage.close()
     app.router.close()
+    if app.cfg.destroy_index:
+        app.storage.destroy()
     if app.cfg.destroy_storage:
-        app.storage.destroy()
         app.router.destroy()