Commit 2a54181c authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: More modules migrated from ERP5/ERP5Type Products.

parent 7a8205c3
...@@ -36,7 +36,7 @@ from erp5.component.document.Amount import Amount ...@@ -36,7 +36,7 @@ from erp5.component.document.Amount import Amount
from erp5.component.module.MovementGroup import MovementGroupNode from erp5.component.module.MovementGroup import MovementGroupNode
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
from Products.ERP5.ExplanationCache import _getExplanationCache from erp5.component.module.ExplanationCache import _getExplanationCache
from DateTime import DateTime from DateTime import DateTime
from Acquisition import aq_parent, aq_inner from Acquisition import aq_parent, aq_inner
......
...@@ -34,7 +34,7 @@ from AccessControl import ClassSecurityInfo ...@@ -34,7 +34,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from erp5.component.document.Path import Path from erp5.component.document.Path import Path
from Products.ERP5Type.Core.Predicate import Predicate from Products.ERP5Type.Core.Predicate import Predicate
from Products.ERP5.ExplanationCache import _getExplanationCache from erp5.component.module.ExplanationCache import _getExplanationCache
from erp5.component.interface.IBusinessLink import IBusinessLink from erp5.component.interface.IBusinessLink import IBusinessLink
import zope.interface import zope.interface
......
...@@ -33,7 +33,7 @@ from AccessControl import ClassSecurityInfo ...@@ -33,7 +33,7 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5Type import Permissions, PropertySheet, interfaces
from erp5.component.document.Path import Path from erp5.component.document.Path import Path
from Products.ERP5.ExplanationCache import _getExplanationCache from erp5.component.module.ExplanationCache import _getExplanationCache
from erp5.component.interface.ITradeModelPath import ITradeModelPath from erp5.component.interface.ITradeModelPath import ITradeModelPath
from erp5.component.interface.IArrowBase import IArrowBase from erp5.component.interface.IArrowBase import IArrowBase
......
...@@ -34,7 +34,7 @@ from Products.ERP5Type import Permissions, PropertySheet ...@@ -34,7 +34,7 @@ from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from Products.ERP5Type.TransactionalVariable import getTransactionalVariable
from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.XMLObject import XMLObject
from erp5.component.document.Path import Path from erp5.component.document.Path import Path
from Products.ERP5.ExplanationCache import _getExplanationCache, _getBusinessLinkClosure from erp5.component.module.ExplanationCache import _getExplanationCache, _getBusinessLinkClosure
from erp5.component.module.MovementCollectionDiff import _getPropertyAndCategoryList from erp5.component.module.MovementCollectionDiff import _getPropertyAndCategoryList
from erp5.component.interface.IBusinessProcess import IBusinessProcess from erp5.component.interface.IBusinessProcess import IBusinessProcess
from erp5.component.interface.IArrowBase import IArrowBase from erp5.component.interface.IArrowBase import IArrowBase
......
...@@ -35,7 +35,7 @@ from AccessControl import ClassSecurityInfo, getSecurityManager ...@@ -35,7 +35,7 @@ from AccessControl import ClassSecurityInfo, getSecurityManager
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Type.ExtensibleTraversable import ExtensibleTraversableMixIn from erp5.component.mixin.ExtensibleTraversableMixin import ExtensibleTraversableMixin
from Products.ERP5Type.Cache import getReadOnlyTransactionCache from Products.ERP5Type.Cache import getReadOnlyTransactionCache
from Products.ERP5Type.Globals import InitializeClass from Products.ERP5Type.Globals import InitializeClass
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
...@@ -44,7 +44,7 @@ from Products.ERP5Type.Globals import get_request ...@@ -44,7 +44,7 @@ from Products.ERP5Type.Globals import get_request
# XXX: these duplicate ones in ERP5.Document # XXX: these duplicate ones in ERP5.Document
_MARKER = [] _MARKER = []
class BaseExtensibleTraversableMixin(ExtensibleTraversableMixIn): class BaseExtensibleTraversableMixin(ExtensibleTraversableMixin):
""" """
This class provides a generic base mixin implementation of IExtensibleTraversable. This class provides a generic base mixin implementation of IExtensibleTraversable.
......
...@@ -22,35 +22,36 @@ ...@@ -22,35 +22,36 @@
from Acquisition import aq_base from Acquisition import aq_base
from webdav.NullResource import NullResource from webdav.NullResource import NullResource
class ExtensibleTraversableMixIn: class ExtensibleTraversableMixin:
def __bobo_traverse__(self, request, name):
"""
If no subobject is found through Folder API
then try to lookup the object by invoking _getExtensibleContent
"""
# Normal traversal
try:
return getattr(self, name)
except AttributeError:
pass
def __bobo_traverse__(self, request, name): try:
""" return self[name]
If no subobject is found through Folder API except KeyError:
then try to lookup the object by invoking _getExtensibleContent pass
"""
# Normal traversal
try:
return getattr(self, name)
except AttributeError:
pass
try: document = self.getExtensibleContent(request, name)
return self[name] if document is not None:
except KeyError: return aq_base(document).__of__(self)
pass
document = self.getExtensibleContent(request, name) # Not found section
if document is not None: method = request.get('REQUEST_METHOD', 'GET')
return aq_base(document).__of__(self) if not method in ('GET', 'POST'):
return NullResource(self, name, request).__of__(self)
# Waaa. unrestrictedTraverse calls us with a fake REQUEST.
# There is proabably a better fix for this.
try:
request.RESPONSE.notFoundError("%s\n%s" % (name, method))
except AttributeError:
raise KeyError, name
# Not found section ExtensibleTraversableMixIn = ExtensibleTraversableMixin # Backward compatibility
method = request.get('REQUEST_METHOD', 'GET') \ No newline at end of file
if not method in ('GET', 'POST'):
return NullResource(self, name, request).__of__(self)
# Waaa. unrestrictedTraverse calls us with a fake REQUEST.
# There is proabably a better fix for this.
try:
request.RESPONSE.notFoundError("%s\n%s" % (name, method))
except AttributeError:
raise KeyError, name
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Mixin Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>ExtensibleTraversableMixin</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>mixin.erp5.ExtensibleTraversableMixin</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Mixin Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -28,7 +28,6 @@ ...@@ -28,7 +28,6 @@
############################################################################## ##############################################################################
from collections import defaultdict from collections import defaultdict
from zLOG import LOG
from Products.ERP5Type.Cache import transactional_cached from Products.ERP5Type.Cache import transactional_cached
from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod
...@@ -213,7 +212,7 @@ class ExplanationCache: ...@@ -213,7 +212,7 @@ class ExplanationCache:
""" """
business_type_list = self.getPortalBusinessLinkTypeList() business_type_list = self.getPortalBusinessLinkTypeList()
simulation_movement_list = self.getSimulationMovementValueList() simulation_movement_list = self.getSimulationMovementValueList()
simulation_movement_uid_list = map(lambda x:x.uid, simulation_movement_list) simulation_movement_uid_list = [x.uid for x in simulation_movement_list]
# We could use related keys instead of 2 queries # We could use related keys instead of 2 queries
business_link_list = self.portal_catalog( business_link_list = self.portal_catalog(
portal_type=business_type_list, portal_type=business_type_list,
...@@ -283,8 +282,8 @@ class ExplanationCache: ...@@ -283,8 +282,8 @@ class ExplanationCache:
new_business_process = self.explanation.newContent(temp_object=True, new_business_process = self.explanation.newContent(temp_object=True,
portal_type='Business Process', id='closure_business_process') portal_type='Business Process', id='closure_business_process')
for i, x in enumerate(business_link_list): for i, x in enumerate(business_link_list):
id = 'closure_path_%s' % i id_ = 'closure_path_%s' % i
new_business_process._setOb(id, x.asContext(id=id)) new_business_process._setOb(id_, x.asContext(id=id_))
self.closure_cache[path_list] = new_business_process self.closure_cache[path_list] = new_business_process
self.closure_cache[business_link] = new_business_process self.closure_cache[business_link] = new_business_process
...@@ -306,8 +305,8 @@ class ExplanationCache: ...@@ -306,8 +305,8 @@ class ExplanationCache:
i = 0 i = 0
for business_link in self.getBusinessLinkValueList(): for business_link in self.getBusinessLinkValueList():
i += 1 i += 1
id = 'union_path_%s' % i id_ = 'union_path_%s' % i
new_business_process._setOb(id, business_link.asContext(id=id)) new_business_process._setOb(id_, business_link.asContext(id=id_))
# Keep it in cache and return # Keep it in cache and return
self.union_cache = new_business_process self.union_cache = new_business_process
...@@ -324,7 +323,7 @@ class ExplanationCache: ...@@ -324,7 +323,7 @@ class ExplanationCache:
try: try:
result = cache[reference_date_key] result = cache[reference_date_key]
if result is self: # use self as marker to detect infinite recursion if result is self: # use self as marker to detect infinite recursion
__traceback_info__ = (business_process.getPath(), trade_phase, __traceback_info__ = (business_process.getPath(), trade_phase, # pylint: disable=unused-variable
reference_date_method_id, delay_mode) reference_date_method_id, delay_mode)
raise ValueError('No reference date is defined, probably due to missing Trade Model Path in Business Process') raise ValueError('No reference date is defined, probably due to missing Trade Model Path in Business Process')
return result return result
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="Module Component" module="erp5.portal_type"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>default_reference</string> </key>
<value> <string>ExplanationCache</string> </value>
</item>
<item>
<key> <string>default_source_reference</string> </key>
<value> <string>Products.ERP5.ExplanationCache</string> </value>
</item>
<item>
<key> <string>description</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>id</string> </key>
<value> <string>module.erp5.ExplanationCache</string> </value>
</item>
<item>
<key> <string>portal_type</string> </key>
<value> <string>Module Component</string> </value>
</item>
<item>
<key> <string>sid</string> </key>
<value>
<none/>
</value>
</item>
<item>
<key> <string>text_content_error_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>text_content_warning_message</string> </key>
<value>
<tuple/>
</value>
</item>
<item>
<key> <string>version</string> </key>
<value> <string>erp5</string> </value>
</item>
<item>
<key> <string>workflow_history</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAI=</string> </persistent>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="2" aka="AAAAAAAAAAI=">
<pickle>
<global name="PersistentMapping" module="Persistence.mapping"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>data</string> </key>
<value>
<dictionary>
<item>
<key> <string>component_validation_workflow</string> </key>
<value>
<persistent> <string encoding="base64">AAAAAAAAAAM=</string> </persistent>
</value>
</item>
</dictionary>
</value>
</item>
</dictionary>
</pickle>
</record>
<record id="3" aka="AAAAAAAAAAM=">
<pickle>
<global name="WorkflowHistoryList" module="Products.ERP5Type.Workflow"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_log</string> </key>
<value>
<list>
<dictionary>
<item>
<key> <string>action</string> </key>
<value> <string>validate</string> </value>
</item>
<item>
<key> <string>validation_state</string> </key>
<value> <string>validated</string> </value>
</item>
</dictionary>
</list>
</value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
...@@ -10,6 +10,7 @@ mixin.erp5.DocumentMixin ...@@ -10,6 +10,7 @@ mixin.erp5.DocumentMixin
mixin.erp5.DocumentProxyMixin mixin.erp5.DocumentProxyMixin
mixin.erp5.DownloadableMixin mixin.erp5.DownloadableMixin
mixin.erp5.ExplainableMixin mixin.erp5.ExplainableMixin
mixin.erp5.ExtensibleTraversableMixin
mixin.erp5.MailMessageMixin mixin.erp5.MailMessageMixin
mixin.erp5.MovementCollectionUpdaterMixin mixin.erp5.MovementCollectionUpdaterMixin
mixin.erp5.MovementGeneratorMixin mixin.erp5.MovementGeneratorMixin
......
module.erp5.DateUtils module.erp5.DateUtils
module.erp5.DiffUtils module.erp5.DiffUtils
module.erp5.ExpandPolicy module.erp5.ExpandPolicy
module.erp5.ExplanationCache
module.erp5.GeneratedAmountList module.erp5.GeneratedAmountList
module.erp5.Log module.erp5.Log
module.erp5.MovementCollectionDiff module.erp5.MovementCollectionDiff
......
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