[Erp5-report] r33911 luke - /erp5/trunk/utils/erp5.recipe.standaloneinstance/src/erp5/recip...

nobody at svn.erp5.org nobody at svn.erp5.org
Fri Mar 19 11:07:03 CET 2010


Author: luke
Date: Fri Mar 19 11:07:03 2010
New Revision: 33911

URL: http://svn.erp5.org?rev=33911&view=rev
Log:
 - simplify logic of create/update ZODB

If ZODB does not exists - just create it.
If site is running do not touch ZODB.
If it is forced to update ZODB, update it.
If there is no site found inside of ZODB, update it.

Modified:
    erp5/trunk/utils/erp5.recipe.standaloneinstance/src/erp5/recipe/standaloneinstance/__init__.py

Modified: erp5/trunk/utils/erp5.recipe.standaloneinstance/src/erp5/recipe/standaloneinstance/__init__.py
URL: http://svn.erp5.org/erp5/trunk/utils/erp5.recipe.standaloneinstance/src/erp5/recipe/standaloneinstance/__init__.py?rev=33911&r1=33910&r2=33911&view=diff
==============================================================================
--- erp5/trunk/utils/erp5.recipe.standaloneinstance/src/erp5/recipe/standaloneinstance/__init__.py [utf8] (original)
+++ erp5/trunk/utils/erp5.recipe.standaloneinstance/src/erp5/recipe/standaloneinstance/__init__.py [utf8] Fri Mar 19 11:07:03 2010
@@ -119,22 +119,21 @@
     # Add zcml files to package-includes
     self.build_package_includes()
 
-    if self.options.get('force-zodb-update','false').strip().lower() == 'true':
-      force_zodb_update = True
-    else:
-      force_zodb_update = False
-
-    if os.path.exists(options['zodb-path'].strip()) and not force_zodb_update:
-      # in case if there is no site available force update of ZODB
-      force_zodb_update = not self.is_site_available()
-
-    if not os.path.exists(options['zodb-path'].strip()) or \
-        force_zodb_update:
-      if os.path.exists(options['zodb-path'].strip()):
-        if not self.is_site_running():
-          # only in case if site is not running changes to ZODB are allowed
-          self.update_zodb()
-    # we return nothing, as this is totally standalone installation
+    if not os.path.exists(options['zodb-path'].strip()):
+      # no ZODB - create new one
+      self.update_zodb()
+      return []
+
+    # ZODB exists...
+    if self.is_site_running():
+      # site is running, cannot update
+      # XXX: TODO emit log
+      return []
+
+    if self.options.get('force-zodb-update','false').strip().lower() == 'true' or \
+        not self.is_site_available():
+      # update is needed - no site found or forced
+      self.update_zodb()
     return []
 
   def is_site_running(self):




More information about the Erp5-report mailing list