Commit 78a8f52c authored by Arnaud Fontaine's avatar Arnaud Fontaine

WIP: Make ERP5Type self-contained and independent of ERP5 Product.

parent c502e47c
...@@ -29,7 +29,7 @@ ...@@ -29,7 +29,7 @@
import os, shutil, tempfile, unittest import os, shutil, tempfile, unittest
from Acquisition import aq_base from Acquisition import aq_base
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5.ERP5Site import addERP5Tool from Products.ERP5Type.ERP5Site import addERP5Tool
class TestInotifyTool(ERP5TypeTestCase): class TestInotifyTool(ERP5TypeTestCase):
def test_inotify(self): def test_inotify(self):
......
...@@ -37,7 +37,7 @@ class MagentoTestConnector: ...@@ -37,7 +37,7 @@ class MagentoTestConnector:
def __init__(self): def __init__(self):
""" """
""" """
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
self.context = getSite() self.context = getSite()
......
...@@ -184,7 +184,7 @@ class OxatisTestConnector: ...@@ -184,7 +184,7 @@ class OxatisTestConnector:
def __init__(self): def __init__(self):
""" """
""" """
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
self.context = getSite() self.context = getSite()
......
...@@ -107,7 +107,7 @@ class UbercartTestConnector: ...@@ -107,7 +107,7 @@ class UbercartTestConnector:
def __init__(self): def __init__(self):
""" """
""" """
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
self.context = getSite() self.context = getSite()
def validateXMLScheme(self, xml, xsd_filename): def validateXMLScheme(self, xml, xsd_filename):
......
...@@ -116,7 +116,7 @@ class VirtueMartTestConnector: ...@@ -116,7 +116,7 @@ class VirtueMartTestConnector:
def __init__(self): def __init__(self):
""" """
""" """
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
self.context = getSite() self.context = getSite()
def getPropertySheetDefinitionList(self, type): def getPropertySheetDefinitionList(self, type):
......
...@@ -5451,7 +5451,7 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -5451,7 +5451,7 @@ Business Template is a set of definitions, such as skins, portal types and categ
# update tools if necessary # update tools if necessary
if self.getTitle() == 'erp5_core' and self.getTemplateUpdateTool(): if self.getTitle() == 'erp5_core' and self.getTemplateUpdateTool():
from Products.ERP5.ERP5Site import ERP5Generator from Products.ERP5Type.ERP5Site import ERP5Generator
gen = getattr(site, '_generator_class', ERP5Generator)() gen = getattr(site, '_generator_class', ERP5Generator)()
LOG('Business Template', 0, 'Updating Tools') LOG('Business Template', 0, 'Updating Tools')
gen.setup(site, 0, update=1) gen.setup(site, 0, update=1)
...@@ -6457,9 +6457,9 @@ Business Template is a set of definitions, such as skins, portal types and categ ...@@ -6457,9 +6457,9 @@ Business Template is a set of definitions, such as skins, portal types and categ
_migrate_exception_set = set([ _migrate_exception_set = set([
## Bootstrap ## Bootstrap
'Products.ERP5.Document.BusinessTemplate', 'Products.ERP5.Document.BusinessTemplate',
'Products.ERP5.ERP5Site', 'Products.ERP5Type.ERP5Site',
'Products.ERP5.genbt5list', 'Products.ERP5.genbt5list',
'Products.ERP5.Tool.CategoryTool', 'Products.ERP5Type.Tool.CategoryTool',
'Products.ERP5.Tool.TemplateTool', 'Products.ERP5.Tool.TemplateTool',
'Products.ERP5Type.Base', 'Products.ERP5Type.Base',
'Products.ERP5Type.Cache', 'Products.ERP5Type.Cache',
......
...@@ -59,7 +59,7 @@ class PortalTypeClassInteractor(Interactor): ...@@ -59,7 +59,7 @@ class PortalTypeClassInteractor(Interactor):
""" """
Call resetDynamicDocuments at the end of the transaction Call resetDynamicDocuments at the end of the transaction
""" """
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
# method_call_object might be an unwrapped DCWorflowDefinition method, # method_call_object might be an unwrapped DCWorflowDefinition method,
# no even belonging to a container. # no even belonging to a container.
portal = getSite() portal = getSite()
......
...@@ -41,21 +41,18 @@ from Products.ERP5Type.Globals import package_home ...@@ -41,21 +41,18 @@ from Products.ERP5Type.Globals import package_home
product_path = package_home( globals() ) product_path = package_home( globals() )
# Define object classes and tools # Define object classes and tools
from Tool import CategoryTool, IdTool, TemplateTool,\ from Tool import IdTool, TemplateTool,\
TestTool, DomainTool, AlarmTool,\ TestTool, DomainTool, AlarmTool,\
TrashTool, ContributionTool, NotificationTool, PasswordTool,\ TrashTool, ContributionTool, NotificationTool, PasswordTool,\
GadgetTool, ContributionRegistryTool, IntrospectionTool,\ GadgetTool, ContributionRegistryTool, IntrospectionTool,\
AcknowledgementTool, SolverTool,\ AcknowledgementTool, SolverTool,\
UrlRegistryTool, InterfaceTool,\ UrlRegistryTool, InterfaceTool,\
CertificateAuthorityTool, InotifyTool CertificateAuthorityTool, InotifyTool
import ERP5Site
from Document import PythonScript, SQLMethod from Document import PythonScript, SQLMethod
object_classes = ( ERP5Site.ERP5Site, object_classes = ( PythonScript.PythonScriptThroughZMI,
PythonScript.PythonScriptThroughZMI,
SQLMethod.SQLMethod, SQLMethod.SQLMethod,
) )
portal_tools = ( CategoryTool.CategoryTool, portal_tools = ( IdTool.IdTool,
IdTool.IdTool,
TemplateTool.TemplateTool, TemplateTool.TemplateTool,
AlarmTool.AlarmTool, AlarmTool.AlarmTool,
DomainTool.DomainTool, DomainTool.DomainTool,
......
...@@ -37,7 +37,7 @@ from erp5.component.module.ExpandPolicy import policy_dict, TREE_DELIVERED_CACHE ...@@ -37,7 +37,7 @@ from erp5.component.module.ExpandPolicy import policy_dict, TREE_DELIVERED_CACHE
from zLOG import LOG, WARNING from zLOG import LOG, WARNING
from Products.ERP5.mixin.property_recordable import PropertyRecordableMixin from Products.ERP5Type.mixin.property_recordable import PropertyRecordableMixin
from erp5.component.mixin.ExplainableMixin import ExplainableMixin from erp5.component.mixin.ExplainableMixin import ExplainableMixin
from erp5.component.interface.IExpandable import IExpandable from erp5.component.interface.IExpandable import IExpandable
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
erp5.component.interface.ISimulationMovement erp5.component.interface.ISimulationMovement
""" """
from Products.ERP5.interfaces.property_recordable import IPropertyRecordable from Products.ERP5Type.interfaces.property_recordable import IPropertyRecordable
from Products.ERP5.interfaces.movement import IMovement from Products.ERP5.interfaces.movement import IMovement
from erp5.component.interface.IDivergenceController import IDivergenceController from erp5.component.interface.IDivergenceController import IDivergenceController
from Products.ERP5.interfaces.explainable import IExplainable from Products.ERP5.interfaces.explainable import IExplainable
......
...@@ -27,11 +27,11 @@ ...@@ -27,11 +27,11 @@
# #
############################################################################## ##############################################################################
from Products.ERP5.interfaces.predicate import IPredicate from Products.ERP5Type import interfaces
_MARKER = [] _MARKER = []
class IMappedValue(IPredicate): class IMappedValue(interfaces.IPredicate):
"""Mapped Value document interface specification """Mapped Value document interface specification
A Mapped Value provides A Mapped Value provides
......
...@@ -387,7 +387,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject): ...@@ -387,7 +387,7 @@ class CatalogTool (UniqueObject, ZCatalog, CMFCoreCatalogTool, ActiveObject):
parent = self.aq_parent parent = self.aq_parent
portal_types = parent.portal_types portal_types = parent.portal_types
portal_property_sheets = parent.portal_property_sheets portal_property_sheets = parent.portal_property_sheets
from Products.ERP5.ERP5Site import ERP5Generator from Products.ERP5Type.ERP5Site import ERP5Generator
ERP5Generator.bootstrap(portal_types, 'erp5_core', 'PortalTypeTemplateItem', ( ERP5Generator.bootstrap(portal_types, 'erp5_core', 'PortalTypeTemplateItem', (
'Catalog', 'Catalog',
'Catalog Tool', 'Catalog Tool',
......
...@@ -54,7 +54,7 @@ def ERP5Site_createModuleScribus(self, ...@@ -54,7 +54,7 @@ def ERP5Site_createModuleScribus(self,
from Products.ERP5Form.CreatePropertySheet import LocalGenerator from Products.ERP5Form.CreatePropertySheet import LocalGenerator
# importing module to get an access to the 'searchFolder' method # importing module to get an access to the 'searchFolder' method
# needed to be able to list the objects in 'list_object_view' form # needed to be able to list the objects in 'list_object_view' form
from Products.ERP5.ERP5Site import ERP5Site from Products.ERP5Type.ERP5Site import ERP5Site
from zLOG import LOG, TRACE, WARNING, ERROR, INFO from zLOG import LOG, TRACE, WARNING, ERROR, INFO
# CREATING MODULES INSTANCES # CREATING MODULES INSTANCES
......
...@@ -49,7 +49,7 @@ def ERP5Site_updateModuleScribus(self, ...@@ -49,7 +49,7 @@ def ERP5Site_updateModuleScribus(self,
from Products.ERP5Form.CreatePropertySheet import LocalGenerator from Products.ERP5Form.CreatePropertySheet import LocalGenerator
# importing module to get an access to the 'searchFolder' method # importing module to get an access to the 'searchFolder' method
# needed to be able to list the objects in 'list_object_view' form # needed to be able to list the objects in 'list_object_view' form
from Products.ERP5.ERP5Site import ERP5Site from Products.ERP5Type.ERP5Site import ERP5Site
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from zLOG import LOG, TRACE, WARNING, ERROR, INFO from zLOG import LOG, TRACE, WARNING, ERROR, INFO
......
...@@ -58,7 +58,7 @@ class FieldValueCacheDict(dict): ...@@ -58,7 +58,7 @@ class FieldValueCacheDict(dict):
def clear(self): def clear(self):
super(FieldValueCacheDict, self).clear() super(FieldValueCacheDict, self).clear()
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
try: try:
portal = getSite() portal = getSite()
except IndexError: except IndexError:
...@@ -68,7 +68,7 @@ class FieldValueCacheDict(dict): ...@@ -68,7 +68,7 @@ class FieldValueCacheDict(dict):
self._last_sync = portal.getCacheCookie('form_field_value_cache') self._last_sync = portal.getCacheCookie('form_field_value_cache')
def __getitem__(self, cache_id): def __getitem__(self, cache_id):
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
try: try:
portal = getSite() portal = getSite()
except IndexError: except IndexError:
......
...@@ -41,7 +41,7 @@ import random ...@@ -41,7 +41,7 @@ import random
import getopt, sys, os, re import getopt, sys, os, re
from urllib import quote from urllib import quote
from Products.ERP5.ERP5Site import ERP5Site from Products.ERP5Type.ERP5Site import ERP5Site
from Products.Formulator.TALESField import TALESMethod from Products.Formulator.TALESField import TALESMethod
from Products.Formulator.MethodField import Method from Products.Formulator.MethodField import Method
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
......
...@@ -29,7 +29,7 @@ from logging import getLogger ...@@ -29,7 +29,7 @@ from logging import getLogger
from Products.ERP5SyncML.Engine.EngineMixin import EngineMixin from Products.ERP5SyncML.Engine.EngineMixin import EngineMixin
from Products.ERP5SyncML.SyncMLConstant import ACTIVITY_PRIORITY from Products.ERP5SyncML.SyncMLConstant import ACTIVITY_PRIORITY
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
syncml_logger = getLogger('ERP5SyncML') syncml_logger = getLogger('ERP5SyncML')
......
...@@ -38,7 +38,7 @@ from Products.ERP5SyncML.SyncMLConstant import ACTIVITY_PRIORITY, \ ...@@ -38,7 +38,7 @@ from Products.ERP5SyncML.SyncMLConstant import ACTIVITY_PRIORITY, \
from Products.ERP5SyncML.SyncMLMessage import SyncMLRequest from Products.ERP5SyncML.SyncMLMessage import SyncMLRequest
from Products.ERP5SyncML.Engine.SynchronousEngine import SyncMLSynchronousEngine from Products.ERP5SyncML.Engine.SynchronousEngine import SyncMLSynchronousEngine
from Products.ERP5SyncML.Engine.AsynchronousEngine import SyncMLAsynchronousEngine from Products.ERP5SyncML.Engine.AsynchronousEngine import SyncMLAsynchronousEngine
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
synchronous_engine = SyncMLSynchronousEngine() synchronous_engine = SyncMLSynchronousEngine()
asynchronous_engine = SyncMLAsynchronousEngine() asynchronous_engine = SyncMLAsynchronousEngine()
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
class ERP5Transport: class ERP5Transport:
""" """
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
from HTTP import ConnectionError from HTTP import ConnectionError
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
class MailTransport: class MailTransport:
......
...@@ -38,7 +38,7 @@ from ERP5Diff import ERP5Diff ...@@ -38,7 +38,7 @@ from ERP5Diff import ERP5Diff
from DateTime import DateTime from DateTime import DateTime
from SyncMLConstant import SYNCML_NAMESPACE, NSMAP, MAX_LEN from SyncMLConstant import SYNCML_NAMESPACE, NSMAP, MAX_LEN
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
E = ElementMaker(namespace=SYNCML_NAMESPACE, nsmap=NSMAP) E = ElementMaker(namespace=SYNCML_NAMESPACE, nsmap=NSMAP)
parser = etree.XMLParser(remove_blank_text=True) parser = etree.XMLParser(remove_blank_text=True)
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
############################################################################## ##############################################################################
from Products.ERP5Type.Tool.WebServiceTool import ConnectionError from Products.ERP5Type.Tool.WebServiceTool import ConnectionError
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
class MethodWrapper(object): class MethodWrapper(object):
......
...@@ -353,7 +353,7 @@ def _aq_reset(): ...@@ -353,7 +353,7 @@ def _aq_reset():
# Callers expect to re-generates accessors right now, so call # Callers expect to re-generates accessors right now, so call
# resetDynamicDocuments to maintain backward-compatibility # resetDynamicDocuments to maintain backward-compatibility
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
getSite().portal_types.resetDynamicDocuments() getSite().portal_types.resetDynamicDocuments()
class PropertyHolder(object): class PropertyHolder(object):
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
############################################################################## ##############################################################################
from Products.ERP5Type.Tool.WebServiceTool import ConnectionError from Products.ERP5Type.Tool.WebServiceTool import ConnectionError
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
class MethodWrapper(object): class MethodWrapper(object):
......
...@@ -232,7 +232,7 @@ class StandardProperty(IdAsReferenceMixin('_property'), XMLObject): ...@@ -232,7 +232,7 @@ class StandardProperty(IdAsReferenceMixin('_property'), XMLObject):
@param kind: 'min' or 'max' @param kind: 'min' or 'max'
@type kind: string @type kind: string
@param portal: Portal object @param portal: Portal object
@type portal: Products.ERP5.ERP5Site.ERP5Site @type portal: Products.ERP5Type.ERP5Site.ERP5Site
""" """
property_dict['reference'] = '%s_range_%s' % (property_dict['reference'], property_dict['reference'] = '%s_range_%s' % (property_dict['reference'],
kind) kind)
...@@ -281,7 +281,7 @@ class StandardProperty(IdAsReferenceMixin('_property'), XMLObject): ...@@ -281,7 +281,7 @@ class StandardProperty(IdAsReferenceMixin('_property'), XMLObject):
@param accessor_holder: Accessor holder to applied the accessors on @param accessor_holder: Accessor holder to applied the accessors on
@type accessor_holder: Products.ERP5Type.dynamic.accessor_holder.AccessorHolderType @type accessor_holder: Products.ERP5Type.dynamic.accessor_holder.AccessorHolderType
@param portal: Portal object @param portal: Portal object
@type portal: Products.ERP5.ERP5Site.ERP5Site @type portal: Products.ERP5Type.ERP5Site.ERP5Site
""" """
try: try:
localizer = portal._getOb('Localizer') localizer = portal._getOb('Localizer')
...@@ -498,7 +498,7 @@ class StandardProperty(IdAsReferenceMixin('_property'), XMLObject): ...@@ -498,7 +498,7 @@ class StandardProperty(IdAsReferenceMixin('_property'), XMLObject):
@param accessor_holder: Accessor holder to applied the accessors on @param accessor_holder: Accessor holder to applied the accessors on
@type accessor_holder: Products.ERP5Type.dynamic.accessor_holder.AccessorHolderType @type accessor_holder: Products.ERP5Type.dynamic.accessor_holder.AccessorHolderType
@param portal: Portal object @param portal: Portal object
@type portal: Products.ERP5.ERP5Site.ERP5Site @type portal: Products.ERP5Type.ERP5Site.ERP5Site
@param do_register: Register the property in the Zope property map @param do_register: Register the property in the Zope property map
@type do_register: bool @type do_register: bool
""" """
...@@ -637,7 +637,7 @@ class StandardProperty(IdAsReferenceMixin('_property'), XMLObject): ...@@ -637,7 +637,7 @@ class StandardProperty(IdAsReferenceMixin('_property'), XMLObject):
@param expression_context: Expression context for TALES Expression @param expression_context: Expression context for TALES Expression
@type expression_context: Products.PageTemplates.Expressions.ZopeContext @type expression_context: Products.PageTemplates.Expressions.ZopeContext
@param portal: Portal object @param portal: Portal object
@type portal: Products.ERP5.ERP5Site.ERP5Site @type portal: Products.ERP5Type.ERP5Site.ERP5Site
@see applyDefinitionOnAccessorHolder @see applyDefinitionOnAccessorHolder
""" """
......
...@@ -134,7 +134,7 @@ class Message(Persistent): ...@@ -134,7 +134,7 @@ class Message(Persistent):
message = message.encode('utf-8') message = message.encode('utf-8')
message = Template(message).substitute(self.mapping) message = Template(message).substitute(self.mapping)
else: else:
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
request = Globals.get_request() request = Globals.get_request()
translation_service = getGlobalTranslationService() translation_service = getGlobalTranslationService()
if self.mapping: if self.mapping:
......
...@@ -80,7 +80,7 @@ class BaseTool (UniqueObject, Folder): ...@@ -80,7 +80,7 @@ class BaseTool (UniqueObject, Folder):
# Tools are causing problems: they used to have no type_class, or wrong # Tools are causing problems: they used to have no type_class, or wrong
# type_class, or sometimes have no type definitions at all. # type_class, or sometimes have no type definitions at all.
# Fix type definition if possible before any migration. # Fix type definition if possible before any migration.
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
types_tool = getSite().portal_types types_tool = getSite().portal_types
type_definition = getattr(types_tool, portal_type, None) type_definition = getattr(types_tool, portal_type, None)
if type_definition is not None and \ if type_definition is not None and \
......
...@@ -78,7 +78,7 @@ class PropertySheetTool(BaseTool): ...@@ -78,7 +78,7 @@ class PropertySheetTool(BaseTool):
def _bootstrap(self): def _bootstrap(self):
bt_name = 'erp5_property_sheets' bt_name = 'erp5_property_sheets'
from Products.ERP5.ERP5Site import ERP5Generator from Products.ERP5Type.ERP5Site import ERP5Generator
content_path_list = [ content_path_list = [
'BaseType', 'BaseType',
'BusinessTemplate', 'BusinessTemplate',
...@@ -103,7 +103,7 @@ class PropertySheetTool(BaseTool): ...@@ -103,7 +103,7 @@ class PropertySheetTool(BaseTool):
template_tool = portal.aq_base.__of__(portal.aq_parent.__of__( template_tool = portal.aq_base.__of__(portal.aq_parent.__of__(
RequestContainer(REQUEST=get_request()))).portal_templates RequestContainer(REQUEST=get_request()))).portal_templates
if template_tool.getInstalledBusinessTemplate(bt_name) is None: if template_tool.getInstalledBusinessTemplate(bt_name) is None:
from Products.ERP5.ERP5Site import getBootstrapBusinessTemplateUrl from Products.ERP5Type.ERP5Site import getBootstrapBusinessTemplateUrl
url = getBootstrapBusinessTemplateUrl(bt_name) url = getBootstrapBusinessTemplateUrl(bt_name)
template_tool.download(url).install() template_tool.download(url).install()
transaction.get().addBeforeCommitHook(unrestricted_apply, (install,)) transaction.get().addBeforeCommitHook(unrestricted_apply, (install,))
......
...@@ -123,7 +123,7 @@ class TypesTool(TypeProvider): ...@@ -123,7 +123,7 @@ class TypesTool(TypeProvider):
return False return False
def _bootstrap(self): def _bootstrap(self):
from Products.ERP5.ERP5Site import ERP5Generator from Products.ERP5Type.ERP5Site import ERP5Generator
ERP5Generator.bootstrap(self, 'erp5_core', 'PortalTypeTemplateItem', ( ERP5Generator.bootstrap(self, 'erp5_core', 'PortalTypeTemplateItem', (
'Business Template', 'Business Template',
'Standard Property', 'Standard Property',
...@@ -158,7 +158,14 @@ class TypesTool(TypeProvider): ...@@ -158,7 +158,14 @@ class TypesTool(TypeProvider):
for provider in self.type_provider_list: for provider in self.type_provider_list:
provider_value = _getOb(provider, None) provider_value = _getOb(provider, None)
if provider_value is not None: if provider_value is not None:
type_info_list += listTypeInfo(provider_value, container=container) try:
type_info_list += listTypeInfo(provider_value, container=container)
except TypeError:
# DO NOT COMMIT: Products.ERP5.Tool.SolverTool, should be there
# after installing ERP5 products later or should it be moved to
# Products.ERP5Type?
pass
return type_info_list return type_info_list
def _aq_dynamic(self, id): def _aq_dynamic(self, id):
......
...@@ -101,7 +101,7 @@ def super_user(): ...@@ -101,7 +101,7 @@ def super_user():
uf = user.aq_inner.aq_parent uf = user.aq_inner.aq_parent
except AttributeError: except AttributeError:
# XXX: local imports are bad, getSite should be moved to ERP5Type. # XXX: local imports are bad, getSite should be moved to ERP5Type.
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
uf = getSite().acl_users uf = getSite().acl_users
role_list = uf.valid_roles() role_list = uf.valid_roles()
if anonymous: if anonymous:
......
...@@ -1097,7 +1097,7 @@ def registerDocumentClass(module_name, class_name): ...@@ -1097,7 +1097,7 @@ def registerDocumentClass(module_name, class_name):
LOG('Utils', WARNING, LOG('Utils', WARNING,
"Ignoring replacement of %s by %s" % (old_value, new_value)) "Ignoring replacement of %s by %s" % (old_value, new_value))
return return
assert module_name == 'Products.ERP5.Tool.CategoryTool', module_name assert module_name == 'Products.ERP5Type.Tool.CategoryTool', module_name
LOG('Utils', WARNING, "Replacing %s by %s" % (old_value, new_value)) LOG('Utils', WARNING, "Replacing %s by %s" % (old_value, new_value))
else: else:
raise Exception("Class %s and %s from different products have the " raise Exception("Class %s and %s from different products have the "
......
...@@ -90,14 +90,15 @@ def initialize( context ): ...@@ -90,14 +90,15 @@ def initialize( context ):
# Import Product Components # Import Product Components
from Tool import (CacheTool, MemcachedTool, SessionTool, from Tool import (CacheTool, MemcachedTool, SessionTool,
TypesTool, WebServiceTool, PropertySheetTool, TypesTool, WebServiceTool, PropertySheetTool,
ComponentTool) ComponentTool, CategoryTool)
import Document import Document
from Base import Base from Base import Base
import XMLObject import XMLObject
from ERP5Type import ERP5TypeInformation from ERP5Type import ERP5TypeInformation
import CodingStyle import CodingStyle
# Define documents, classes, constructors and tools # Define documents, classes, constructors and tools
object_classes = () import ERP5Site
object_classes = (ERP5Site.ERP5Site,)
content_constructors = () content_constructors = ()
content_classes = ( Base, content_classes = ( Base,
XMLObject.XMLObject, XMLObject.XMLObject,
...@@ -108,7 +109,8 @@ def initialize( context ): ...@@ -108,7 +109,8 @@ def initialize( context ):
TypesTool.TypesTool, TypesTool.TypesTool,
WebServiceTool.WebServiceTool, WebServiceTool.WebServiceTool,
PropertySheetTool.PropertySheetTool, PropertySheetTool.PropertySheetTool,
ComponentTool.ComponentTool ComponentTool.ComponentTool,
CategoryTool.CategoryTool
) )
# Do initialization step # Do initialization step
initializeProduct(context, this_module, globals(), initializeProduct(context, this_module, globals(),
......
...@@ -34,7 +34,7 @@ import sys ...@@ -34,7 +34,7 @@ import sys
import imp import imp
import collections import collections
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
from . import aq_method_lock from . import aq_method_lock
from types import ModuleType from types import ModuleType
from zLOG import LOG, BLATHER, WARNING from zLOG import LOG, BLATHER, WARNING
......
...@@ -343,7 +343,7 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder): ...@@ -343,7 +343,7 @@ class PortalTypeMetaClass(GhostBaseMetaClass, PropertyHolder):
" class hierarchy") " class hierarchy")
portal_type = klass.__name__ portal_type = klass.__name__
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
site = getSite() site = getSite()
with aq_method_lock: with aq_method_lock:
try: try:
......
...@@ -156,7 +156,7 @@ class PickleUpdater(ObjectReader, ObjectWriter, object): ...@@ -156,7 +156,7 @@ class PickleUpdater(ObjectReader, ObjectWriter, object):
if 1: if 1:
from Products.ERP5Type.Core.Folder import Folder from Products.ERP5Type.Core.Folder import Folder
from Products.ERP5.Tool.CategoryTool import CategoryTool from Products.ERP5Type.Tool.CategoryTool import CategoryTool
Base__setstate__ = Base.__setstate__ Base__setstate__ = Base.__setstate__
......
...@@ -10,3 +10,5 @@ from value_access_provider import IValueAccessProvider ...@@ -10,3 +10,5 @@ from value_access_provider import IValueAccessProvider
from constraint import IConstraint from constraint import IConstraint
from role_provider import ILocalRoleAssignor, ILocalRoleGenerator from role_provider import ILocalRoleAssignor, ILocalRoleGenerator
from types_tool import ITypesTool, ITypeProvider from types_tool import ITypesTool, ITypeProvider
from property_recordable import IPropertyRecordable
from predicate import IPredicate
...@@ -34,7 +34,7 @@ from __future__ import absolute_import ...@@ -34,7 +34,7 @@ from __future__ import absolute_import
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Acquisition import aq_base from Acquisition import aq_base
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5.mixin.property_recordable import PropertyRecordableMixin from Products.ERP5Type.mixin.property_recordable import PropertyRecordableMixin
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter
......
...@@ -73,7 +73,7 @@ def manage_addToolForm(self, REQUEST): ...@@ -73,7 +73,7 @@ def manage_addToolForm(self, REQUEST):
""" Show the add tool form. """ Show the add tool form.
""" """
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
import erp5.component.tool import erp5.component.tool
seen_tool_component_set = set() seen_tool_component_set = set()
for tool_component in getSite().portal_components.objectValues(portal_type='Tool Component'): for tool_component in getSite().portal_components.objectValues(portal_type='Tool Component'):
......
...@@ -65,7 +65,7 @@ def formatLine(self, tb, *args, **kwargs): ...@@ -65,7 +65,7 @@ def formatLine(self, tb, *args, **kwargs):
f_globals = f.f_globals f_globals = f.f_globals
line_str = HTMLExceptionFormatter_formatLine(self, tb, *args, **kwargs) line_str = HTMLExceptionFormatter_formatLine(self, tb, *args, **kwargs)
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
try: try:
portal_absolute_url = getSite().absolute_url() portal_absolute_url = getSite().absolute_url()
......
...@@ -115,7 +115,7 @@ MANAGER.register_transform(nodes.Module, ...@@ -115,7 +115,7 @@ MANAGER.register_transform(nodes.Module,
lambda n: n.name == 'erp5') lambda n: n.name == 'erp5')
def _buildAstroidModuleFromComponentModuleName(modname): def _buildAstroidModuleFromComponentModuleName(modname):
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
from Acquisition import aq_base from Acquisition import aq_base
portal = getSite() portal = getSite()
component_tool = aq_base(portal.portal_components) component_tool = aq_base(portal.portal_components)
......
...@@ -63,7 +63,7 @@ class CodingStyleTest(CodingStyleTestCase, testXHTML.TestXHTMLMixin): ...@@ -63,7 +63,7 @@ class CodingStyleTest(CodingStyleTestCase, testXHTML.TestXHTMLMixin):
""" """
template_tool = self.portal.portal_templates template_tool = self.portal.portal_templates
from Products.ERP5.ERP5Site import getBootstrapDirectory from Products.ERP5Type.ERP5Site import getBootstrapDirectory
bt5_path_list = [os.environ.get('erp5_tests_bootstrap_path') or bt5_path_list = [os.environ.get('erp5_tests_bootstrap_path') or
getBootstrapDirectory()] getBootstrapDirectory()]
for path in os.environ['erp5_tests_bt5_path'].split(','): for path in os.environ['erp5_tests_bt5_path'].split(','):
......
...@@ -82,7 +82,7 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin): ...@@ -82,7 +82,7 @@ class ERP5TypeLiveTestCase(ERP5TypeTestCaseMixin):
if self.portal is not None: if self.portal is not None:
return self.portal return self.portal
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
site = getSite() site = getSite()
# reconstruct the acquistion chain with an independant request. # reconstruct the acquistion chain with an independant request.
# RequestContainer -> Application -> Site # RequestContainer -> Application -> Site
......
...@@ -1192,7 +1192,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin): ...@@ -1192,7 +1192,7 @@ class ERP5TypeCommandLineTestCase(ERP5TypeTestCaseMixin):
ZopeTestCase._print('Adding %s ERP5 Site ... ' % portal_name) ZopeTestCase._print('Adding %s ERP5 Site ... ' % portal_name)
kw = self._getSiteCreationParameterDict() kw = self._getSiteCreationParameterDict()
factory = app.manage_addProduct['ERP5'] factory = app.manage_addProduct['ERP5Type']
factory.manage_addERP5Site(portal_name, factory.manage_addERP5Site(portal_name,
erp5_catalog_storage=erp5_catalog_storage, erp5_catalog_storage=erp5_catalog_storage,
light_install=light_install, light_install=light_install,
...@@ -1319,7 +1319,7 @@ class ERP5TypeTestCase(ERP5TypeCommandLineTestCase): ...@@ -1319,7 +1319,7 @@ class ERP5TypeTestCase(ERP5TypeCommandLineTestCase):
This TestCase setups an ERP5Site and installs business templates. This TestCase setups an ERP5Site and installs business templates.
""" """
from Products.ERP5 import ERP5Site from Products.ERP5Type import ERP5Site
ERP5Site.getBootstrapBusinessTemplateUrl = lambda bt_title: \ ERP5Site.getBootstrapBusinessTemplateUrl = lambda bt_title: \
ERP5TypeCommandLineTestCase._getBTPathAndIdList((bt_title,))[0][0] ERP5TypeCommandLineTestCase._getBTPathAndIdList((bt_title,))[0][0]
......
...@@ -66,7 +66,7 @@ else: ...@@ -66,7 +66,7 @@ else:
# must be cleared of data from previous execution if any # must be cleared of data from previous execution if any
_print("Catalog will be recreated to clear data (if any) from previous execution") _print("Catalog will be recreated to clear data (if any) from previous execution")
import Products.ZMySQLDA.db import Products.ZMySQLDA.db
from Products.ERP5.ERP5Site import default_sql_connection_string from Products.ERP5Type.ERP5Site import default_sql_connection_string
sql_db = Products.ZMySQLDA.db.DB(os.environ.get('erp5_sql_connection_string', sql_db = Products.ZMySQLDA.db.DB(os.environ.get('erp5_sql_connection_string',
default_sql_connection_string)) default_sql_connection_string))
......
...@@ -406,7 +406,7 @@ class ERP5TypeTestLoader(unittest.TestLoader): ...@@ -406,7 +406,7 @@ class ERP5TypeTestLoader(unittest.TestLoader):
""" """
template_tool = self.portal.portal_templates template_tool = self.portal.portal_templates
from Products.ERP5.ERP5Site import getBootstrapDirectory from Products.ERP5Type.ERP5Site import getBootstrapDirectory
bt5_path_list = [os.environ.get('erp5_tests_bootstrap_path') or bt5_path_list = [os.environ.get('erp5_tests_bootstrap_path') or
getBootstrapDirectory()] getBootstrapDirectory()]
for path in os.environ['erp5_tests_bt5_path'].split(','): for path in os.environ['erp5_tests_bt5_path'].split(','):
......
...@@ -1183,7 +1183,7 @@ class TestZodbPropertySheet(ERP5TypeTestCase): ...@@ -1183,7 +1183,7 @@ class TestZodbPropertySheet(ERP5TypeTestCase):
con = db.open(transaction_manager=tm) con = db.open(transaction_manager=tm)
app = con.root()['Application'].__of__(self.app.aq_parent) app = con.root()['Application'].__of__(self.app.aq_parent)
portal = app[self.getPortalName()] portal = app[self.getPortalName()]
from Products.ERP5.ERP5Site import getSite, setSite from Products.ERP5Type.ERP5Site import getSite, setSite
old_site = getSite() old_site = getSite()
setSite(portal) setSite(portal)
...@@ -2885,7 +2885,7 @@ class Test(ERP5TypeTestCase): ...@@ -2885,7 +2885,7 @@ class Test(ERP5TypeTestCase):
""" """
ret = ERP5TypeTestLoader_loadTestsFromNames(self, *args, **kwargs) ret = ERP5TypeTestLoader_loadTestsFromNames(self, *args, **kwargs)
from Products.ERP5.ERP5Site import getSite from Products.ERP5Type.ERP5Site import getSite
getSite().portal_components.reset(force=True) getSite().portal_components.reset(force=True)
# Simulate a new REQUEST while the old one has been GC'ed # Simulate a new REQUEST while the old one has been GC'ed
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
############################################################################## ##############################################################################
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5.ERP5Site import ERP5Site from Products.ERP5Type.ERP5Site import ERP5Site
from Products import ERP5Security from Products import ERP5Security
from Products.ERP5Type.Base import Base from Products.ERP5Type.Base import Base
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
......
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