Commit ce63a28b authored by Jim Fulton's avatar Jim Fulton

Added a ZClass registry, initially for use with SQL methods.

.
parent c221df67
...@@ -355,8 +355,8 @@ class ZClass(OFS.SimpleItem.SimpleItem): ...@@ -355,8 +355,8 @@ class ZClass(OFS.SimpleItem.SimpleItem):
def _register(self): def _register(self):
if not dbVersionEquals('3'):
return # Register the global id of the managed class:
z=self._zclass_ z=self._zclass_
class_id=z.__module__ class_id=z.__module__
if not class_id: return if not class_id: return
...@@ -368,15 +368,31 @@ class ZClass(OFS.SimpleItem.SimpleItem): ...@@ -368,15 +368,31 @@ class ZClass(OFS.SimpleItem.SimpleItem):
globals[class_id]=z globals[class_id]=z
# Register self as a ZClass:
self.aq_acquire('_manage_add_product_data')(
'zclasses',
product=self.aq_inner.aq_parent.id,
id=self.id,
meta_type=z.meta_type or '',
meta_class=self,
)
def _unregister(self): def _unregister(self):
if not dbVersionEquals('3'):
return # Unregister the global id of the managed class:
class_id=self._zclass_.__module__ class_id=self._zclass_.__module__
if not class_id: return if not class_id: return
globals=self._p_jar.root()['ZGlobals'] globals=self._p_jar.root()['ZGlobals']
if globals.has_key(class_id): if globals.has_key(class_id):
del globals[class_id] del globals[class_id]
# Unregister self as a ZClass:
self.aq_acquire('_manage_remove_product_data')(
'zclasses',
product=self.aq_inner.aq_parent.id,
id=self.id,
)
def manage_afterClone(self, item): def manage_afterClone(self, item):
self.setClassAttr('__module__', None) self.setClassAttr('__module__', None)
self.propertysheets.methods.manage_afterClone(item) self.propertysheets.methods.manage_afterClone(item)
......
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