Commit 30acf114 authored by Nicolas Dumazet's avatar Nicolas Dumazet

meta_type of the form 'ERP5 ' + portal_type_name to portal type classes

This allows us to delay even more the point when Zope forcibly unghosts
objects.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@42398 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 2be6d19f
...@@ -50,6 +50,8 @@ class GhostBaseMetaClass(ExtensionClass): ...@@ -50,6 +50,8 @@ class GhostBaseMetaClass(ExtensionClass):
Because __bases__ is changed, the behavior of this object Because __bases__ is changed, the behavior of this object
will change after the first call. will change after the first call.
""" """
if attr == 'meta_type':
return cls.meta_type
# Class must be loaded if '__of__' is requested because otherwise, # Class must be loaded if '__of__' is requested because otherwise,
# next call to __getattribute__ would lose any acquisition wrapper. # next call to __getattribute__ would lose any acquisition wrapper.
if attr in ('__class__', if attr in ('__class__',
...@@ -154,6 +156,7 @@ class PortalTypeMetaClass(GhostBaseMetaClass): ...@@ -154,6 +156,7 @@ class PortalTypeMetaClass(GhostBaseMetaClass):
if attr not in ('__module__', if attr not in ('__module__',
'__doc__', '__doc__',
'__isghost__', '__isghost__',
'meta_type',
'portal_type'): 'portal_type'):
delattr(cls, attr) delattr(cls, attr)
# generate a ghostbase that derives from all previous bases # generate a ghostbase that derives from all previous bases
...@@ -229,4 +232,5 @@ class PortalTypeMetaClass(GhostBaseMetaClass): ...@@ -229,4 +232,5 @@ class PortalTypeMetaClass(GhostBaseMetaClass):
def generateLazyPortalTypeClass(portal_type_name): def generateLazyPortalTypeClass(portal_type_name):
return PortalTypeMetaClass(portal_type_name, return PortalTypeMetaClass(portal_type_name,
(InitGhostBase,), (InitGhostBase,),
dict(portal_type=portal_type_name)) dict(portal_type=portal_type_name,
meta_type='ERP5 %s' % portal_type_name))
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