Commit 0a4ef9a5 authored by Jim Fulton's avatar Jim Fulton

Changed to support new Python product registry mechanism

parent 1bbe1e06
......@@ -124,5 +124,5 @@ class FactoryDispatcher(Acquisition.Implicit):
return d[name]
raise AttributeError, name
# Provide acquired indicators for critical OM methods:
_setObject=Acquisition.Acquired
......@@ -143,7 +143,10 @@ class ProductFolder(Folder):
return self.manage_main(self,REQUEST,update_menu=1)
def _delObject(self,id):
for factory in getattr(self, id)._factories(): factory._unregister()
try:
for factory in getattr(self, id)._factories():
factory._unregister()
except: pass
ProductFolder.inheritedAttribute('_delObject')(self, id)
def _canCopy(self, op=0):
......
......@@ -111,14 +111,25 @@ class ProductRegistry:
mt['name']!=nmt,
self._product_meta_types)
def _manage_add_product_meta_type(self, product, id, meta_type):
if filter(lambda mt, nmt=meta_type:
mt['name']==nmt,
self.all_meta_types()):
raise 'Type Exists', (
'The type <em>%s</em> is already defined.')
self._product_meta_types=self._product_meta_types+({
def _manage_add_product_meta_type(self, product, id, meta_type,
permission=''):
pid=product.id
for mt in self._product_meta_types:
if mt['name']==meta_type:
if not mt.has_key('product'): mt['product']=pid
if mt['product'] != pid:
raise 'Type Exists', (
'The type <em>%s</em> is already defined.' % meta_type)
mt['action']='manage_addProduct/%s/%s' % (pid, id)
if permission: mt['permission']=permission
return
mt={
'name': meta_type,
'action': ('manage_addProduct/%s/%s' % (product.id, id)),
},)
'action': ('manage_addProduct/%s/%s' % (pid, id)),
'product': pid
}
if permission: mt['permission']=permission
self._product_meta_types=self._product_meta_types+(mt,)
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