Commit f594e1e5 authored by Nicolas Dumazet's avatar Nicolas Dumazet

pull up getSite() call as site will be used before as well


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42816 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 48bf5ad7
...@@ -213,9 +213,11 @@ class PortalTypeMetaClass(GhostBaseMetaClass): ...@@ -213,9 +213,11 @@ class PortalTypeMetaClass(GhostBaseMetaClass):
ERP5Base.aq_method_lock.acquire() ERP5Base.aq_method_lock.acquire()
portal_type = klass.__name__ portal_type = klass.__name__
from Products.ERP5.ERP5Site import getSite
site = getSite()
try: try:
try: try:
class_definition = generatePortalTypeClass(portal_type) class_definition = generatePortalTypeClass(site, portal_type)
except AttributeError: except AttributeError:
LOG("ERP5Type.Dynamic", WARNING, LOG("ERP5Type.Dynamic", WARNING,
"Could not access Portal Type Object for type %r" "Could not access Portal Type Object for type %r"
......
...@@ -129,16 +129,13 @@ core_portal_type_class_dict = { ...@@ -129,16 +129,13 @@ core_portal_type_class_dict = {
'generating': False} 'generating': False}
} }
def generatePortalTypeClass(portal_type_name): def generatePortalTypeClass(site, portal_type_name):
""" """
Given a portal type, look up in Types Tool the corresponding Given a portal type, look up in Types Tool the corresponding
Base Type object holding the definition of this portal type, Base Type object holding the definition of this portal type,
and computes __bases__ and __dict__ for the class that will and computes __bases__ and __dict__ for the class that will
be created to represent this portal type be created to represent this portal type
""" """
from Products.ERP5.ERP5Site import getSite
site = getSite()
# LOG("ERP5Type.dynamic", INFO, "Loading portal type " + portal_type_name) # LOG("ERP5Type.dynamic", INFO, "Loading portal type " + portal_type_name)
global core_portal_type_class_dict global core_portal_type_class_dict
......
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