[Erp5-report] r28832 - /erp5/trunk/products/ERP5/Tool/IntrospectionTool.py
nobody at svn.erp5.org
nobody at svn.erp5.org
Fri Sep 4 18:38:21 CEST 2009
Author: rafael
Date: Fri Sep 4 18:38:19 2009
New Revision: 28832
URL: http://svn.erp5.org?rev=28832&view=rev
Log:
Expect only a part of path only, and all possible variables should be configured at /etc/erp5.cfg.
Modified:
erp5/trunk/products/ERP5/Tool/IntrospectionTool.py
Modified: erp5/trunk/products/ERP5/Tool/IntrospectionTool.py
URL: http://svn.erp5.org/erp5/trunk/products/ERP5/Tool/IntrospectionTool.py?rev=28832&r1=28831&r2=28832&view=diff
==============================================================================
--- erp5/trunk/products/ERP5/Tool/IntrospectionTool.py [utf8] (original)
+++ erp5/trunk/products/ERP5/Tool/IntrospectionTool.py [utf8] Fri Sep 4 18:38:19 2009
@@ -243,7 +243,7 @@
return getConfiguration().softwarehome
security.declareProtected(Permissions.ManagePortal, 'setSoftwareHome')
- def setSoftwareHome(self, path):
+ def setSoftwareHome(self, relative_path):
"""
EXPERIMENTAL - DEVELOPMENT
@@ -258,6 +258,8 @@
"""
config = self._loadExternalConfig()
allowed_path_list = config.get("main", "zopehome").split("\n")
+ base_zope_path = config.get("base", "base_zope_path").split("\n")
+ path = "%s/%s/lib/python" % (base_zope_path,relative_path)
if path not in allowed_path_list:
raise Unauthorized("You are setting one Unauthorized path as Zope Home.")
@@ -338,7 +340,7 @@
return getConfiguration().products
security.declareProtected(Permissions.ManagePortal, 'setProductPathList')
- def setProductPathList(self, path_list):
+ def setProductPath(self, relative_path):
"""
Set the value of SOFTWARE_HOME for zopectl startup script
or from zope.conf (whichever is most relevant)
@@ -346,26 +348,31 @@
Rationale: multiple versions of Products can be present
on the same system
+ relative_path is usually defined by a number of release
+ (ex. 5.4.2)
+
WARNING: the list of possible path should be protected
if possible (ex. /etc/erp5/product)
"""
config = self._loadExternalConfig()
allowed_path_list = config.get("main", "products").split("\n")
-
- for path in path_list:
- if path not in allowed_path_list:
- raise Unauthorized("You are setting one Unauthorized path as Product Path.")
+ base_product_path = config.get("base", "base_product_path").split("\n")
+
+ path = base_product_path + relative_path
+
+ if path not in allowed_path_list:
+ raise Unauthorized("You are setting one Unauthorized path as Product Path.")
config_file = self._getZopeConfigurationFile("etc/zope.conf")
new_file_list = []
for line in config_file:
new_line = line
- if line.strip(" ").startswith("products"):
+ if line.strip(" ").startswith("products %s" % (base_product_path)):
# Only comment the line, so it can easily reverted
- new_line = "#%s" % ( line)
+ new_line = "#%s" % (line)
+ # Append the new line.
+ new_file_list.append("products %s\n" % (path))
new_file_list.append(new_line)
- for path in path_list:
- new_file_list.append("products %s\n" % (path))
config_file.close()
# reopen file for write
More information about the Erp5-report
mailing list