Commit 98d5ec89 authored by Jean-Paul Smets's avatar Jean-Paul Smets

removed dangerous except in aq_dynamic


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@3031 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent c723bf87
...@@ -182,13 +182,7 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0): ...@@ -182,13 +182,7 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0):
else: else:
prop_holder.security = ClassSecurityInfo() # Is this OK for security XXX ? prop_holder.security = ClassSecurityInfo() # Is this OK for security XXX ?
from Utils import initializeDefaultProperties from Utils import initializeDefaultProperties
#LOG('initializeDefaultProperties: %s' % ptype, 0, str(prop_holder.__dict__))
try:
initializeDefaultProperties([prop_holder], object=self) initializeDefaultProperties([prop_holder], object=self)
except:
LOG('Base', ERROR,
'Could not generate default properties on portal type %s.' % ptype,
error=sys.exc_info())
#LOG('initializeDefaultProperties: %s' % ptype, 0, str(prop_holder.__dict__)) #LOG('initializeDefaultProperties: %s' % ptype, 0, str(prop_holder.__dict__))
# We should now make sure workflow methods are defined # We should now make sure workflow methods are defined
# and also make sure simulation state is defined # and also make sure simulation state is defined
...@@ -196,7 +190,6 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0): ...@@ -196,7 +190,6 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0):
#LOG('getWorkflowsFor', 0, str((self, [wf.id for wf in portal_workflow.getWorkflowsFor(self)]))) #LOG('getWorkflowsFor', 0, str((self, [wf.id for wf in portal_workflow.getWorkflowsFor(self)])))
for wf in portal_workflow.getWorkflowsFor(self): for wf in portal_workflow.getWorkflowsFor(self):
wf_id = wf.id wf_id = wf.id
try:
#LOG('in aq_portal_type %s' % id, 0, "found state workflow %s" % wf.id) #LOG('in aq_portal_type %s' % id, 0, "found state workflow %s" % wf.id)
if wf.__class__.__name__ in ('DCWorkflowDefinition', ): if wf.__class__.__name__ in ('DCWorkflowDefinition', ):
# Create state var accessor # Create state var accessor
...@@ -212,11 +205,6 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0): ...@@ -212,11 +205,6 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0):
setattr(prop_holder, method_id, method) # Attach to portal_type setattr(prop_holder, method_id, method) # Attach to portal_type
prop_holder.security.declareProtected( Permissions.AccessContentsInformation, method_id ) prop_holder.security.declareProtected( Permissions.AccessContentsInformation, method_id )
#LOG('in aq_portal_type %s' % id, 0, "added state method %s" % method_id) #LOG('in aq_portal_type %s' % id, 0, "added state method %s" % method_id)
except:
LOG('Base', ERROR,
'Could not generate worklow state method for workflow %s on class %s.' % (wf_id, ptype),
error=sys.exc_info())
try:
#LOG('in aq_portal_type %s' % id, 0, "found transition workflow %s" % wf.id) #LOG('in aq_portal_type %s' % id, 0, "found transition workflow %s" % wf.id)
if wf.__class__.__name__ in ('DCWorkflowDefinition', ): if wf.__class__.__name__ in ('DCWorkflowDefinition', ):
for tr_id in wf.transitions.objectIds(): for tr_id in wf.transitions.objectIds():
...@@ -267,10 +255,6 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0): ...@@ -267,10 +255,6 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0):
if not isinstance(method, WorkflowMethod): if not isinstance(method, WorkflowMethod):
method = WorkflowMethod(method, method_id) method = WorkflowMethod(method, method_id)
setattr(prop_holder, method_id, method) setattr(prop_holder, method_id, method)
except:
LOG('Base', ERROR,
'Could not generate worklow transition methods for workflow %s on class %s.' % (wf_id, klass),
error=sys.exc_info())
# We can now associate it # We can now associate it
Base.aq_portal_type[ptype] = prop_holder Base.aq_portal_type[ptype] = prop_holder
...@@ -368,19 +352,12 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -368,19 +352,12 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
# Generate class methods # Generate class methods
if not Base.aq_method_generated.has_key(klass): if not Base.aq_method_generated.has_key(klass):
try:
initializeClassDynamicProperties(self, klass) initializeClassDynamicProperties(self, klass)
except:
LOG('_aq_dynamic',0,'error in initializeClassDynamicProperties', error=sys.exc_info())
generated = 1 generated = 1
# Generate portal_type methods # Generate portal_type methods
if not Base.aq_portal_type.has_key(ptype): if not Base.aq_portal_type.has_key(ptype):
try:
initializePortalTypeDynamicProperties(self, klass, ptype) initializePortalTypeDynamicProperties(self, klass, ptype)
#LOG('_aq_dynamic for %s' % ptype,0, aq_portal_type[ptype].__dict__.keys())
except:
LOG('_aq_dynamic',0,'error in initializePortalTypeDynamicProperties', error=sys.exc_info())
generated = 1 generated = 1
# Generate Related Accessors # Generate Related Accessors
...@@ -967,6 +944,13 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ): ...@@ -967,6 +944,13 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
""" """
return self return self
def getDocumentInstance(self):
"""
Returns self
Returns instance if catehory throughdocument_instance relation
"""
return self
security.declareProtected( Permissions.AccessContentsInformation, 'asParentSqlExpression' ) security.declareProtected( Permissions.AccessContentsInformation, 'asParentSqlExpression' )
def getParentSqlExpression(self, table = 'catalog', strict_membership = 0): def getParentSqlExpression(self, table = 'catalog', strict_membership = 0):
""" """
......
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