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):
else:
prop_holder.security = ClassSecurityInfo() # Is this OK for security XXX ?
from Utils import initializeDefaultProperties
#LOG('initializeDefaultProperties: %s' % ptype, 0, str(prop_holder.__dict__))
try:
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__))
# We should now make sure workflow methods are defined
# and also make sure simulation state is defined
......@@ -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)])))
for wf in portal_workflow.getWorkflowsFor(self):
wf_id = wf.id
try:
#LOG('in aq_portal_type %s' % id, 0, "found state workflow %s" % wf.id)
if wf.__class__.__name__ in ('DCWorkflowDefinition', ):
# Create state var accessor
......@@ -212,11 +205,6 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0):
setattr(prop_holder, method_id, method) # Attach to portal_type
prop_holder.security.declareProtected( Permissions.AccessContentsInformation, 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)
if wf.__class__.__name__ in ('DCWorkflowDefinition', ):
for tr_id in wf.transitions.objectIds():
......@@ -267,10 +255,6 @@ def initializePortalTypeDynamicProperties(self, klass, ptype, recursive=0):
if not isinstance(method, WorkflowMethod):
method = WorkflowMethod(method, method_id)
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
Base.aq_portal_type[ptype] = prop_holder
......@@ -368,19 +352,12 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
# Generate class methods
if not Base.aq_method_generated.has_key(klass):
try:
initializeClassDynamicProperties(self, klass)
except:
LOG('_aq_dynamic',0,'error in initializeClassDynamicProperties', error=sys.exc_info())
generated = 1
# Generate portal_type methods
if not Base.aq_portal_type.has_key(ptype):
try:
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
# Generate Related Accessors
......@@ -967,6 +944,13 @@ class Base( CopyContainer, PortalContent, ActiveObject, ERP5PropertyManager ):
"""
return self
def getDocumentInstance(self):
"""
Returns self
Returns instance if catehory throughdocument_instance relation
"""
return self
security.declareProtected( Permissions.AccessContentsInformation, 'asParentSqlExpression' )
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