Commit b809873b authored by Yoshinori Okuji's avatar Yoshinori Okuji

Remove getObjectMenu, because it is not used at all.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@1386 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent bbd544a3
...@@ -77,26 +77,26 @@ def initializeDynamicProperties(self, klass): ...@@ -77,26 +77,26 @@ def initializeDynamicProperties(self, klass):
id = '' id = ''
LOG('before aq_method_generated %s' % id, 0, str(klass.__name__)) LOG('before aq_method_generated %s' % id, 0, str(klass.__name__))
if not aq_method_generated.has_key(klass): if not aq_method_generated.has_key(klass):
aq_method_generated[klass] = 1 aq_method_generated[klass] = 1
# Recurse to superclasses # Recurse to superclasses
for super_klass in klass.__bases__: for super_klass in klass.__bases__:
if getattr(super_klass, 'isRADContent', 0): initializeDynamicProperties(None, super_klass) if getattr(super_klass, 'isRADContent', 0): initializeDynamicProperties(None, super_klass)
# Initialize default properties # Initialize default properties
LOG('in aq_method_generated %s' % id, 0, str(klass.__name__)) LOG('in aq_method_generated %s' % id, 0, str(klass.__name__))
from Utils import initializeDefaultProperties from Utils import initializeDefaultProperties
initializeDefaultProperties([klass]) initializeDefaultProperties([klass])
if self is not None: if self is not None:
# 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
portal_workflow = getToolByName(self, 'portal_workflow') portal_workflow = getToolByName(self, 'portal_workflow')
for wf in portal_workflow.getWorkflowsFor(self): for wf in portal_workflow.getWorkflowsFor(self):
wf_id = wf.id wf_id = wf.id
try: try:
#LOG('in aq_method_generated %s' % id, 0, "found state workflow %s" % wf.id) #LOG('in aq_method_generated %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
state_var = wf.variables.getStateVar() state_var = wf.variables.getStateVar()
method_id = 'get%s' % UpperCase(state_var) method_id = 'get%s' % UpperCase(state_var)
if not hasattr(klass, method_id): if not hasattr(klass, method_id):
method = WorkflowState.Getter(method_id, wf_id) method = WorkflowState.Getter(method_id, wf_id)
setattr(klass, method_id, method) setattr(klass, method_id, method)
...@@ -105,17 +105,17 @@ def initializeDynamicProperties(self, klass): ...@@ -105,17 +105,17 @@ def initializeDynamicProperties(self, klass):
except: except:
LOG('Base', ERROR, LOG('Base', ERROR,
'Could not generate worklow state method for workflow %s on class %s.' % (wf_id, klass), 'Could not generate worklow state method for workflow %s on class %s.' % (wf_id, klass),
error=sys.exc_info()) error=sys.exc_info())
try: try:
LOG('in aq_method_generated %s' % id, 0, "found transition workflow %s" % wf.id) LOG('in aq_method_generated %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():
tdef = wf.transitions.get(tr_id, None) tdef = wf.transitions.get(tr_id, None)
if tdef.trigger_type == TRIGGER_WORKFLOW_METHOD: if tdef.trigger_type == TRIGGER_WORKFLOW_METHOD:
method_id = convertToMixedCase(tr_id) method_id = convertToMixedCase(tr_id)
if not hasattr(klass, method_id): if not hasattr(klass, method_id):
method = WorkflowMethod(klass._doNothing, method_id) method = WorkflowMethod(klass._doNothing, method_id)
setattr(klass, method_id, method) setattr(klass, method_id, method)
klass.security.declareProtected( Permissions.AccessContentsInformation, method_id ) klass.security.declareProtected( Permissions.AccessContentsInformation, method_id )
#LOG('in aq_method_generated %s' % id, 0, "added transition method %s" % method_id) #LOG('in aq_method_generated %s' % id, 0, "added transition method %s" % method_id)
else: else:
...@@ -123,16 +123,16 @@ def initializeDynamicProperties(self, klass): ...@@ -123,16 +123,16 @@ def initializeDynamicProperties(self, klass):
method = getattr(klass, method_id) method = getattr(klass, method_id)
if callable(method): if callable(method):
if not isinstance(method, WorkflowMethod): if not isinstance(method, WorkflowMethod):
setattr(klass, method_id, WorkflowMethod(method)) setattr(klass, method_id, WorkflowMethod(method))
elif wf.__class__.__name__ in ('InteractionWorkflowDefinition', ): elif wf.__class__.__name__ in ('InteractionWorkflowDefinition', ):
for tr_id in wf.interactions.objectIds(): for tr_id in wf.interactions.objectIds():
tdef = wf.interactions.get(tr_id, None) tdef = wf.interactions.get(tr_id, None)
if tdef.trigger_type == TRIGGER_WORKFLOW_METHOD: if tdef.trigger_type == TRIGGER_WORKFLOW_METHOD:
for imethod_id in tdef.method_id: for imethod_id in tdef.method_id:
method_id = convertToMixedCase(imethod_id) method_id = convertToMixedCase(imethod_id)
if not hasattr(klass, method_id): if not hasattr(klass, method_id):
method = WorkflowMethod(klass._doNothing, method_id) method = WorkflowMethod(klass._doNothing, method_id)
setattr(klass, method_id, method) setattr(klass, method_id, method)
klass.security.declareProtected( Permissions.AccessContentsInformation, method_id ) klass.security.declareProtected( Permissions.AccessContentsInformation, method_id )
#LOG('in aq_method_generated %s' % id, 0, "added interaction method %s" % method_id) #LOG('in aq_method_generated %s' % id, 0, "added interaction method %s" % method_id)
else: else:
...@@ -140,14 +140,14 @@ def initializeDynamicProperties(self, klass): ...@@ -140,14 +140,14 @@ def initializeDynamicProperties(self, klass):
method = getattr(klass, method_id) method = getattr(klass, method_id)
if callable(method): if callable(method):
if not isinstance(method, WorkflowMethod): if not isinstance(method, WorkflowMethod):
setattr(klass, method_id, WorkflowMethod(method)) setattr(klass, method_id, WorkflowMethod(method))
except: except:
LOG('Base', ERROR, LOG('Base', ERROR,
'Could not generate worklow transition methods for workflow %s on class %s.' % (wf_id, klass), 'Could not generate worklow transition methods for workflow %s on class %s.' % (wf_id, klass),
error=sys.exc_info()) error=sys.exc_info())
# Mark as generated # Mark as generated
aq_method_generated[klass] = 1 aq_method_generated[klass] = 1
class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyManager ): class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyManager ):
""" """
This is the base class for all ERP5 Zope objects. This is the base class for all ERP5 Zope objects.
...@@ -199,15 +199,15 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -199,15 +199,15 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
""" """
""" """
initializeDynamicProperties(self, self.__class__) initializeDynamicProperties(self, self.__class__)
def _aq_dynamic(self, id): def _aq_dynamic(self, id):
global aq_method_generated global aq_method_generated
klass = self.__class__ klass = self.__class__
if not aq_method_generated.has_key(klass): if not aq_method_generated.has_key(klass):
initializeDynamicProperties(self, klass) initializeDynamicProperties(self, klass)
return getattr(self, id) return getattr(self, id)
return None return None
# Constructor # Constructor
def __init__(self, id, uid=None, rid=None, sid=None, **kw): def __init__(self, id, uid=None, rid=None, sid=None, **kw):
self.id = id self.id = id
...@@ -229,13 +229,13 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -229,13 +229,13 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
def _doNothing(self): def _doNothing(self):
# A method which does nothing (and can be used to build WorkflowMethods which trigger worklow transitions) # A method which does nothing (and can be used to build WorkflowMethods which trigger worklow transitions)
pass pass
# Generic accessor # Generic accessor
def _getDefaultAcquiredProperty(self, key, default_value, null_value, def _getDefaultAcquiredProperty(self, key, default_value, null_value,
base_category=None, portal_type=None, copy_value=0, mask_value=0, sync_value=0, base_category=None, portal_type=None, copy_value=0, mask_value=0, sync_value=0,
accessor_id=None, depends=None, storage_id=None, alt_accessor_id=None, accessor_id=None, depends=None, storage_id=None, alt_accessor_id=None,
is_list_type=0): is_list_type=0):
""" """
This method implements programmable acquisition of values in ERP5. This method implements programmable acquisition of values in ERP5.
The principle is that some object attributes should be looked up, The principle is that some object attributes should be looked up,
...@@ -286,7 +286,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -286,7 +286,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
Other case : we want to change the phone number of a related object without Other case : we want to change the phone number of a related object without
going to edit the related object going to edit the related object
""" """
# Push context to prevent loop # Push context to prevent loop
# We use TRANSACTION but should use REQUEST # We use TRANSACTION but should use REQUEST
...@@ -294,11 +294,11 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -294,11 +294,11 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
TRANSACTION = get_transaction() TRANSACTION = get_transaction()
if not hasattr(TRANSACTION, '_erp5_acquisition_stack'): TRANSACTION._erp5_acquisition_stack = {} if not hasattr(TRANSACTION, '_erp5_acquisition_stack'): TRANSACTION._erp5_acquisition_stack = {}
acquisition_key = ('_getDefaultAcquiredProperty', self.getPath(), key, base_category, acquisition_key = ('_getDefaultAcquiredProperty', self.getPath(), key, base_category,
portal_type, copy_value, mask_value, sync_value, portal_type, copy_value, mask_value, sync_value,
accessor_id, depends, storage_id, alt_accessor_id, is_list_type) accessor_id, depends, storage_id, alt_accessor_id, is_list_type)
if TRANSACTION._erp5_acquisition_stack.has_key(acquisition_key): return null_value if TRANSACTION._erp5_acquisition_stack.has_key(acquisition_key): return null_value
TRANSACTION._erp5_acquisition_stack[acquisition_key] = 1 TRANSACTION._erp5_acquisition_stack[acquisition_key] = 1
#LOG("Get Acquired Property key",0,str(key)) #LOG("Get Acquired Property key",0,str(key))
if storage_id is None: storage_id=key if storage_id is None: storage_id=key
#LOG("Get Acquired Property storage_id",0,str(storage_id)) #LOG("Get Acquired Property storage_id",0,str(storage_id))
...@@ -366,7 +366,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -366,7 +366,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
# We must provide the first element of the alternate result # We must provide the first element of the alternate result
if len(result) > 0: if len(result) > 0:
# Pop context # Pop context
del TRANSACTION._erp5_acquisition_stack[acquisition_key] del TRANSACTION._erp5_acquisition_stack[acquisition_key]
return result[0] return result[0]
else: else:
# Pop context # Pop context
...@@ -388,7 +388,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -388,7 +388,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
# Return the default value defined at the class level XXXXXXXXXXXXXXX # Return the default value defined at the class level XXXXXXXXXXXXXXX
return default_value return default_value
def _getAcquiredPropertyList(self, key, default_value, null_value, def _getAcquiredPropertyList(self, key, default_value, null_value,
base_category, portal_type=None, copy_value=0, mask_value=0, sync_value=0, append_value=0, base_category, portal_type=None, copy_value=0, mask_value=0, sync_value=0, append_value=0,
accessor_id=None, depends=None, storage_id=None, alt_accessor_id=None, accessor_id=None, depends=None, storage_id=None, alt_accessor_id=None,
is_list_type=0): is_list_type=0):
...@@ -399,23 +399,23 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -399,23 +399,23 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
portal_type portal_type
copy_value copy_value
depends depends
""" """
# Push context to prevent loop # Push context to prevent loop
from Globals import get_request from Globals import get_request
TRANSACTION = get_transaction() TRANSACTION = get_transaction()
if not hasattr(TRANSACTION, '_erp5_acquisition_stack'): TRANSACTION._erp5_acquisition_stack = {} if not hasattr(TRANSACTION, '_erp5_acquisition_stack'): TRANSACTION._erp5_acquisition_stack = {}
acquisition_key = ('_getAcquiredPropertyList', self.getPath(), key, base_category, acquisition_key = ('_getAcquiredPropertyList', self.getPath(), key, base_category,
portal_type, copy_value, mask_value, sync_value, portal_type, copy_value, mask_value, sync_value,
accessor_id, depends, storage_id, alt_accessor_id, is_list_type) accessor_id, depends, storage_id, alt_accessor_id, is_list_type)
if TRANSACTION._erp5_acquisition_stack.has_key(acquisition_key): return null_value if TRANSACTION._erp5_acquisition_stack.has_key(acquisition_key): return null_value
TRANSACTION._erp5_acquisition_stack[acquisition_key] = 1 TRANSACTION._erp5_acquisition_stack[acquisition_key] = 1
if storage_id is None: storage_id=key if storage_id is None: storage_id=key
if mask_value and hasattr(self, storage_id): if mask_value and hasattr(self, storage_id):
if getattr(self, storage_id) != None: if getattr(self, storage_id) != None:
# Pop context # Pop context
del TRANSACTION._erp5_acquisition_stack[acquisition_key] del TRANSACTION._erp5_acquisition_stack[acquisition_key]
return getattr(self, storage_id) return getattr(self, storage_id)
if type(base_category) == 'a': if type(base_category) == 'a':
base_category = (base_category, ) base_category = (base_category, )
...@@ -1270,15 +1270,15 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -1270,15 +1270,15 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
context.__dict__.update(REQUEST) context.__dict__.update(REQUEST)
# Define local properties # Define local properties
if kw is not None: context.__dict__.update(kw) if kw is not None: context.__dict__.update(kw)
# Make it a temp content # Make it a temp content
temp_object = TempBase(self.getId()) temp_object = TempBase(self.getId())
for k in ('isIndexable', 'reindexObject', 'recursiveReindexObject', 'activate', 'setUid', ): for k in ('isIndexable', 'reindexObject', 'recursiveReindexObject', 'activate', 'setUid', ):
setattr(context, k, getattr(temp_object,k)) setattr(context, k, getattr(temp_object,k))
# Return result # Return result
return context.__of__(self.aq_parent) return context.__of__(self.aq_parent)
else: else:
return context.asContext(REQUEST=REQUEST, **kw) return context.asContext(REQUEST=REQUEST, **kw)
# Workflow Related Method # Workflow Related Method
security.declarePublic('getWorkflowStateItemList') security.declarePublic('getWorkflowStateItemList')
def getWorkflowStateItemList(self): def getWorkflowStateItemList(self):
...@@ -1387,19 +1387,19 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -1387,19 +1387,19 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
# LOG('Base.setBinaryData',0,'data for : %s' % str(self)) # LOG('Base.setBinaryData',0,'data for : %s' % str(self))
# self.data = data # self.data = data
security.declareProtected(Permissions.View, 'getObjectMenu') #security.declareProtected(Permissions.View, 'getObjectMenu')
def getObjectMenu(self, *args, **kw): #def getObjectMenu(self, *args, **kw):
absolute_url = self.absolute_url() # absolute_url = self.absolute_url()
#
jump_menu = """<select name="jump_select" size="1" tal:attributes="onChange string:submitAction(this.form,'%s/doJump')"> #" jump_menu = """<select name="jump_select" size="1" tal:attributes="onChange string:submitAction(this.form,'%s/doJump')">
<option selected value="1" disabled>%s</option> # <option selected value="1" disabled>%s</option>
<span tal:repeat="action jump_actions"> # <span tal:repeat="action jump_actions">
<option value="1" tal:content="action/name" # <option value="1" tal:content="action/name"
tal:attributes="value action/url">Saut</option> # tal:attributes="value action/url">Saut</option>
</span> # </span>
</select>""" % (self.gettext('Jump...'), absolute_url, ) # </select>""" % (self.gettext('Jump...'), absolute_url, )
#
pass # pass
security.declareProtected(Permissions.ModifyPortalContent, 'commitTransaction') security.declareProtected(Permissions.ModifyPortalContent, 'commitTransaction')
def commitTransaction(self): def commitTransaction(self):
...@@ -1415,7 +1415,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -1415,7 +1415,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
def __hash__(self): def __hash__(self):
return self.getUid() return self.getUid()
psyco.bind(getObjectMenu) #psyco.bind(getObjectMenu)
security.declareProtected(Permissions.ModifyPortalContent, 'setGuid') security.declareProtected(Permissions.ModifyPortalContent, 'setGuid')
def setGuid(self): def setGuid(self):
...@@ -1447,7 +1447,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana ...@@ -1447,7 +1447,7 @@ class Base( CopyContainer, PortalContent, Base18, ActiveObject, ERP5PropertyMana
Returns a temporary Predicate based on the document properties Returns a temporary Predicate based on the document properties
""" """
return None return None
security.declareProtected(Permissions.View, 'get_local_permissions') security.declareProtected(Permissions.View, 'get_local_permissions')
def get_local_permissions(self): def get_local_permissions(self):
""" """
......
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