Commit 91c991ed authored by Sebastien Robin's avatar Sebastien Robin

* Make sure that the list of property sheets with name ending

  with preference is correctly initialized before calling
  _aq_dynamic on a portal type using class Preference. This solve
  issues when _aq_dynamic was called on a Preference before
  any need of _aq_dynamic on PreferenceTool
* Move Priority class from ERP5Form.Document.Preference to
  ERP5Form.PrefrenceTool in order to solve circular imports

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@36176 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 1fc433dd
...@@ -42,7 +42,7 @@ from Products.ERP5Type.tests.utils import reindex ...@@ -42,7 +42,7 @@ from Products.ERP5Type.tests.utils import reindex
from Products.DCWorkflow.DCWorkflow import ValidationFailed from Products.DCWorkflow.DCWorkflow import ValidationFailed
from AccessControl.SecurityManagement import newSecurityManager from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.Sequence import SequenceList from Products.ERP5Type.tests.Sequence import SequenceList
from Products.ERP5Form.Document.Preference import Priority from Products.ERP5Form.PreferenceTool import Priority
SOURCE = 'source' SOURCE = 'source'
DESTINATION = 'destination' DESTINATION = 'destination'
......
...@@ -35,7 +35,7 @@ from AccessControl.SecurityManagement import newSecurityManager ...@@ -35,7 +35,7 @@ from AccessControl.SecurityManagement import newSecurityManager
from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase from Products.ERP5Type.tests.ERP5TypeTestCase import ERP5TypeTestCase
from Products.ERP5Type.tests.backportUnittest import expectedFailure from Products.ERP5Type.tests.backportUnittest import expectedFailure
from Products.ERP5Type import Permissions from Products.ERP5Type import Permissions
from Products.ERP5Form.Document.Preference import Priority from Products.ERP5Form.PreferenceTool import Priority
class TestTemplate(ERP5TypeTestCase): class TestTemplate(ERP5TypeTestCase):
......
...@@ -36,7 +36,7 @@ from Products.ERP5Banking.tests.testERP5BankingCheckPayment \ ...@@ -36,7 +36,7 @@ from Products.ERP5Banking.tests.testERP5BankingCheckPayment \
import TestERP5BankingCheckPaymentMixin import TestERP5BankingCheckPaymentMixin
from Products.ERP5Banking.tests.testERP5BankingMoneyDeposit \ from Products.ERP5Banking.tests.testERP5BankingMoneyDeposit \
import TestERP5BankingMoneyDepositMixin import TestERP5BankingMoneyDepositMixin
from Products.ERP5Form.Document.Preference import Priority from Products.ERP5Form.PreferenceTool import Priority
# Needed in order to have a log file inside the current folder # Needed in order to have a log file inside the current folder
os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log') os.environ['EVENT_LOG_FILE'] = os.path.join(os.getcwd(), 'zLOG.log')
......
...@@ -31,9 +31,12 @@ from AccessControl import ClassSecurityInfo ...@@ -31,9 +31,12 @@ from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet, Constraint from Products.ERP5Type import Permissions, PropertySheet, Constraint
from Products.ERP5Type.Core.Folder import Folder from Products.ERP5Type.Core.Folder import Folder
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Form.PreferenceTool import PreferenceTool
class Priority: class Priority:
""" names for priorities """ """ names for priorities
XXX This was moved to PreferenceTool directly
"""
SITE = 1 SITE = 1
GROUP = 2 GROUP = 2
USER = 3 USER = 3
...@@ -89,3 +92,11 @@ class Preference( Folder ): ...@@ -89,3 +92,11 @@ class Preference( Folder ):
def disable(self): def disable(self):
"""Workflow method""" """Workflow method"""
self._clearCache() self._clearCache()
def _aq_dynamic(self, id):
""" force _aq_dynamic on preference tool, because list of property sheet of
preferences depends on the code of PreferenceTool._aq_dynamic"""
if not PreferenceTool.aq_preference_generated:
portal = self.getPortalObject()
portal.portal_preferences._aq_dynamic('dummy')
return Preference.inheritedAttribute('_aq_dynamic')(self, id)
...@@ -41,10 +41,15 @@ from Products.ERP5Type.Cache import CachingMethod ...@@ -41,10 +41,15 @@ from Products.ERP5Type.Cache import CachingMethod
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
from Products.ERP5Type.Accessor.TypeDefinition import list_types from Products.ERP5Type.Accessor.TypeDefinition import list_types
from Products.ERP5Form import _dtmldir from Products.ERP5Form import _dtmldir
from Products.ERP5Form.Document.Preference import Priority
_marker = object() _marker = object()
class Priority:
""" names for priorities """
SITE = 1
GROUP = 2
USER = 3
def updatePreferenceClassPropertySheetList(): def updatePreferenceClassPropertySheetList():
# The Preference class should be imported from the common location # The Preference class should be imported from the common location
# in ERP5Type since it could be overloaded in another product # in ERP5Type since it could be overloaded in another product
......
...@@ -37,7 +37,7 @@ from zExceptions import Unauthorized ...@@ -37,7 +37,7 @@ from zExceptions import Unauthorized
from DateTime import DateTime from DateTime import DateTime
from Products.ERP5Type.tests.testERP5Type import PropertySheetTestCase from Products.ERP5Type.tests.testERP5Type import PropertySheetTestCase
from Products.ERP5Form.Document.Preference import Priority from Products.ERP5Form.PreferenceTool import Priority
from Products.ERP5.PropertySheet.HtmlStylePreference import HtmlStylePreference from Products.ERP5.PropertySheet.HtmlStylePreference import HtmlStylePreference
default_large_image_height, = [pref.get('default') default_large_image_height, = [pref.get('default')
......
...@@ -63,7 +63,7 @@ from AccessControl.SecurityManagement import newSecurityManager ...@@ -63,7 +63,7 @@ from AccessControl.SecurityManagement import newSecurityManager
from AccessControl import getSecurityManager from AccessControl import getSecurityManager
from zLOG import LOG from zLOG import LOG
from Products.ERP5.Document.Document import NotConvertedError from Products.ERP5.Document.Document import NotConvertedError
from Products.ERP5Form.Document.Preference import Priority from Products.ERP5Form.PreferenceTool import Priority
from Products.ERP5Type.tests.utils import createZODBPythonScript from Products.ERP5Type.tests.utils import createZODBPythonScript
import os import os
from threading import Thread from threading import Thread
......
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