Commit 54783af3 authored by Jérome Perrin's avatar Jérome Perrin

In developpement mode, reraise errors when importing local registry.

Do not pass deprecated product_name parameter to CMFCore.utils.ToolInit if using a recent CMF.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@9200 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a856b547
...@@ -27,10 +27,18 @@ ...@@ -27,10 +27,18 @@
############################################################################## ##############################################################################
# Required modules - some modules are imported later to prevent circular deadlocks # Required modules - some modules are imported later to prevent circular deadlocks
import os, re, string, sys import os
import sys
import re
import string
from Globals import package_home from Globals import package_home
from Globals import DevelopmentMode
from ZPublisher.HTTPRequest import FileUpload from ZPublisher.HTTPRequest import FileUpload
from Acquisition import aq_base, aq_inner, aq_parent, aq_self from Acquisition import aq_base
from Acquisition import aq_inner
from Acquisition import aq_parent
from Acquisition import aq_self
from Products.CMFCore import utils from Products.CMFCore import utils
from Products.CMFCore.Expression import Expression from Products.CMFCore.Expression import Expression
...@@ -294,7 +302,7 @@ def updateGlobals(this_module, global_hook, ...@@ -294,7 +302,7 @@ def updateGlobals(this_module, global_hook,
# Modules Import # Modules Import
##################################################### #####################################################
import imp, os, re import imp
# Zope 2.6.x does not have App.Config # Zope 2.6.x does not have App.Config
try: try:
...@@ -667,7 +675,6 @@ def importLocalDocument(class_id, document_path = None): ...@@ -667,7 +675,6 @@ def importLocalDocument(class_id, document_path = None):
# Temp documents are created as standard classes with a different constructor # Temp documents are created as standard classes with a different constructor
# which patches some methods are the instance level to prevent reindexing # which patches some methods are the instance level to prevent reindexing
from Products.ERP5Type import product_path as erp5_product_path from Products.ERP5Type import product_path as erp5_product_path
from Products.PythonScripts.Utility import allow_class
temp_document_constructor = TempDocumentConstructor(document_class) temp_document_constructor = TempDocumentConstructor(document_class)
temp_document_constructor_name = "newTemp%s" % class_id temp_document_constructor_name = "newTemp%s" % class_id
temp_document_constructor.__name__ = temp_document_constructor_name temp_document_constructor.__name__ = temp_document_constructor_name
...@@ -749,11 +756,15 @@ def initializeLocalRegistry(directory_name, import_local_method, ...@@ -749,11 +756,15 @@ def initializeLocalRegistry(directory_name, import_local_method,
try: try:
# XXX Arg are not consistent # XXX Arg are not consistent
import_local_method(module_name, **{path_arg_name: document_path}) import_local_method(module_name, **{path_arg_name: document_path})
LOG('Added local %s to ERP5Type repository: %s (%s)' LOG('ERP5Type', BLATHER,
% (directory_name, module_name, document_path), 0, '') 'Added local %s to ERP5Type repository: %s (%s)'
% (directory_name, module_name, document_path))
except Exception, e: except Exception, e:
LOG('Failed to add local %s to ERP5Type repository: %s (%s)' if DevelopmentMode:
% (directory_name, module_name, document_path), PROBLEM, '', e) raise
LOG('E5RP5Type', PROBLEM,
'Failed to add local %s to ERP5Type repository: %s (%s)'
% (directory_name, module_name, document_path), error=e)
def initializeLocalDocumentRegistry(): def initializeLocalDocumentRegistry():
# XXX Arg are not consistent # XXX Arg are not consistent
...@@ -845,22 +856,29 @@ def initializeProduct( context, ...@@ -845,22 +856,29 @@ def initializeProduct( context,
try: try:
registerDirectory('skins', global_hook) registerDirectory('skins', global_hook)
except: except:
LOG("ERP5Type:", BLATHER, "No skins directory for %s" % product_name) LOG("ERP5Type", BLATHER, "No skins directory for %s" % product_name)
try: try:
registerDirectory('help', global_hook) registerDirectory('help', global_hook)
except: except:
LOG("ERP5Type:", BLATHER, "No help directory for %s" % product_name) LOG("ERP5Type", BLATHER, "No help directory for %s" % product_name)
# Finish the initialization # Finish the initialization
utils.initializeBasesPhase2( z_bases, context ) utils.initializeBasesPhase2( z_bases, context )
utils.initializeBasesPhase2( z_tool_bases, context ) utils.initializeBasesPhase2( z_tool_bases, context )
if len(tools) > 0: if len(tools) > 0:
utils.ToolInit('%s Tool' % product_name, try:
tools=tools, utils.ToolInit('%s Tool' % product_name,
product_name=product_name, tools=tools,
icon='tool.png', icon='tool.png',
).initialize( context ) ).initialize( context )
except TypeError:
# product_name parameter is deprecated in CMF
utils.ToolInit('%s Tool' % product_name,
tools=tools,
product_name=product_name,
icon='tool.png',
).initialize( context )
for klass in content_classes: for klass in content_classes:
# This id the default add permission to all ojects # This id the default add permission to all ojects
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment