Commit d1a0f4aa authored by Jean-Paul Smets's avatar Jean-Paul Smets

updated for aq_dynamic code generation


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1317 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent d3e6ed38
......@@ -30,16 +30,11 @@
and extended local roles management
"""
# First import the minimal number of packages required by the code generation
from Products.ERP5Type.InitGenerator import generateInitFiles
import sys
# Update the self generated code for Document, PropertySheet and Interface
this_module = sys.modules[ __name__ ]
document_classes = generateInitFiles(this_module, globals())
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
import sys, Permissions
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions)
# Finish installation
def initialize( context ):
......
from CategoryCore import CategoryCore
from BaseCategory import BaseCategory
\ No newline at end of file
......@@ -30,22 +30,11 @@
in the CMF. It is based on the ERP5Type RAD
"""
# First import the minimal number of packages required by the code generation
from Products.ERP5Type.InitGenerator import generateInitFiles
import sys
# Update the self generated code for Document, PropertySheet and Interface
this_module = sys.modules[ __name__ ]
document_classes = generateInitFiles(this_module, globals())
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
import Interface, PropertySheet, Permissions, Constraint
updateGlobals( this_module, globals(),
property_sheet_module = PropertySheet,
interface_module = Interface,
permissions_module = Permissions,
constraint_module = Constraint)
import sys, Permissions
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions)
# Define object classes and tools
import Category, CategoryTool
......
......@@ -29,22 +29,11 @@
ERP5 Free Software ERP
"""
# First import the minimal number of packages required by the code generation
from Products.ERP5Type.InitGenerator import generateInitFiles
import sys
# Update the self generated code for Document, PropertySheet and Interface
this_module = sys.modules[ __name__ ]
document_classes = generateInitFiles(this_module, globals())
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
import Interface, PropertySheet, Permissions, Constraint
updateGlobals( this_module, globals(),
property_sheet_module = PropertySheet,
interface_module = Interface,
permissions_module = Permissions,
constraint_module = Constraint)
import sys, Permissions
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions)
# Define object classes and tools
object_classes = ()
......
from Coordinate import Coordinate
from Entity import Entity
from Predicate import Predicate
from Variated import Variated
\ No newline at end of file
......@@ -29,25 +29,14 @@
ERP5 Free Software ERP
"""
# First import the minimal number of packages required by the code generation
from Products.ERP5Type.InitGenerator import generateInitFiles
import sys
# Update the self generated code for Document, PropertySheet and Interface
this_module = sys.modules[ __name__ ]
document_classes = generateInitFiles(this_module, globals())
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
import Interface, PropertySheet, Permissions, Constraint
updateGlobals( this_module, globals(),
property_sheet_module = PropertySheet,
interface_module = Interface,
permissions_module = Permissions,
constraint_module = Constraint)
import sys, Permissions
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions)
# Define object classes and tools
from Tool import Category, CategoryTool, SimulationTool, RuleTool, IdTool, TemplateTool, TestTool
from Tool import Category, CategoryTool, SimulationTool, RuleTool, IdTool, TemplateTool, TestTool, DomainTool
import ERP5Site
object_classes = ( Category.Category,
Category.BaseCategory,
......@@ -58,6 +47,7 @@ portal_tools = ( CategoryTool.CategoryTool,
RuleTool.RuleTool,
IdTool.IdTool,
TemplateTool.TemplateTool,
DomainTool.DomainTool,
TestTool.TestTool
)
content_classes = ()
......@@ -69,6 +59,8 @@ from InteractionWorkflow import InteractionWorkflowDefinition
# Finish installation
def initialize( context ):
import Document
from zLOG import LOG
LOG('In ERP5 initialize', 0, '')
initializeProduct(context, this_module, globals(),
document_module = Document,
document_classes = document_classes,
......
......@@ -30,16 +30,11 @@
and extended local roles management
"""
# First import the minimal number of packages required by the code generation
from Products.ERP5Type.InitGenerator import generateInitFiles
import sys
# Update the self generated code for Document, PropertySheet and Interface
this_module = sys.modules[ __name__ ]
document_classes = generateInitFiles(this_module, globals())
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
import sys, Permissions
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions)
# Define object classes and tools
import CatalogTool
......
......@@ -3,6 +3,7 @@ import Products.ERP5
import Products.ERP5.XML
import Products.ERP5.UI
import Products.ERP5.Document
import Products.ERP5.Document.SaleOpportunity
import Products.ERP5Catalog
import Products.ERP5Form
import Products.ERP5SyncML
......
......@@ -30,19 +30,11 @@
with Zope
"""
# First import the minimal number of packages required by the code generation
from Products.ERP5Type.InitGenerator import generateInitFiles
import sys
# Update the self generated code for Document, PropertySheet and Interface
this_module = sys.modules[ __name__ ]
document_classes = generateInitFiles(this_module, globals())
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
import Permissions
updateGlobals( this_module, globals(),
permissions_module = Permissions)
import sys, Permissions
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions)
# Define object classes and tools
import Form, FSForm, ListBox, MatrixBox, SelectionTool, ZGDChart, PDFTemplate
......
......@@ -29,22 +29,11 @@
ERP5Shop Free ERP + eCommerce
"""
# First import the minimal number of packages required by the code generation
from Products.ERP5Type.InitGenerator import generateInitFiles
import sys
# Update the self generated code for Document, PropertySheet and Interface
this_module = sys.modules[ __name__ ]
document_classes = generateInitFiles(this_module, globals())
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
import Interface, PropertySheet, Permissions, Constraint
updateGlobals( this_module, globals(),
property_sheet_module = PropertySheet,
interface_module = Interface,
permissions_module = Permissions,
constraint_module = Constraint)
import sys, Permissions
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions)
# Define object classes and tools
import ShopManager
......
......@@ -30,24 +30,11 @@
and extended local roles management
"""
# First import the minimal number of packages required by the code generation
from Products.ERP5Type.InitGenerator import generateInitFiles
import sys
# Update the self generated code for Document, PropertySheet and Interface
this_module = sys.modules[ __name__ ]
document_classes = generateInitFiles(this_module, globals())
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
import Interface, PropertySheet, Permissions, Constraint
updateGlobals( this_module, globals(),
property_sheet_module = PropertySheet,
interface_module = Interface,
permissions_module = Permissions,
constraint_module = Constraint)
import sys, Permissions
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions)
# Define object classes and tools
import SynchronizationTool
......
......@@ -65,8 +65,17 @@ import random
from zLOG import LOG
class CallbaseError(AttributeError):
pass
# Dynamic method acquisition system (code generation)
aq_method_generated = {}
def _initializeDefaultProperties(klass):
if not aq_method_generated.has_key(klass):
LOG('in aq_method_generated %s' % id, 0, str(klass.__name__))
from Utils import initializeDefaultProperties
initializeDefaultProperties([klass])
aq_method_generated[klass] = 1
for super_klass in klass.__bases__:
_initializeDefaultProperties(super_klass)
class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyManager ):
"""
......@@ -114,6 +123,14 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
# We want to use a default property view
manage_propertiesForm = DTMLFile( 'dtml/properties', _dtmldir )
def _aq_dynamic(self, id):
global aq_method_generated
klass = self.__class__
if not aq_method_generated.has_key(klass):
_initializeDefaultProperties(klass)
return getattr(self, id)
return None
# Constructor
def __init__(self, id, uid=None, rid=None, sid=None, **kw):
self.id = id
......
......@@ -38,9 +38,8 @@ product_document_registry = []
def InitializeDocument(document_class, document_path=None):
global product_document_registry
InitializeClass(document_class)
# Register class in ERP5Type.Document
product_document_registry.append(((document_class.__name__, document_path)))
product_document_registry.append(((document_class, document_path)))
#LOG('InitializeDocument', 0, document_class.__name__)
def initializeProductDocumentRegistry():
......@@ -52,162 +51,3 @@ def initializeProductDocumentRegistry():
#LOG('Added product document to ERP5Type repository: %s (%s)' % (class_id, document_path), 0, '')
#print 'Added product document to ERP5Type repository: %s (%s)' % (class_id, document_path)
# Code Generation of __init__.py files
def generateInitFiles(this_module, global_hook,
generate_document=1, generate_property_sheet=1, generate_constraint=1, generate_interface=1):
# Determine product_path
product_path = package_home( global_hook )
# Add _dtmldir
this_module._dtmldir = os.path.join( product_path, 'dtml' )
# This regular expression is used to check is a file is a python file
python_file_expr = re.compile("py$")
# Create Document __init__.py file
document_path = product_path + '/Document'
document_module_name_list = []
document_module_lines = ["from Products.ERP5Type import Document as ERP5TypeDocumentRepository\n\n"]
try:
file_list = os.listdir(document_path)
for file_name in file_list:
if file_name != '__init__.py':
if python_file_expr.search(file_name,1):
module_name = file_name[0:-3]
document_module_name_list += [module_name]
document_module_lines += ["""\
# Hide internal implementation
from Products.ERP5Type.InitGenerator import InitializeDocument
import %s as ERP5%s
if not hasattr(ERP5TypeDocumentRepository, '_override_%s'): ERP5TypeDocumentRepository.%s = ERP5%s # Never override a local Document class
# Default constructor for %s
# Can be overriden by adding a method add%s in class %s
def add%s(folder, id, REQUEST=None, **kw):
o = ERP5TypeDocumentRepository.%s.%s(id)
folder._setObject(id, o)
o.uid = folder.portal_catalog.newUid()
if kw is not None: o.__of__(folder)._edit(force_update=1, **kw)
# contentCreate already calls reindex 3 times ...
# o.reindexObject()
if REQUEST is not None:
REQUEST['RESPONSE'].redirect( 'manage_main' )
InitializeDocument(ERP5TypeDocumentRepository.%s.%s, document_path='%s')
class Temp%s(ERP5TypeDocumentRepository.%s.%s):
isIndexable = 0
def reindexObject(self, *args, **kw):
pass
def recursiveReindexObject(self, *args, **kw):
pass
def activate(self):
return self
def setUid(self, value):
self.uid = value # Make sure no casting happens when we use Temp classes to create new objects
from Products.PythonScripts.Utility import allow_class
allow_class(Temp%s)
def newTemp%s(folder, id, REQUEST=None, **kw):
o = Temp%s(id)
o = o.__of__(folder)
if kw is not None: o._edit(force_update=1, **kw)
return o
ERP5TypeDocumentRepository.newTemp%s = newTemp%s
from AccessControl import ModuleSecurityInfo
ModuleSecurityInfo('Products.ERP5Type.Document').declarePublic('newTemp%s',)
""" % (module_name, module_name,
module_name, module_name, module_name,
module_name,
module_name, module_name,
module_name,
module_name, module_name,
module_name, module_name, document_path,
module_name, module_name, module_name,
module_name,
module_name,
module_name,
module_name, module_name,
module_name,)]
if generate_document:
try:
document_init_file = open(document_path + '/__init__.py', 'w')
document_init_file.write(string.join(document_module_lines, '\n'))
document_init_file.close()
except:
LOG('ERP5Type:',0,'Could not write Document __init__.py files for %s' % product_path)
except:
LOG('ERP5Type:',0,'No Document directory in %s' % product_path)
# Create Property __init__.py file
property_path = product_path + '/PropertySheet'
property_module_name_list = []
property_module_lines = []
try:
file_list = os.listdir(property_path)
for file_name in file_list:
if file_name != '__init__.py':
if python_file_expr.search(file_name,1):
module_name = file_name[0:-3]
property_module_name_list += [module_name]
property_module_lines += ['from %s import %s' % (module_name, module_name)]
if generate_property_sheet:
try:
property_init_file = open(property_path + '/__init__.py', 'w')
property_init_file.write(string.join(property_module_lines, '\n'))
property_init_file.close()
except:
LOG('ERP5Type:',0,'Could not write PropertySheet __init__.py files for %s' % product_path)
except:
LOG('ERP5Type:',0,'No PropertySheet directory in %s' % product_path)
# Create Interface __init__.py file
interface_path = product_path + '/Interface'
interface_module_name_list = []
interface_module_lines = []
try:
file_list = os.listdir(interface_path)
for file_name in file_list:
if file_name != '__init__.py':
if python_file_expr.search(file_name,1):
module_name = file_name[0:-3]
interface_module_name_list += [module_name]
interface_module_lines += ['from %s import %s' % (module_name, module_name)]
if generate_interface:
try:
interface_init_file = open(interface_path + '/__init__.py', 'w')
interface_init_file.write(string.join(interface_module_lines, '\n'))
interface_init_file.close()
except:
LOG('ERP5Type:',0,'Could not write Interface __init__.py files for %s' % product_path)
except:
LOG('ERP5Type:',0,'No Interface directory in %s' % product_path)
# Create Constraint __init__.py file
constraint_path = product_path + '/Constraint'
constraint_module_name_list = []
constraint_module_lines = []
try:
file_list = os.listdir(constraint_path)
for file_name in file_list:
if file_name != '__init__.py':
if python_file_expr.search(file_name,1):
module_name = file_name[0:-3]
constraint_module_name_list += [module_name]
constraint_module_lines += ['from %s import %s' % (module_name, module_name)]
if generate_constraint:
try:
constraint_init_file = open(constraint_path + '/__init__.py', 'w')
constraint_init_file.write(string.join(constraint_module_lines, '\n'))
constraint_init_file.close()
except:
LOG('ERP5Type:',0,'Could not write Constraint __init__.py files for %s' % product_path)
except:
LOG('ERP5Type:',0,'No Constraint directory in %s' % product_path)
return document_module_name_list
from Base import Base
from XMLObject import XMLObject
from SimpleItem import SimpleItem
from DublinCore import DublinCore
from Folder import Folder
from SimpleItem import SimpleItem
from XMLObject import XMLObject
\ No newline at end of file
......@@ -40,12 +40,6 @@ from Products.ERP5Type import Constraint
from Products.ERP5Type import Interface
from Products.ERP5Type import PropertySheet
# This is really uggly... and we want to improve it
import Products.ERP5Type.Constraint.CategoryMembershipArity
import Products.ERP5Type.Constraint.AttributeEquality
import Products.ERP5Type.Constraint.PropertyTypeValidity
import Products.ERP5Type.Constraint.CategoryRelatedMembershipArity
from zLOG import LOG
#####################################################
......@@ -149,31 +143,54 @@ def getPath(o):
# Globals initialization
#####################################################
from InitGenerator import InitializeDocument
# List Regexp
python_file_expr = re.compile("py$")
def getModuleIdList(product_path, module_id):
global python_file_expr
path = os.path.join(product_path, module_id)
module_name_list = []
module_lines = []
try:
file_list = os.listdir(path)
for file_name in file_list:
if file_name != '__init__.py':
if python_file_expr.search(file_name,1):
module_name = file_name[0:-3]
module_name_list += [module_name]
except:
LOG('ERP5Type:',0,'No PropertySheet directory in %s' % product_path)
return path, module_name_list
# EPR5Type global modules update
def updateGlobals( this_module, global_hook,
property_sheet_module = None,
interface_module = None,
permissions_module = None,
constraint_module = None):
def updateGlobals( this_module, global_hook, permissions_module = None, is_erp5_type=0):
"""
This function does all the initialization steps required
for a Zope / CMF Product
"""
product_name = this_module.__name__.split('.')[-1]
# Update PropertySheet
if property_sheet_module is not None:
for key in dir(property_sheet_module):
# Do not consider private keys
if key[0:2] != '__':
setattr(PropertySheet, key, getattr(property_sheet_module, key))
# Update Interface
if interface_module is not None:
for key in dir(interface_module):
# Do not consider private keys
if key[0:2] != '__':
setattr(Interface, key, getattr(interface_module, key))
product_path = package_home( global_hook )
if not is_erp5_type:
# Add _dtmldir
this_module._dtmldir = os.path.join( product_path, 'dtml' )
# Update PropertySheet Registry
for module_id in ('PropertySheet', 'Interface', 'Constraint', ):
path, module_id_list = getModuleIdList(product_path, module_id)
print path
print module_id_list
if module_id == 'PropertySheet':
import_method = importLocalPropertySheet
elif module_id == 'Interface':
import_method = importLocalInterface
elif module_id == 'Constraint':
import_method = importLocalConstraint
else:
import_method = None
for module_id in module_id_list:
import_method(module_id, path=path)
# Update Permissions
if permissions_module is not None:
......@@ -182,14 +199,11 @@ def updateGlobals( this_module, global_hook,
if key[0:2] != '__':
setattr(Permissions, key, getattr(permissions_module, key))
# Update Constraint
if constraint_module is not None:
for key in dir(constraint_module):
# Do not consider private keys
if key[0:2] != '__':
setattr(Constraint, key, getattr(constraint_module, key))
# Return document_class list
path, module_id_list = getModuleIdList(product_path, 'Document')
for document in module_id_list:
InitializeDocument(document, document_path=path)
return module_id_list
#####################################################
# Modules Import
......@@ -255,10 +269,9 @@ def writeLocalPropertySheet(class_id, text):
f = open(path, 'w')
f.write(text)
def importLocalPropertySheet(class_id):
def importLocalPropertySheet(class_id, path = None):
import Products.ERP5Type.PropertySheet
import Permissions
import Products
if path is None:
instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "PropertySheet")
path = os.path.join(path, "%s.py" % class_id)
......@@ -266,6 +279,26 @@ def importLocalPropertySheet(class_id):
module = imp.load_source(class_id, path, f)
setattr(Products.ERP5Type.PropertySheet, class_id, getattr(module, class_id))
def importLocalInterface(class_id, path = None):
import Products.ERP5Type.Interface
if path is None:
instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "Interface")
path = os.path.join(path, "%s.py" % class_id)
f = open(path)
module = imp.load_source(class_id, path, f)
setattr(Products.ERP5Type.Interface, class_id, getattr(module, class_id))
def importLocalConstraint(class_id, path = None):
import Products.ERP5Type.Interface
if path is None:
instance_home = getConfiguration().instancehome
path = os.path.join(instance_home, "Constraint")
path = os.path.join(path, "%s.py" % class_id)
f = open(path)
module = imp.load_source(class_id, path, f)
setattr(Products.ERP5Type.Constraint, class_id, getattr(module, class_id))
def getLocalExtensionList():
if not getConfiguration: return []
instance_home = getConfiguration().instancehome
......@@ -387,12 +420,11 @@ def importLocalDocument(class_id, document_path = None):
document_constructor_name = "add%s" % class_id
document_constructor.__name__ = document_constructor_name
default_permission = ('Manager',)
document_constructor.__roles__=None # XXX This is a security breach which needs to be fixed
setattr(Products.ERP5Type.Document, class_id, document_module)
setattr(Products.ERP5Type.Document, document_constructor_name, document_constructor)
setDefaultClassProperties(document_class)
pr=PermissionRole(document_class.add_permission, default_permission)
initializeDefaultProperties([document_class])
document_constructor.__roles__ = pr # There used to be security breach which was fixed (None replaced by pr)
InitializeClass(document_class)
# Update Meta Types
new_meta_types = []
......@@ -454,7 +486,7 @@ def initializeLocalDocumentRegistry():
LOG('Added local document to ERP5Type repository: %s (%s)' % (module_name, document_path),0,'')
print 'Added local document to ERP5Type repository: %s (%s)' % (module_name, document_path)
except:
LOG('Failed to add local document to ERP5Type repository: %s (%s)' % (module_name, document_path) % (module_name, document_path),0,'')
LOG('Failed to add local document to ERP5Type repository: %s (%s)' % (module_name, document_path),0,'')
print 'Failed to add local document to ERP5Type repository: %s (%s)' % (module_name, document_path)
#####################################################
......@@ -479,7 +511,8 @@ def initializeProduct( context, this_module, global_hook,
# Define content classes from document_classes
#LOG('Begin initializeProduct %s %s' % (document_module, document_classes),0,'')
extra_content_classes = []
if document_module is not None:
#if document_module is not None:
if 0:
for module_name in document_classes:
#LOG('Inspecting %s %s' % (document_module, module_name),0,'')
candidate = getattr(document_module, module_name)
......@@ -491,11 +524,12 @@ def initializeProduct( context, this_module, global_hook,
# Initialize Default Properties and Constructors for RAD classes
if INITIALIZE_PRODUCT_RAD:
initializeDefaultProperties(content_classes)
initializeDefaultProperties(extra_content_classes)
#initializeDefaultProperties(content_classes)
#initializeDefaultProperties(extra_content_classes)
initializeDefaultProperties(object_classes)
#initializeDefaultConstructors(content_classes) Does not work yet
# Define content constructors for Document content classes (RAD)
extra_content_constructors = []
for content_class in extra_content_classes:
......@@ -667,7 +701,7 @@ def setDefaultProperties(klass):
createCategoryAccessors(klass, cat)
createValueAccessors(klass, cat)
# Create the constraint method list - always check type
klass.constraints = [Products.ERP5Type.Constraint.PropertyTypeValidity(id='type_check')]
klass.constraints = [Constraint.PropertyTypeValidity(id='type_check')]
for const in constraint_list:
createConstraintList(klass, constraint_definition=const)
# ERP5 _properties and Zope _properties are somehow different
......
......@@ -30,18 +30,14 @@
All ERP5 classes derive from ERP5Type
"""
# First import the minimal number of packages required by the code generation
from Products.ERP5Type.InitGenerator import generateInitFiles
import sys
# Update the self generated code for Document, PropertySheet and Interface
# Update ERP5 Globals
import sys, Permissions, os
from Globals import package_home
this_module = sys.modules[ __name__ ]
document_classes = generateInitFiles(this_module, globals(), generate_document=0)
# Import rest of the code and finish installation
from Products.ERP5Type.Utils import initializeProduct, initializeLocalDocumentRegistry
import Interface, PropertySheet, ZopePatch, StateChangeInfoPatch, \
CMFCorePatch
product_path = package_home( globals() )
this_module._dtmldir = os.path.join( product_path, 'dtml' )
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions, is_erp5_type = 1)
def initialize( context ):
# Import Product Components
......@@ -61,9 +57,17 @@ def initialize( context ):
portal_tools = portal_tools,
content_constructors = content_constructors,
content_classes = content_classes)
# We should register local classes at some point
# # We should register interface classes at some point
# from Products.ERP5Type.InitGenerator import initializeProductInterfaceRegistry
# initializeProductInterfaceRegistry()
# # We should register property sheet classes at some point
# from Products.ERP5Type.InitGenerator import initializeProductPropertySheetRegistry
# initializeProductPropertySheetRegistry()
# We should register product classes at some point
from Products.ERP5Type.InitGenerator import initializeProductDocumentRegistry
initializeProductDocumentRegistry()
# We should register local classes at some point
from Products.ERP5Type.Utils import initializeLocalDocumentRegistry
initializeLocalDocumentRegistry()
from AccessControl.SecurityInfo import allow_module
......
......@@ -29,22 +29,11 @@
ERP5 Free Software ERP
"""
# First import the minimal number of packages required by the code generation
from Products.ERP5Type.InitGenerator import generateInitFiles
import sys
# Update the self generated code for Document, PropertySheet and Interface
this_module = sys.modules[ __name__ ]
document_classes = generateInitFiles(this_module, globals())
# Update ERP5 Globals
from Products.ERP5Type.Utils import initializeProduct, updateGlobals
import Interface, PropertySheet, Permissions, Constraint
updateGlobals( this_module, globals(),
property_sheet_module = PropertySheet,
interface_module = Interface,
permissions_module = Permissions,
constraint_module = Constraint)
import sys, Permissions
this_module = sys.modules[ __name__ ]
document_classes = updateGlobals( this_module, globals(), permissions_module = Permissions)
# Define object classes and tools
object_classes = ()
......
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