From 2dd6ad08a6cf5d1d07994808f1883acb396c0933 Mon Sep 17 00:00:00 2001 From: Sebastien Robin <seb@nexedi.com> Date: Tue, 17 Nov 2009 18:03:42 +0000 Subject: [PATCH] - the possibility to pass --enable_full_indexing=portal_skins in order to make optimisation configuration in unit test - isIndexable is not a property any more, it is a ConstantGetter instance, so it works like a property and like a method - same thing for isPredicate, isTemplate, isDelivery... we can start moving using only methods. - do not define isTemplate, isDelivery... when it is already available thanks to inheritance - new methods generated for all ERP5 objects : provides[InterfaceName]. For instance, "providesIMovement()" will return True or False for any ERP5 object. - new method "is[Group]Type" generated for all ERP5 objects. The group here is group of portal types (like getPortalDeliveryTypeList()). So on any ERP5 object, you can do "isDeliveryType()", and this will returns True or False. - add tests git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@30704 20353a03-c40f-0410-a6d1-a30d3c3de9de --- .../DocumentTemplateItem/DummyMovement.py | 3 - product/CMFActivity/ActiveProcess.py | 2 - product/CMFCategory/Category.py | 9 +- product/ERP5/Document/AcceptSolver.py | 2 - product/ERP5/Document/Account.py | 2 - product/ERP5/Document/AccountingRuleCell.py | 3 - .../ERP5/Document/AccountingTransaction.py | 3 - .../Document/AccountingTransactionLine.py | 2 - product/ERP5/Document/Acknowledgement.py | 5 +- product/ERP5/Document/AdoptSolver.py | 2 - product/ERP5/Document/Agent.py | 2 - product/ERP5/Document/AgentPrivilege.py | 2 - product/ERP5/Document/Alarm.py | 2 - product/ERP5/Document/AmortisationRule.py | 2 - product/ERP5/Document/AmountFilter.py | 2 - product/ERP5/Document/AnnotationLine.py | 2 - product/ERP5/Document/Assignment.py | 2 - product/ERP5/Document/AssortedResource.py | 2 - product/ERP5/Document/BalanceTransaction.py | 3 - .../ERP5/Document/BalanceTransactionLine.py | 5 +- product/ERP5/Document/BankAccount.py | 2 - product/ERP5/Document/BaseCategory.py | 5 +- product/ERP5/Document/BaseDomain.py | 2 - product/ERP5/Document/Binder.py | 2 - product/ERP5/Document/Budget.py | 2 - product/ERP5/Document/BudgetCell.py | 2 - product/ERP5/Document/BudgetLine.py | 2 - product/ERP5/Document/BudgetModel.py | 2 - product/ERP5/Document/BudgetTransaction.py | 2 - product/ERP5/Document/BudgetTransfer.py | 2 - product/ERP5/Document/BudgetTransferLine.py | 2 - product/ERP5/Document/BudgetVariation.py | 2 - product/ERP5/Document/Bug.py | 3 - product/ERP5/Document/BusinessPath.py | 1 - product/ERP5/Document/BusinessProcess.py | 1 - product/ERP5/Document/BusinessTemplate.py | 5 +- product/ERP5/Document/Calendar.py | 2 - product/ERP5/Document/CalendarException.py | 2 - product/ERP5/Document/Capacity.py | 3 +- product/ERP5/Document/Career.py | 2 - product/ERP5/Document/Category.py | 5 +- .../ERP5/Document/CategoryBudgetVariation.py | 2 - .../ERP5/Document/CategoryDivergenceTester.py | 2 - product/ERP5/Document/Computer.py | 2 - product/ERP5/Document/ContainerCell.py | 1 - .../ERP5/Document/ContributionPredicate.py | 3 - product/ERP5/Document/Coordinate.py | 2 - product/ERP5/Document/Currency.py | 2 - product/ERP5/Document/Delivery.py | 5 +- product/ERP5/Document/DeliveryCell.py | 6 +- product/ERP5/Document/DependentCapacity.py | 2 - product/ERP5/Document/Device.py | 2 - product/ERP5/Document/Document.py | 5 +- product/ERP5/Document/Domain.py | 2 - product/ERP5/Document/DomainGenerator.py | 4 +- product/ERP5/Document/EmailDocument.py | 7 +- product/ERP5/Document/Event.py | 6 +- product/ERP5/Document/ExtFolder.py | 2 - product/ERP5/Document/ExternalSource.py | 2 - product/ERP5/Document/File.py | 2 - .../Document/FirstCausalityMovementGroup.py | 2 +- .../ERP5/Document/FloatDivergenceTester.py | 2 - product/ERP5/Document/GeographicAddress.py | 2 - product/ERP5/Document/Image.py | 2 - product/ERP5/Document/ImmobilisableItem.py | 2 - product/ERP5/Document/Immobilisation.py | 6 +- product/ERP5/Document/ImmobilisationCell.py | 3 - .../ERP5/Document/ImmobilisationDelivery.py | 2 - product/ERP5/Document/ImmobilisationLine.py | 3 - .../ERP5/Document/ImmobilisationMovement.py | 2 - product/ERP5/Document/IndependentCapacity.py | 2 - .../ERP5/Document/InternetProtocolAddress.py | 2 - product/ERP5/Document/Inventory.py | 6 +- product/ERP5/Document/InventoryCell.py | 6 +- product/ERP5/Document/InventoryLine.py | 5 +- product/ERP5/Document/Invoice.py | 2 - product/ERP5/Document/InvoiceCell.py | 3 - product/ERP5/Document/InvoiceLine.py | 2 - product/ERP5/Document/InvoiceRule.py | 2 - .../ERP5/Document/InvoiceTransactionRule.py | 2 - product/ERP5/Document/InvoicingRule.py | 2 - product/ERP5/Document/Item.py | 2 - product/ERP5/Document/Machine.py | 2 - product/ERP5/Document/MailMessage.py | 2 - product/ERP5/Document/MappedValue.py | 2 - product/ERP5/Document/MetaNode.py | 2 - product/ERP5/Document/MetaResource.py | 2 - product/ERP5/Document/Movement.py | 7 +- product/ERP5/Document/NodeBudgetVariation.py | 2 - product/ERP5/Document/OpenOrder.py | 3 +- product/ERP5/Document/OpenOrderCell.py | 2 - product/ERP5/Document/OpenOrderLine.py | 3 - product/ERP5/Document/Order.py | 1 - product/ERP5/Document/Organisation.py | 2 - product/ERP5/Document/PDFDocument.py | 2 - product/ERP5/Document/PDFTypeInformation.py | 2 - product/ERP5/Document/PackingList.py | 1 - product/ERP5/Document/Path.py | 2 - product/ERP5/Document/PaySheetCell.py | 3 - product/ERP5/Document/PaySheetLine.py | 2 - product/ERP5/Document/PaySheetModel.py | 1 - product/ERP5/Document/PaySheetModelLine.py | 2 - product/ERP5/Document/PaySheetModelSlice.py | 1 - product/ERP5/Document/PaySheetTransaction.py | 2 - .../ERP5/Document/PaySheetTransactionLine.py | 2 - product/ERP5/Document/PaymentCondition.py | 2 - product/ERP5/Document/PaymentRule.py | 2 - product/ERP5/Document/PeriodicityLine.py | 3 - product/ERP5/Document/Person.py | 2 - product/ERP5/Document/PortalTest.py | 2 - product/ERP5/Document/Predicate.py | 5 +- product/ERP5/Document/PredicateMatrix.py | 2 - product/ERP5/Document/Pricing.py | 2 - product/ERP5/Document/ProductionReport.py | 1 - product/ERP5/Document/ProductionReportCell.py | 1 - product/ERP5/Document/Project.py | 2 - product/ERP5/Document/ProjectReport.py | 2 - .../ERP5/Document/PropertyDivergenceTester.py | 2 - .../ERP5/Document/QuantityDivergenceTester.py | 2 - product/ERP5/Document/QuantitySplitSolver.py | 2 - product/ERP5/Document/Resource.py | 2 - product/ERP5/Document/RoleDefinition.py | 2 - product/ERP5/Document/Rule.py | 3 - product/ERP5/Document/SaleOpportunity.py | 3 - product/ERP5/Document/SetPricing.py | 2 - product/ERP5/Document/SimulationMovement.py | 1 - product/ERP5/Document/SolverDecision.py | 2 - product/ERP5/Document/SolverProcess.py | 2 - .../ERP5/Document/SolverTypeInformation.py | 2 - .../ERP5/Document/StringDivergenceTester.py | 2 - product/ERP5/Document/SubscriptionItem.py | 2 - product/ERP5/Document/Supply.py | 3 - product/ERP5/Document/SupplyCell.py | 2 - product/ERP5/Document/SupplyLine.py | 5 +- product/ERP5/Document/SupplyRule.py | 2 - product/ERP5/Document/Telephone.py | 2 - product/ERP5/Document/TextDocument.py | 3 - product/ERP5/Document/Ticket.py | 7 +- product/ERP5/Document/TradeCondition.py | 1 - product/ERP5/Document/Transformation.py | 2 - product/ERP5/Document/Url.py | 2 - product/ERP5/Document/VariatedProperty.py | 2 - product/ERP5/Document/Variation.py | 2 - product/ERP5/Document/WebSection.py | 2 - product/ERP5/Document/WebSite.py | 2 - product/ERP5/Document/Wiki.py | 4 +- product/ERP5/ERP5Site.py | 34 ++++++-- product/ERP5/Extensions/InventoryBrain.py | 6 +- product/ERP5/Tool/TrashTool.py | 3 +- .../z_catalog_item_list.catalog_keys.xml | 4 +- ...og_movement_category_list.catalog_keys.xml | 4 +- .../z_catalog_movement_list.catalog_keys.xml | 4 +- ...on_movement_category_list.catalog_keys.xml | 4 +- .../z_catalog_stock_list.catalog_keys.xml | 4 +- .../ERP5Banking/Document/BankingOperation.py | 2 - .../Document/BankingOperationLine.py | 2 - product/ERP5Banking/Document/CashContainer.py | 2 - product/ERP5Banking/Document/CashCurrency.py | 2 - product/ERP5Banking/Document/CashDelivery.py | 2 - .../ERP5Banking/Document/CashDeliveryCell.py | 2 - .../ERP5Banking/Document/CashDeliveryLine.py | 2 - product/ERP5Banking/Document/CashInventory.py | 3 - .../ERP5Banking/Document/CashInventoryCell.py | 2 - .../ERP5Banking/Document/CashInventoryLine.py | 2 - .../Document/CheckOperationLine.py | 2 - product/ERP5Catalog/Document/Archive.py | 5 -- product/ERP5Form/CreatePropertySheet.py | 2 - product/ERP5Form/Document/Preference.py | 2 - product/ERP5OOo/Document/OOoDocument.py | 2 - product/ERP5SyncML/Conflict.py | 5 +- product/ERP5SyncML/Publication.py | 2 - product/ERP5SyncML/Signature.py | 5 +- product/ERP5SyncML/Subscription.py | 5 +- product/ERP5Type/Accessor/Constant.py | 56 +++++++++---- product/ERP5Type/Accessor/Interface.py | 54 ++++++++++++ product/ERP5Type/Base.py | 52 ++++++++---- product/ERP5Type/Core/ActionInformation.py | 2 - product/ERP5Type/Core/CacheFactory.py | 2 - product/ERP5Type/Core/DistributedRamCache.py | 2 - product/ERP5Type/Core/Folder.py | 2 - product/ERP5Type/Core/MemcachedPlugin.py | 2 - product/ERP5Type/Core/RamCache.py | 2 - product/ERP5Type/Core/RoleInformation.py | 2 - product/ERP5Type/ERP5Type.py | 2 - product/ERP5Type/Tool/ClassTool.py | 2 - product/ERP5Type/Utils.py | 82 +++++++++++++++++-- product/ERP5Type/XMLMatrix.py | 16 ++-- product/ERP5Type/XMLObject.py | 2 - product/ERP5Type/tests/ERP5TypeTestCase.py | 13 +-- product/ERP5Type/tests/runUnitTest.py | 10 +++ product/ERP5Type/tests/testERP5Type.py | 43 ++++++++++ product/ERP5Wizard/Tool/WizardTool.py | 4 +- 192 files changed, 379 insertions(+), 460 deletions(-) create mode 100644 product/ERP5Type/Accessor/Interface.py diff --git a/bt5/erp5_dummy_movement/DocumentTemplateItem/DummyMovement.py b/bt5/erp5_dummy_movement/DocumentTemplateItem/DummyMovement.py index e2d3a7d8a1..3f0aef3bfb 100644 --- a/bt5/erp5_dummy_movement/DocumentTemplateItem/DummyMovement.py +++ b/bt5/erp5_dummy_movement/DocumentTemplateItem/DummyMovement.py @@ -37,9 +37,6 @@ class DummyMovement(Movement): meta_type = 'ERP5 Dummy Movement' portal_type = 'Dummy Movement' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isMovement = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/CMFActivity/ActiveProcess.py b/product/CMFActivity/ActiveProcess.py index 2aee643cfc..5a0dd9fe0c 100644 --- a/product/CMFActivity/ActiveProcess.py +++ b/product/CMFActivity/ActiveProcess.py @@ -63,8 +63,6 @@ class ActiveProcess(Base): meta_type = 'CMF Active Process' portal_type = 'Active Process' - isPortalContent = 0 - isRADContent = 1 icon = None # Declarative security diff --git a/product/CMFCategory/Category.py b/product/CMFCategory/Category.py index 0f8bfcf871..dc87fec086 100644 --- a/product/CMFCategory/Category.py +++ b/product/CMFCategory/Category.py @@ -36,6 +36,7 @@ from Products.CMFCore.utils import getToolByName from Products.ERP5Type import Permissions from Products.ERP5Type import PropertySheet +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Core.Folder import Folder from Products.CMFCategory.Renderer import Renderer from Products.ERP5Type.Utils import sortValueList @@ -117,9 +118,7 @@ class Category(Folder): meta_type='CMF Category' portal_type='Category' # may be useful in the future... - isPortalContent = 1 - isRADContent = 1 - isCategory = 1 + isCategory = ConstantGetter('isCategory', value=True) icon = None allowed_types = ( @@ -778,9 +777,7 @@ class BaseCategory(Category): """ meta_type='CMF Base Category' portal_type='Base Category' # maybe useful some day - isPortalContent = 1 - isRADContent = 1 - isBaseCategory = 1 + isBaseCategory = ConstantGetter('isBaseCategory', value=True) constructors = (manage_addBaseCategoryForm, addBaseCategory) diff --git a/product/ERP5/Document/AcceptSolver.py b/product/ERP5/Document/AcceptSolver.py index 0c0c103092..c5c022a406 100644 --- a/product/ERP5/Document/AcceptSolver.py +++ b/product/ERP5/Document/AcceptSolver.py @@ -39,8 +39,6 @@ class AcceptSolver(XMLObject): meta_type = 'ERP5 Accept Solver' portal_type = 'Accept Solver' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 isIndexable = 0 # We do not want to fill the catalog with objects on which we need no reporting # Declarative security diff --git a/product/ERP5/Document/Account.py b/product/ERP5/Document/Account.py index 2f35760663..7d64f15b76 100644 --- a/product/ERP5/Document/Account.py +++ b/product/ERP5/Document/Account.py @@ -67,8 +67,6 @@ class Account(XMLObject): meta_type = 'ERP5 Account' portal_type = 'Account' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/AccountingRuleCell.py b/product/ERP5/Document/AccountingRuleCell.py index 015ed15de8..0e39605296 100644 --- a/product/ERP5/Document/AccountingRuleCell.py +++ b/product/ERP5/Document/AccountingRuleCell.py @@ -59,9 +59,6 @@ An AccountingRuleCell object allows to add SaleInvoiceTransactionLines into a Ma meta_type = 'ERP5 Accounting Rule Cell' portal_type = 'Accounting Rule Cell' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isDelivery = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/AccountingTransaction.py b/product/ERP5/Document/AccountingTransaction.py index 85b137d5f8..21b10134da 100644 --- a/product/ERP5/Document/AccountingTransaction.py +++ b/product/ERP5/Document/AccountingTransaction.py @@ -44,9 +44,6 @@ class AccountingTransaction(Delivery): meta_type = 'ERP5 Accounting Transaction' portal_type = 'Accounting Transaction' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isDelivery = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/AccountingTransactionLine.py b/product/ERP5/Document/AccountingTransactionLine.py index e397b61ede..d3a5115189 100644 --- a/product/ERP5/Document/AccountingTransactionLine.py +++ b/product/ERP5/Document/AccountingTransactionLine.py @@ -42,8 +42,6 @@ class AccountingTransactionLine(DeliveryLine): meta_type = 'ERP5 Accounting Transaction Line' portal_type = 'Accounting Transaction Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Acknowledgement.py b/product/ERP5/Document/Acknowledgement.py index a24e10d36f..ca81a1a6f5 100644 --- a/product/ERP5/Document/Acknowledgement.py +++ b/product/ERP5/Document/Acknowledgement.py @@ -28,6 +28,7 @@ ############################################################################## from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5.Document.EmailDocument import EmailDocumentProxyMixin from Products.ERP5.Document.Event import Event @@ -54,9 +55,7 @@ class Acknowledgement(EmailDocumentProxyMixin, Event): meta_type = 'ERP5 Acknowledgement' portal_type = 'Acknowledgement' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isDelivery = 1 + isDelivery = ConstantGetter('isDelivery', value=True) # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/AdoptSolver.py b/product/ERP5/Document/AdoptSolver.py index 0871e58e63..c659b45105 100644 --- a/product/ERP5/Document/AdoptSolver.py +++ b/product/ERP5/Document/AdoptSolver.py @@ -39,8 +39,6 @@ class AdoptSolver(XMLObject): meta_type = 'ERP5 Adopt Solver' portal_type = 'Adopt Solver' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 isIndexable = 0 # We do not want to fill the catalog with objects on which we need no reporting # Declarative security diff --git a/product/ERP5/Document/Agent.py b/product/ERP5/Document/Agent.py index dcc57ebb73..68675a734f 100644 --- a/product/ERP5/Document/Agent.py +++ b/product/ERP5/Document/Agent.py @@ -42,8 +42,6 @@ class Agent(Folder, Image): # CMF Type Definition meta_type = 'ERP5 Agent' portal_type = 'Agent' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/AgentPrivilege.py b/product/ERP5/Document/AgentPrivilege.py index 64a3faf38b..f03447120c 100644 --- a/product/ERP5/Document/AgentPrivilege.py +++ b/product/ERP5/Document/AgentPrivilege.py @@ -39,8 +39,6 @@ class AgentPrivilege(XMLObject): # CMF Type Definition meta_type = 'ERP5 Agent Privilege' portal_type = 'Agent Privilege' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Alarm.py b/product/ERP5/Document/Alarm.py index 1139605217..78678f121e 100644 --- a/product/ERP5/Document/Alarm.py +++ b/product/ERP5/Document/Alarm.py @@ -256,8 +256,6 @@ class Alarm(XMLObject, PeriodicityMixin): meta_type = 'ERP5 Alarm' portal_type = 'Alarm' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/AmortisationRule.py b/product/ERP5/Document/AmortisationRule.py index f6df4d4260..f971eeb559 100644 --- a/product/ERP5/Document/AmortisationRule.py +++ b/product/ERP5/Document/AmortisationRule.py @@ -50,8 +50,6 @@ class AmortisationRule(Rule): meta_type = 'ERP5 Amortisation Rule' portal_type = 'Amortisation Rule' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/AmountFilter.py b/product/ERP5/Document/AmountFilter.py index f5730b351d..c3ba612b83 100644 --- a/product/ERP5/Document/AmountFilter.py +++ b/product/ERP5/Document/AmountFilter.py @@ -56,8 +56,6 @@ class AmountFilter(MappedValue, Amount): meta_type = 'ERP5 Amount Filter' portal_type = 'Amount Filter' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/AnnotationLine.py b/product/ERP5/Document/AnnotationLine.py index 6d204f3d60..b403abf6f7 100644 --- a/product/ERP5/Document/AnnotationLine.py +++ b/product/ERP5/Document/AnnotationLine.py @@ -45,8 +45,6 @@ class AnnotationLine(PaySheetLine): meta_type = 'ERP5 Annotation Line' portal_type = 'Annotation Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Assignment.py b/product/ERP5/Document/Assignment.py index c7c08515a8..dba6d3d337 100644 --- a/product/ERP5/Document/Assignment.py +++ b/product/ERP5/Document/Assignment.py @@ -38,8 +38,6 @@ class Assignment(Path): meta_type = 'ERP5 Assignment' portal_type = 'Assignment' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/AssortedResource.py b/product/ERP5/Document/AssortedResource.py index 62f6c75420..fc10388c97 100644 --- a/product/ERP5/Document/AssortedResource.py +++ b/product/ERP5/Document/AssortedResource.py @@ -115,8 +115,6 @@ class AssortedResource(TransformedResource): meta_type = 'ERP5 Assorted Resource' portal_type = 'Assorted Resource' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BalanceTransaction.py b/product/ERP5/Document/BalanceTransaction.py index c144d93fb7..cc82396884 100644 --- a/product/ERP5/Document/BalanceTransaction.py +++ b/product/ERP5/Document/BalanceTransaction.py @@ -84,9 +84,6 @@ class BalanceTransaction(AccountingTransaction, Inventory): meta_type = 'ERP5 Balance Transaction' portal_type = 'Balance Transaction' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isDelivery = 1 #zope.interface.implements( interfaces.Inventory, ) diff --git a/product/ERP5/Document/BalanceTransactionLine.py b/product/ERP5/Document/BalanceTransactionLine.py index ba82dc81c1..462f398bb4 100644 --- a/product/ERP5/Document/BalanceTransactionLine.py +++ b/product/ERP5/Document/BalanceTransactionLine.py @@ -29,6 +29,7 @@ from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet, interfaces +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5.Document.AccountingTransactionLine import \ AccountingTransactionLine from Products.ERP5.Document.InventoryLine import InventoryLine @@ -42,9 +43,7 @@ class BalanceTransactionLine(AccountingTransactionLine, InventoryLine): meta_type = 'ERP5 Balance Transaction Line' portal_type = 'Balance Transaction Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isIndexable = 0 + isIndexable = ConstantGetter('isIndexable', value=False) # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BankAccount.py b/product/ERP5/Document/BankAccount.py index c12f5a60a7..a5cd2cd258 100644 --- a/product/ERP5/Document/BankAccount.py +++ b/product/ERP5/Document/BankAccount.py @@ -50,8 +50,6 @@ class BankAccount(Folder, Coordinate, MetaNode): meta_type = 'ERP5 Bank Account' portal_type = 'Bank Account' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BaseCategory.py b/product/ERP5/Document/BaseCategory.py index 4dc74051da..9b4d84760e 100644 --- a/product/ERP5/Document/BaseCategory.py +++ b/product/ERP5/Document/BaseCategory.py @@ -30,6 +30,7 @@ from Products.CMFCategory.Category import BaseCategory as CMFBaseCategory from AccessControl import ClassSecurityInfo from Products.ERP5Type import interfaces, Permissions, PropertySheet +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5Type.Base import _aq_reset @@ -43,9 +44,7 @@ class BaseCategory(CMFBaseCategory, XMLObject): """ meta_type='ERP5 Base Category' portal_type='Base Category' # maybe useful some day - isPortalContent = 1 - isRADContent = 1 - isCategory = 1 + isCategory = ConstantGetter('isCategory', value=True) allowed_types = ('ERP5 Category', ) # Declarative security diff --git a/product/ERP5/Document/BaseDomain.py b/product/ERP5/Document/BaseDomain.py index 89fc5f8c30..8213ee7656 100644 --- a/product/ERP5/Document/BaseDomain.py +++ b/product/ERP5/Document/BaseDomain.py @@ -44,8 +44,6 @@ class BaseDomain(Domain): meta_type = 'ERP5 Base Domain' portal_type = 'Base Domain' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Binder.py b/product/ERP5/Document/Binder.py index 9b19b76d05..8c86ef01be 100644 --- a/product/ERP5/Document/Binder.py +++ b/product/ERP5/Document/Binder.py @@ -40,8 +40,6 @@ class Binder(Folder, Document): meta_type = 'ERP5 Binder' portal_type = 'Binder' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Budget.py b/product/ERP5/Document/Budget.py index 108457c57a..2f5a488840 100644 --- a/product/ERP5/Document/Budget.py +++ b/product/ERP5/Document/Budget.py @@ -61,8 +61,6 @@ class Budget(Predicate, Variated): meta_type='ERP5 Budget' portal_type='Budget' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BudgetCell.py b/product/ERP5/Document/BudgetCell.py index 3efe15898a..581dfcf179 100644 --- a/product/ERP5/Document/BudgetCell.py +++ b/product/ERP5/Document/BudgetCell.py @@ -60,8 +60,6 @@ class BudgetCell(Predicate, MetaNode, Movement): meta_type='ERP5 Budget Cell' portal_type='Budget Cell' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BudgetLine.py b/product/ERP5/Document/BudgetLine.py index 7d90e6c476..0c7b1cf476 100644 --- a/product/ERP5/Document/BudgetLine.py +++ b/product/ERP5/Document/BudgetLine.py @@ -63,8 +63,6 @@ class BudgetLine(Predicate, XMLMatrix, Variated): meta_type='ERP5 Budget Line' portal_type='Budget Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BudgetModel.py b/product/ERP5/Document/BudgetModel.py index 106e0a644a..08d05f69a2 100644 --- a/product/ERP5/Document/BudgetModel.py +++ b/product/ERP5/Document/BudgetModel.py @@ -52,8 +52,6 @@ class BudgetModel(Predicate): meta_type = 'ERP5 Budget Model' portal_type = 'Budget Model' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BudgetTransaction.py b/product/ERP5/Document/BudgetTransaction.py index 5cd0aed1a8..5984fd97df 100644 --- a/product/ERP5/Document/BudgetTransaction.py +++ b/product/ERP5/Document/BudgetTransaction.py @@ -54,8 +54,6 @@ class BudgetTransaction(DeliveryLine): meta_type='ERP5 Budget Transaction' portal_type='Budget Transaction' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BudgetTransfer.py b/product/ERP5/Document/BudgetTransfer.py index 3265620b03..d37433f288 100644 --- a/product/ERP5/Document/BudgetTransfer.py +++ b/product/ERP5/Document/BudgetTransfer.py @@ -53,8 +53,6 @@ class BudgetTransfer(Supply): meta_type='ERP5 Budget Transfer' portal_type='Budget Transfer' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BudgetTransferLine.py b/product/ERP5/Document/BudgetTransferLine.py index aefd1b0caf..1f2676b873 100644 --- a/product/ERP5/Document/BudgetTransferLine.py +++ b/product/ERP5/Document/BudgetTransferLine.py @@ -54,8 +54,6 @@ class BudgetTransferLine(SupplyLine): meta_type='ERP5 Budget Transfer Line' portal_type='Budget Transfer Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BudgetVariation.py b/product/ERP5/Document/BudgetVariation.py index 33cf7c58bc..bf96e22cf7 100644 --- a/product/ERP5/Document/BudgetVariation.py +++ b/product/ERP5/Document/BudgetVariation.py @@ -55,8 +55,6 @@ class BudgetVariation(Predicate): meta_type='ERP5 Budget Variation' portal_type='Budget Variation' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Bug.py b/product/ERP5/Document/Bug.py index 01d1f9e028..9c5b7604a1 100644 --- a/product/ERP5/Document/Bug.py +++ b/product/ERP5/Document/Bug.py @@ -38,9 +38,6 @@ class Bug(Ticket): meta_type = 'ERP5 Bug' portal_type = 'Bug' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isDelivery = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BusinessPath.py b/product/ERP5/Document/BusinessPath.py index 5db9b6d474..1e878ec0ce 100644 --- a/product/ERP5/Document/BusinessPath.py +++ b/product/ERP5/Document/BusinessPath.py @@ -65,7 +65,6 @@ class BusinessPath(Path): """ meta_type = 'ERP5 Business Path' portal_type = 'Business Path' - isPredicate = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BusinessProcess.py b/product/ERP5/Document/BusinessProcess.py index 43165ae9ce..47ad3fb830 100644 --- a/product/ERP5/Document/BusinessProcess.py +++ b/product/ERP5/Document/BusinessProcess.py @@ -48,7 +48,6 @@ class BusinessProcess(Path, XMLObject): """ meta_type = 'ERP5 Business Process' portal_type = 'Business Process' - isPredicate = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/BusinessTemplate.py b/product/ERP5/Document/BusinessTemplate.py index e37b08e24c..dd3aa8a9c1 100644 --- a/product/ERP5/Document/BusinessTemplate.py +++ b/product/ERP5/Document/BusinessTemplate.py @@ -33,6 +33,7 @@ from Products.ERP5Type.Globals import Persistent, PersistentMapping from Acquisition import Implicit, aq_base from AccessControl import ClassSecurityInfo from Products.CMFCore.utils import getToolByName +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Base import WorkflowMethod, _aq_reset from Products.ERP5Type.Utils import readLocalDocument, \ writeLocalDocument, \ @@ -919,7 +920,7 @@ class ObjectTemplateItem(BaseTemplateItem): # manage_afterClone in order to not call recursiveReindex, this is # useless because we will already reindex every created object, so # we avoid duplication of reindexation - obj.isIndexable = 0 + obj.isIndexable = ConstantGetter('isIndexable', value=False) obj.manage_afterClone(obj) del obj.isIndexable if getattr(aq_base(obj), 'reindexObject', None) is not None: @@ -4615,8 +4616,6 @@ class BusinessTemplate(XMLObject): meta_type = 'ERP5 Business Template' portal_type = 'Business Template' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Calendar.py b/product/ERP5/Document/Calendar.py index a9f5c0f337..f10125f90f 100644 --- a/product/ERP5/Document/Calendar.py +++ b/product/ERP5/Document/Calendar.py @@ -37,8 +37,6 @@ class Calendar(Delivery): # CMF Type Definition meta_type = 'ERP5 Calendar' portal_type = 'Calendar' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/CalendarException.py b/product/ERP5/Document/CalendarException.py index 46876cdecc..28853b8794 100644 --- a/product/ERP5/Document/CalendarException.py +++ b/product/ERP5/Document/CalendarException.py @@ -38,8 +38,6 @@ class CalendarException(XMLObject): # CMF Type Definition meta_type = 'ERP5 Calendar Exception' portal_type = 'Calendar Exception' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Capacity.py b/product/ERP5/Document/Capacity.py index e23bc5b56f..04bb9f4b2a 100644 --- a/product/ERP5/Document/Capacity.py +++ b/product/ERP5/Document/Capacity.py @@ -32,6 +32,7 @@ from AccessControl import ClassSecurityInfo from Products.CMFCore.utils import getToolByName from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.XMLObject import XMLObject @@ -41,7 +42,7 @@ class Capacity(XMLObject): """ meta_type = 'ERP5 Capacity' - isCapacity = 1 + isCapacity = ConstantGetter('isCapacity', value=True) # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Career.py b/product/ERP5/Document/Career.py index 43e7f47b07..737055553e 100644 --- a/product/ERP5/Document/Career.py +++ b/product/ERP5/Document/Career.py @@ -42,8 +42,6 @@ class Career(Path): meta_type = 'ERP5 Career' portal_type = 'Career' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Category.py b/product/ERP5/Document/Category.py index c37e38b90e..7f0799c746 100644 --- a/product/ERP5/Document/Category.py +++ b/product/ERP5/Document/Category.py @@ -32,6 +32,7 @@ from AccessControl import ClassSecurityInfo from Products.ERP5.Document.MetaNode import MetaNode from Products.ERP5.Document.MetaResource import MetaResource from Products.ERP5Type import interfaces, Permissions, PropertySheet +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Base import Base from Products.ERP5.Document.Predicate import Predicate @@ -93,9 +94,7 @@ class Category(CMFCategory, Predicate, MetaNode, MetaResource): meta_type='ERP5 Category' portal_type='Category' # may be useful in the future... - isPortalContent = 1 - isRADContent = 1 - isCategory = 1 + isCategory = ConstantGetter('isCategory', value=True) allowed_types = ('ERP5 Category', ) # Declarative security diff --git a/product/ERP5/Document/CategoryBudgetVariation.py b/product/ERP5/Document/CategoryBudgetVariation.py index 087cb6498e..d3a5111ae6 100644 --- a/product/ERP5/Document/CategoryBudgetVariation.py +++ b/product/ERP5/Document/CategoryBudgetVariation.py @@ -50,8 +50,6 @@ class CategoryBudgetVariation(BudgetVariation): meta_type = 'ERP5 Category Budget Variation' portal_type = 'Category Budget Variation' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/CategoryDivergenceTester.py b/product/ERP5/Document/CategoryDivergenceTester.py index f01ec04cca..4d627f6c70 100644 --- a/product/ERP5/Document/CategoryDivergenceTester.py +++ b/product/ERP5/Document/CategoryDivergenceTester.py @@ -44,8 +44,6 @@ class CategoryDivergenceTester(PropertyDivergenceTester): meta_type = 'ERP5 Category Divergence Tester' portal_type = 'Category Divergence Tester' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Computer.py b/product/ERP5/Document/Computer.py index cc99ac756f..11c7ccbd89 100644 --- a/product/ERP5/Document/Computer.py +++ b/product/ERP5/Document/Computer.py @@ -39,8 +39,6 @@ class Computer(Machine): meta_type = 'ERP5 Computer' portal_type = 'Computer' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/ContainerCell.py b/product/ERP5/Document/ContainerCell.py index a8570d63c1..bc91dbec47 100644 --- a/product/ERP5/Document/ContainerCell.py +++ b/product/ERP5/Document/ContainerCell.py @@ -44,7 +44,6 @@ class ContainerCell(DeliveryCell): meta_type = 'ERP5 Container Cell' portal_type = 'Container Cell' isCell = 1 - isMovement = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/ContributionPredicate.py b/product/ERP5/Document/ContributionPredicate.py index 4bc524a09a..ea274c9c16 100644 --- a/product/ERP5/Document/ContributionPredicate.py +++ b/product/ERP5/Document/ContributionPredicate.py @@ -41,9 +41,6 @@ class ContributionPredicate(Predicate, XMLObject): meta_type = 'ERP5 Contribution Predicate' portal_type = 'Contribution Predicate' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isPredicate = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Coordinate.py b/product/ERP5/Document/Coordinate.py index 93f6f9f041..13443d038e 100644 --- a/product/ERP5/Document/Coordinate.py +++ b/product/ERP5/Document/Coordinate.py @@ -77,8 +77,6 @@ class Coordinate(Base): meta_type = 'ERP5 Coordinate' portal_type = 'Coordinate' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative interface zope.interface.implements(interfaces.ICoordinate, ) diff --git a/product/ERP5/Document/Currency.py b/product/ERP5/Document/Currency.py index 728dfbc4a4..afaec58d78 100644 --- a/product/ERP5/Document/Currency.py +++ b/product/ERP5/Document/Currency.py @@ -41,8 +41,6 @@ class Currency(Resource): meta_type = 'ERP5 Currency' portal_type = 'Currency' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Delivery.py b/product/ERP5/Document/Delivery.py index 199c6e24c8..0859a2c333 100644 --- a/product/ERP5/Document/Delivery.py +++ b/product/ERP5/Document/Delivery.py @@ -34,6 +34,7 @@ from Products.CMFCore.utils import getToolByName from Products.ERP5Type.Base import WorkflowMethod from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet, interfaces +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.XMLObject import XMLObject from Products.ERP5.Document.ImmobilisationDelivery import ImmobilisationDelivery from Products.ERP5Type.UnrestrictedMethod import UnrestrictedMethod @@ -49,9 +50,7 @@ class Delivery(XMLObject, ImmobilisationDelivery): # CMF Type Definition meta_type = 'ERP5 Delivery' portal_type = 'Delivery' - isPortalContent = 1 - isRADContent = 1 - isDelivery = 1 + isDelivery = ConstantGetter('isDelivery', value=True) # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/DeliveryCell.py b/product/ERP5/Document/DeliveryCell.py index ab4eba390e..549fec5319 100644 --- a/product/ERP5/Document/DeliveryCell.py +++ b/product/ERP5/Document/DeliveryCell.py @@ -53,7 +53,6 @@ class DeliveryCell(MappedValue, Movement, ImmobilisationMovement): meta_type = 'ERP5 Delivery Cell' portal_type = 'Delivery Cell' isCell = 1 - isMovement = 1 # Declarative security security = ClassSecurityInfo() @@ -179,3 +178,8 @@ class DeliveryCell(MappedValue, Movement, ImmobilisationMovement): parent = parent.getParentValue() if parent is not None: parent.updateSimulationDeliveryProperties(movement_list, self) + + security.declareProtected(Permissions.AccessContentsInformation, 'isMovement') + def isMovement(self): + return 1 + diff --git a/product/ERP5/Document/DependentCapacity.py b/product/ERP5/Document/DependentCapacity.py index f406f23642..8bd82c768b 100644 --- a/product/ERP5/Document/DependentCapacity.py +++ b/product/ERP5/Document/DependentCapacity.py @@ -41,8 +41,6 @@ class DependentCapacity(Capacity): meta_type = 'ERP5 Dependent Capacity' portal_type = 'Dependent Capacity' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Device.py b/product/ERP5/Document/Device.py index ef431ae5eb..1d09419766 100644 --- a/product/ERP5/Document/Device.py +++ b/product/ERP5/Document/Device.py @@ -40,8 +40,6 @@ class Device(Item): meta_type = 'ERP5 Device' portal_type = 'Device' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Document.py b/product/ERP5/Document/Document.py index 6785fbfa94..899b48a241 100644 --- a/product/ERP5/Document/Document.py +++ b/product/ERP5/Document/Document.py @@ -33,6 +33,7 @@ from zLOG import LOG from AccessControl import ClassSecurityInfo, getSecurityManager from AccessControl.SecurityManagement import newSecurityManager, setSecurityManager from Acquisition import aq_base +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Globals import get_request from Products.CMFCore.utils import getToolByName, _checkPermission from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces @@ -489,9 +490,7 @@ class Document(PermanentURLMixIn, XMLObject, UrlMixIn, CachedConvertableMixin, S meta_type = 'ERP5 Document' portal_type = 'Document' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isDocument = 1 + isDocument = ConstantGetter('isDocument', value=True) __dav_collection__=0 zope.interface.implements(interfaces.IConvertable, diff --git a/product/ERP5/Document/Domain.py b/product/ERP5/Document/Domain.py index ec862d7185..3cc7a0d830 100644 --- a/product/ERP5/Document/Domain.py +++ b/product/ERP5/Document/Domain.py @@ -74,8 +74,6 @@ class Domain(Predicate, MetaNode, MetaResource): meta_type = 'ERP5 Domain' portal_type = 'Domain' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/DomainGenerator.py b/product/ERP5/Document/DomainGenerator.py index 4a2eb80832..5b61a31b7a 100644 --- a/product/ERP5/Document/DomainGenerator.py +++ b/product/ERP5/Document/DomainGenerator.py @@ -28,6 +28,7 @@ from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.XMLObject import XMLObject @@ -44,8 +45,7 @@ class DomainGenerator(XMLObject): """ meta_type='ERP5 Domain Generator' portal_type='Domain Generator' - isPortalContent = 0 - isRADContent = 1 + isPortalContent = ConstantGetter('isPortalContent', value=False) icon = None security = ClassSecurityInfo() diff --git a/product/ERP5/Document/EmailDocument.py b/product/ERP5/Document/EmailDocument.py index c8ad0583e6..f1c1191d39 100644 --- a/product/ERP5/Document/EmailDocument.py +++ b/product/ERP5/Document/EmailDocument.py @@ -31,6 +31,7 @@ import re, types from DateTime import DateTime from Products.ERP5Type.Globals import get_request from AccessControl import ClassSecurityInfo, Unauthorized +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Base import WorkflowMethod from Products.CMFCore.utils import getToolByName, _checkPermission from Products.CMFCore.utils import _setCacheHeaders, _ViewEmulator @@ -135,10 +136,8 @@ class EmailDocument(File, TextDocument): meta_type = 'ERP5 Email Document' portal_type = 'Email Document' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isDocument = 1 - isDelivery = 1 # XXX must be removed later - only event is a delivery + # XXX must be removed later - only event is a delivery + isDelivery = ConstantGetter('isDelivery', value=True) # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Event.py b/product/ERP5/Document/Event.py index 19cc194280..f68cf59b60 100644 --- a/product/ERP5/Document/Event.py +++ b/product/ERP5/Document/Event.py @@ -29,6 +29,7 @@ from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5.Document.Movement import Movement from Products.ERP5.Document.EmailDocument import EmailDocument @@ -103,10 +104,7 @@ class Event(EmailDocument, Movement, AcknowledgeableMixin): meta_type = 'ERP5 Event' portal_type = 'Event' - isPortalContent = 1 - isRADContent = 1 - isDelivery = 1 - isMovement = 1 + isDelivery = ConstantGetter('isDelivery', value=True) # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/ExtFolder.py b/product/ERP5/Document/ExtFolder.py index 937e35f068..fe0aa60d6c 100644 --- a/product/ERP5/Document/ExtFolder.py +++ b/product/ERP5/Document/ExtFolder.py @@ -74,8 +74,6 @@ class ExtFolder( XMLObject ): meta_type='ERP5 External Folder' portal_type='External Folder' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/ExternalSource.py b/product/ERP5/Document/ExternalSource.py index 32ebb7672f..02c2cb3a9b 100644 --- a/product/ERP5/Document/ExternalSource.py +++ b/product/ERP5/Document/ExternalSource.py @@ -97,8 +97,6 @@ class ExternalSource(XMLObject, UrlMixIn, UpdateMixIn): # CMF Type Definition meta_type = 'ERP5 External Source' portal_type = 'External Source' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/File.py b/product/ERP5/Document/File.py index ecd141c83e..ffc18e9615 100644 --- a/product/ERP5/Document/File.py +++ b/product/ERP5/Document/File.py @@ -73,8 +73,6 @@ class File(Document, CMFFile, CachedConvertableMixin): meta_type = 'ERP5 File' portal_type = 'File' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/FirstCausalityMovementGroup.py b/product/ERP5/Document/FirstCausalityMovementGroup.py index 68e176e7b1..366c7b327b 100644 --- a/product/ERP5/Document/FirstCausalityMovementGroup.py +++ b/product/ERP5/Document/FirstCausalityMovementGroup.py @@ -57,4 +57,4 @@ class FirstCausalityMovementGroup(CausalityMovementGroup): delivery = delivery_movement.getExplanationValue() if delivery is not None: delivery_url = delivery.getRelativeUrl() - return delivery_url \ No newline at end of file + return delivery_url diff --git a/product/ERP5/Document/FloatDivergenceTester.py b/product/ERP5/Document/FloatDivergenceTester.py index 9fc7733140..46bddaf68a 100644 --- a/product/ERP5/Document/FloatDivergenceTester.py +++ b/product/ERP5/Document/FloatDivergenceTester.py @@ -44,8 +44,6 @@ class FloatDivergenceTester(Predicate): meta_type = 'ERP5 Float Divergence Tester' portal_type = 'Float Divergence Tester' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/GeographicAddress.py b/product/ERP5/Document/GeographicAddress.py index 676fcfa2ee..c379b8ea2b 100644 --- a/product/ERP5/Document/GeographicAddress.py +++ b/product/ERP5/Document/GeographicAddress.py @@ -50,8 +50,6 @@ class GeographicAddress(Coordinate, Base): meta_type = 'ERP5 Geographic Address' portal_type = 'Address' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Image.py b/product/ERP5/Document/Image.py index 05dd747d95..a3984b8d9b 100644 --- a/product/ERP5/Document/Image.py +++ b/product/ERP5/Document/Image.py @@ -85,8 +85,6 @@ class Image(File, OFSImage): # CMF Type Definition meta_type = 'ERP5 Image' portal_type = 'Image' - isPortalContent = 1 - isRADContent = 1 # Default attribute values width = 0 diff --git a/product/ERP5/Document/ImmobilisableItem.py b/product/ERP5/Document/ImmobilisableItem.py index a0676f5e70..af5d126fae 100644 --- a/product/ERP5/Document/ImmobilisableItem.py +++ b/product/ERP5/Document/ImmobilisableItem.py @@ -60,8 +60,6 @@ class ImmobilisableItem(XMLObject, Amount): meta_type = 'ERP5 ImmobilisableItem' portal_type = 'Immobilisable Item' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Immobilisation.py b/product/ERP5/Document/Immobilisation.py index b692f1bd8b..8889619009 100644 --- a/product/ERP5/Document/Immobilisation.py +++ b/product/ERP5/Document/Immobilisation.py @@ -41,7 +41,7 @@ from Products.ERP5.Document.Delivery import Delivery from string import capitalize from zLOG import LOG -class Immobilisation(XMLObject, Delivery): +class Immobilisation(Delivery, XMLObject): """ An Immobilisation object holds the information about an accounting immobilisation (in order to amortise an object) @@ -53,10 +53,6 @@ class Immobilisation(XMLObject, Delivery): meta_type = 'ERP5 Immobilisation' portal_type = 'Immobilisation' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isDelivery = 1 - isMovement = 0 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/ImmobilisationCell.py b/product/ERP5/Document/ImmobilisationCell.py index 9ad2df30d2..a1f7db55d9 100644 --- a/product/ERP5/Document/ImmobilisationCell.py +++ b/product/ERP5/Document/ImmobilisationCell.py @@ -46,9 +46,6 @@ class ImmobilisationCell(Movement, XMLObject, ImmobilisationMovement): meta_type = 'ERP5 Immobilisation Cell' portal_type = 'Immobilisation Cell' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isMovement = 1 isAccountable = 0 # It should not be indexed in stock table # Declarative security diff --git a/product/ERP5/Document/ImmobilisationDelivery.py b/product/ERP5/Document/ImmobilisationDelivery.py index 262fe76483..e067575883 100644 --- a/product/ERP5/Document/ImmobilisationDelivery.py +++ b/product/ERP5/Document/ImmobilisationDelivery.py @@ -58,8 +58,6 @@ class ImmobilisationDelivery(XMLObject): meta_type = 'ERP5 Immobilisation Delivery' portal_type = 'Immobilisation Delivery' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/ImmobilisationLine.py b/product/ERP5/Document/ImmobilisationLine.py index fd40fca048..af6d0bdbbe 100644 --- a/product/ERP5/Document/ImmobilisationLine.py +++ b/product/ERP5/Document/ImmobilisationLine.py @@ -47,9 +47,6 @@ class ImmobilisationLine(Movement, XMLObject, ImmobilisationMovement, DeliveryLi meta_type = 'ERP5 Immobilisation Line' portal_type = 'Immobilisation Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isMovement = 1 isAccountable = 0 # It should not be indexed in stock table # Declarative security diff --git a/product/ERP5/Document/ImmobilisationMovement.py b/product/ERP5/Document/ImmobilisationMovement.py index 796bd70cec..017d34856e 100644 --- a/product/ERP5/Document/ImmobilisationMovement.py +++ b/product/ERP5/Document/ImmobilisationMovement.py @@ -76,8 +76,6 @@ class ImmobilisationMovement(Movement, XMLObject): meta_type = 'ERP5 Immobilisation Movement' portal_type = 'Immobilisation Movement' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/IndependentCapacity.py b/product/ERP5/Document/IndependentCapacity.py index 2a4e41ca94..1b06c710e9 100644 --- a/product/ERP5/Document/IndependentCapacity.py +++ b/product/ERP5/Document/IndependentCapacity.py @@ -41,8 +41,6 @@ class IndependentCapacity(Capacity): meta_type = 'ERP5 Independent Capacity' portal_type = 'Independent Capacity' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/InternetProtocolAddress.py b/product/ERP5/Document/InternetProtocolAddress.py index a51dbdc01e..51bab06d87 100644 --- a/product/ERP5/Document/InternetProtocolAddress.py +++ b/product/ERP5/Document/InternetProtocolAddress.py @@ -44,8 +44,6 @@ class InternetProtocolAddress(Base, Coordinate): meta_type = 'ERP5 Internet Protocol Address' portal_type = 'Internet Protocol Address' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Inventory.py b/product/ERP5/Document/Inventory.py index 4da2008ff1..75cf071d45 100644 --- a/product/ERP5/Document/Inventory.py +++ b/product/ERP5/Document/Inventory.py @@ -28,6 +28,7 @@ from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5.Document.Delivery import Delivery from Acquisition import aq_base from zLOG import LOG @@ -39,10 +40,7 @@ class Inventory(Delivery): # CMF Type Definition meta_type = 'ERP5 Inventory' portal_type = 'Inventory' - isPortalContent = 1 - isRADContent = 1 - isDelivery = 1 - isInventory = 1 + isInventory = ConstantGetter('isInventory', value=True) # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/InventoryCell.py b/product/ERP5/Document/InventoryCell.py index 5fafbe222d..8a001a33c0 100644 --- a/product/ERP5/Document/InventoryCell.py +++ b/product/ERP5/Document/InventoryCell.py @@ -30,6 +30,7 @@ from Acquisition import aq_base from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet, interfaces +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5.Document.DeliveryCell import DeliveryCell @@ -43,10 +44,7 @@ class InventoryCell(DeliveryCell): meta_type = 'ERP5 Inventory Cell' portal_type = 'Inventory Cell' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isMovement = 1 - isInventoryMovement = 1 + isInventoryMovement = ConstantGetter('isInventoryMovement', value=True) # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/InventoryLine.py b/product/ERP5/Document/InventoryLine.py index 99e0358247..bebc2dbcf5 100644 --- a/product/ERP5/Document/InventoryLine.py +++ b/product/ERP5/Document/InventoryLine.py @@ -32,6 +32,7 @@ from Acquisition import aq_base from Products.ERP5Type import Permissions, PropertySheet, interfaces from Products.ERP5.Document.DeliveryLine import DeliveryLine from Products.ERP5.Document.Movement import Movement +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from zLOG import LOG @@ -43,9 +44,7 @@ class InventoryLine(DeliveryLine): meta_type = 'ERP5 Inventory Line' portal_type = 'Inventory Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isInventoryMovement = 1 + isInventoryMovement = ConstantGetter('isInventoryMovement', value=True) # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Invoice.py b/product/ERP5/Document/Invoice.py index 1ca75942e6..e012b893fb 100644 --- a/product/ERP5/Document/Invoice.py +++ b/product/ERP5/Document/Invoice.py @@ -37,8 +37,6 @@ class Invoice(AccountingTransaction): meta_type = 'ERP5 Invoice' portal_type = 'Invoice' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/InvoiceCell.py b/product/ERP5/Document/InvoiceCell.py index 09fba378f7..0e82490fee 100644 --- a/product/ERP5/Document/InvoiceCell.py +++ b/product/ERP5/Document/InvoiceCell.py @@ -43,10 +43,7 @@ class InvoiceCell(DeliveryCell): meta_type = 'ERP5 Invoice Cell' portal_type = 'Invoice Cell' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 isCell = 1 - isMovement = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/InvoiceLine.py b/product/ERP5/Document/InvoiceLine.py index b19b068cd3..8d8e5c1fc4 100644 --- a/product/ERP5/Document/InvoiceLine.py +++ b/product/ERP5/Document/InvoiceLine.py @@ -48,8 +48,6 @@ class InvoiceLine(DeliveryLine): meta_type = 'ERP5 Invoice Line' portal_type = 'Invoice Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/InvoiceRule.py b/product/ERP5/Document/InvoiceRule.py index 92187b175e..75c0327bfe 100644 --- a/product/ERP5/Document/InvoiceRule.py +++ b/product/ERP5/Document/InvoiceRule.py @@ -44,8 +44,6 @@ class InvoiceRule(DeliveryRule): meta_type = 'ERP5 Invoice Rule' portal_type = 'Invoice Rule' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/InvoiceTransactionRule.py b/product/ERP5/Document/InvoiceTransactionRule.py index 4c4ce3b0ef..29478a139e 100644 --- a/product/ERP5/Document/InvoiceTransactionRule.py +++ b/product/ERP5/Document/InvoiceTransactionRule.py @@ -45,8 +45,6 @@ class InvoiceTransactionRule(Rule, PredicateMatrix): meta_type = 'ERP5 Invoice Transaction Rule' portal_type = 'Invoice Transaction Rule' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/InvoicingRule.py b/product/ERP5/Document/InvoicingRule.py index d753906061..cafc0caf47 100644 --- a/product/ERP5/Document/InvoicingRule.py +++ b/product/ERP5/Document/InvoicingRule.py @@ -42,8 +42,6 @@ class InvoicingRule(Rule): meta_type = 'ERP5 Invoicing Rule' portal_type = 'Invoicing Rule' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Item.py b/product/ERP5/Document/Item.py index f7e7e575ca..e0fe3386a5 100644 --- a/product/ERP5/Document/Item.py +++ b/product/ERP5/Document/Item.py @@ -57,8 +57,6 @@ class Item(XMLObject, Amount, ImmobilisableItem): meta_type = 'ERP5 Item' portal_type = 'Item' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Machine.py b/product/ERP5/Document/Machine.py index 040f3717df..82f66b2ae6 100644 --- a/product/ERP5/Document/Machine.py +++ b/product/ERP5/Document/Machine.py @@ -40,8 +40,6 @@ class Machine(Item): meta_type = 'ERP5 Machine' portal_type = 'Machine' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/MailMessage.py b/product/ERP5/Document/MailMessage.py index 0a30701fe8..40902f4422 100644 --- a/product/ERP5/Document/MailMessage.py +++ b/product/ERP5/Document/MailMessage.py @@ -55,8 +55,6 @@ class MailMessage(Event): meta_type = 'ERP5 Mail Message' portal_type = 'Mail Message' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/MappedValue.py b/product/ERP5/Document/MappedValue.py index 8645c4e3c0..bc77dba420 100644 --- a/product/ERP5/Document/MappedValue.py +++ b/product/ERP5/Document/MappedValue.py @@ -58,8 +58,6 @@ class MappedValue(Predicate, Amount): meta_type = 'ERP5 Mapped Value' portal_type = 'Mapped Value' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/MetaNode.py b/product/ERP5/Document/MetaNode.py index c094acfd33..e13322319d 100644 --- a/product/ERP5/Document/MetaNode.py +++ b/product/ERP5/Document/MetaNode.py @@ -42,8 +42,6 @@ class MetaNode(Node): meta_type = 'ERP5 MetaNode' portal_type = 'MetaNode' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/MetaResource.py b/product/ERP5/Document/MetaResource.py index fa67fed8c0..5f1867494d 100644 --- a/product/ERP5/Document/MetaResource.py +++ b/product/ERP5/Document/MetaResource.py @@ -41,8 +41,6 @@ class MetaResource(Resource): meta_type = 'ERP5 MetaResource' portal_type = 'MetaResource' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Movement.py b/product/ERP5/Document/Movement.py index db70699b8e..47d39d5115 100644 --- a/product/ERP5/Document/Movement.py +++ b/product/ERP5/Document/Movement.py @@ -175,9 +175,6 @@ class Movement(XMLObject, Amount): meta_type = 'ERP5 Movement' portal_type = 'Movement' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isMovement = 1 # Declarative security security = ClassSecurityInfo() @@ -198,6 +195,10 @@ class Movement(XMLObject, Amount): , PropertySheet.Price ) + security.declareProtected(Permissions.AccessContentsInformation, 'isMovement') + def isMovement(self): + return 1 + # Pricing methods # _getPrice is defined in the order / delivery # Pricing mehod diff --git a/product/ERP5/Document/NodeBudgetVariation.py b/product/ERP5/Document/NodeBudgetVariation.py index ff307a2ab2..5e5ffe7c78 100644 --- a/product/ERP5/Document/NodeBudgetVariation.py +++ b/product/ERP5/Document/NodeBudgetVariation.py @@ -77,8 +77,6 @@ class NodeBudgetVariation(BudgetVariation): meta_type = 'ERP5 Node Budget Variation' portal_type = 'Node Budget Variation' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/OpenOrder.py b/product/ERP5/Document/OpenOrder.py index 9ff84f81b3..f58932e5a3 100644 --- a/product/ERP5/Document/OpenOrder.py +++ b/product/ERP5/Document/OpenOrder.py @@ -31,6 +31,7 @@ from Products.ERP5Type.Globals import InitializeClass, PersistentMapping from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5.Document.Delivery import Delivery class OpenOrder(Delivery): @@ -39,7 +40,7 @@ class OpenOrder(Delivery): """ meta_type = 'ERP5 Open Order' portal_type = 'Open Order' - isPredicate = 1 # XXX - Why ? + isPredicate = ConstantGetter('isPredicate', value=True) # XXX - Why ? # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/OpenOrderCell.py b/product/ERP5/Document/OpenOrderCell.py index 50d16f1913..3068ac93b4 100644 --- a/product/ERP5/Document/OpenOrderCell.py +++ b/product/ERP5/Document/OpenOrderCell.py @@ -39,8 +39,6 @@ class OpenOrderCell(SupplyCell): meta_type = 'ERP5 Open Order Cell' portal_type = 'Open Order Cell' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/OpenOrderLine.py b/product/ERP5/Document/OpenOrderLine.py index bec50e2ab6..bc4796c8b2 100644 --- a/product/ERP5/Document/OpenOrderLine.py +++ b/product/ERP5/Document/OpenOrderLine.py @@ -40,9 +40,6 @@ class OpenOrderLine(SupplyLine): meta_type = 'ERP5 Open Order Line' portal_type = 'Open Order Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isPredicate = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Order.py b/product/ERP5/Document/Order.py index 86cd817003..f71ca4ba8c 100644 --- a/product/ERP5/Document/Order.py +++ b/product/ERP5/Document/Order.py @@ -41,7 +41,6 @@ class Order(Delivery): # CMF Type Definition meta_type = 'ERP5 Order' portal_type = 'Order' - isDelivery = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Organisation.py b/product/ERP5/Document/Organisation.py index d16231d3a6..7d6e895e1d 100644 --- a/product/ERP5/Document/Organisation.py +++ b/product/ERP5/Document/Organisation.py @@ -54,8 +54,6 @@ class Organisation(XMLObject): meta_type = 'ERP5 Organisation' portal_type = 'Organisation' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PDFDocument.py b/product/ERP5/Document/PDFDocument.py index a268586246..eb59d343d5 100644 --- a/product/ERP5/Document/PDFDocument.py +++ b/product/ERP5/Document/PDFDocument.py @@ -49,8 +49,6 @@ class PDFDocument(Image, CachedConvertableMixin): # CMF Type Definition meta_type = 'ERP5 PDF Document' portal_type = 'PDF' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PDFTypeInformation.py b/product/ERP5/Document/PDFTypeInformation.py index f83c98be7e..6891730f2d 100644 --- a/product/ERP5/Document/PDFTypeInformation.py +++ b/product/ERP5/Document/PDFTypeInformation.py @@ -40,8 +40,6 @@ class PDFTypeInformation(ERP5TypeInformation): # CMF Type Definition meta_type = 'ERP5 PDF Type Information' portal_type = 'PDF Type' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PackingList.py b/product/ERP5/Document/PackingList.py index 318f4195a5..7914768684 100644 --- a/product/ERP5/Document/PackingList.py +++ b/product/ERP5/Document/PackingList.py @@ -63,7 +63,6 @@ class PackingList(Delivery): meta_type = 'ERP5 Packing List' portal_type = 'Packing List' add_permission = Permissions.AddPortalContent - isDelivery = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Path.py b/product/ERP5/Document/Path.py index 29c796a9cf..6b3a2ae75b 100644 --- a/product/ERP5/Document/Path.py +++ b/product/ERP5/Document/Path.py @@ -50,8 +50,6 @@ class Path(MappedValue): meta_type = 'ERP5 Path' portal_type = 'Path' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PaySheetCell.py b/product/ERP5/Document/PaySheetCell.py index 73d03db7e0..f984458710 100644 --- a/product/ERP5/Document/PaySheetCell.py +++ b/product/ERP5/Document/PaySheetCell.py @@ -39,10 +39,7 @@ class PaySheetCell(InvoiceCell): meta_type = 'ERP5 Pay Sheet Cell' portal_type = 'Pay Sheet Cell' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 isCell = 1 - isMovement = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PaySheetLine.py b/product/ERP5/Document/PaySheetLine.py index 985f43dbd7..a076c65d5e 100644 --- a/product/ERP5/Document/PaySheetLine.py +++ b/product/ERP5/Document/PaySheetLine.py @@ -42,8 +42,6 @@ class PaySheetLine(InvoiceLine): meta_type = 'ERP5 Pay Sheet Line' portal_type = 'Pay Sheet Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PaySheetModel.py b/product/ERP5/Document/PaySheetModel.py index ffbdf137e5..9c42307c3a 100644 --- a/product/ERP5/Document/PaySheetModel.py +++ b/product/ERP5/Document/PaySheetModel.py @@ -42,7 +42,6 @@ class PaySheetModel(TradeCondition): meta_type = 'ERP5 Pay Sheet Model' portal_type = 'Pay Sheet Model' model_line_portal_type_list = 'Pay Sheet Model Line' - isPredicate = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PaySheetModelLine.py b/product/ERP5/Document/PaySheetModelLine.py index bd82225034..6a7b97ee47 100644 --- a/product/ERP5/Document/PaySheetModelLine.py +++ b/product/ERP5/Document/PaySheetModelLine.py @@ -43,8 +43,6 @@ class PaySheetModelLine(TradeModelLine): meta_type = 'ERP5 Pay Sheet Model Line' portal_type = 'Pay Sheet Model Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PaySheetModelSlice.py b/product/ERP5/Document/PaySheetModelSlice.py index 22a3f8ddf5..d281464307 100644 --- a/product/ERP5/Document/PaySheetModelSlice.py +++ b/product/ERP5/Document/PaySheetModelSlice.py @@ -39,7 +39,6 @@ class PaySheetModelSlice(DeliveryCell): meta_type = 'ERP5 Pay Sheet Model Slice' portal_type = 'Pay Sheet Model Slice' isCell = 1 - isMovement = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PaySheetTransaction.py b/product/ERP5/Document/PaySheetTransaction.py index 459f254438..8814ca2e3a 100644 --- a/product/ERP5/Document/PaySheetTransaction.py +++ b/product/ERP5/Document/PaySheetTransaction.py @@ -41,8 +41,6 @@ class PaySheetTransaction(Invoice): meta_type = 'ERP5 Pay Sheet Transaction' portal_type = 'Pay Sheet Transaction' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PaySheetTransactionLine.py b/product/ERP5/Document/PaySheetTransactionLine.py index 611e0fa03e..6a2fa3dac9 100644 --- a/product/ERP5/Document/PaySheetTransactionLine.py +++ b/product/ERP5/Document/PaySheetTransactionLine.py @@ -39,8 +39,6 @@ class PaySheetTransactionLine(AccountingTransactionLine): meta_type = 'ERP5 Pay Sheet Transaction Line' portal_type = 'Pay Sheet Transaction Line' add_permission = Permissions.AddERP5Content - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PaymentCondition.py b/product/ERP5/Document/PaymentCondition.py index 28471c09d1..566b9cf485 100644 --- a/product/ERP5/Document/PaymentCondition.py +++ b/product/ERP5/Document/PaymentCondition.py @@ -40,8 +40,6 @@ class PaymentCondition(XMLObject): meta_type = 'ERP5 Payment Condition' portal_type = 'Payment Condition' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PaymentRule.py b/product/ERP5/Document/PaymentRule.py index 43209e6e05..90fd08da15 100644 --- a/product/ERP5/Document/PaymentRule.py +++ b/product/ERP5/Document/PaymentRule.py @@ -44,8 +44,6 @@ class PaymentRule(Rule): meta_type = 'ERP5 Payment Rule' portal_type = 'Payment Rule' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PeriodicityLine.py b/product/ERP5/Document/PeriodicityLine.py index af2bcfde35..daf9853c5e 100644 --- a/product/ERP5/Document/PeriodicityLine.py +++ b/product/ERP5/Document/PeriodicityLine.py @@ -74,9 +74,6 @@ class PeriodicityLine(Path, PeriodicityLineMixin): meta_type = 'ERP5 Periodicity Line' portal_type = 'Periodicity Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isPredicate = 1 security = ClassSecurityInfo() security.declareObjectProtected(Permissions.AccessContentsInformation) diff --git a/product/ERP5/Document/Person.py b/product/ERP5/Document/Person.py index 3c2b387023..c2fd85d2f5 100644 --- a/product/ERP5/Document/Person.py +++ b/product/ERP5/Document/Person.py @@ -78,8 +78,6 @@ class Person(XMLObject): meta_type = 'ERP5 Person' portal_type = 'Person' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PortalTest.py b/product/ERP5/Document/PortalTest.py index f0645d354b..8fc58620ee 100644 --- a/product/ERP5/Document/PortalTest.py +++ b/product/ERP5/Document/PortalTest.py @@ -43,8 +43,6 @@ class PortalTest(MappedValue, XMLMatrix): meta_type = 'ERP5 Portal Test' portal_type = 'Portal Test' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Predicate.py b/product/ERP5/Document/Predicate.py index 0ec582907b..8b0af8862f 100644 --- a/product/ERP5/Document/Predicate.py +++ b/product/ERP5/Document/Predicate.py @@ -35,6 +35,7 @@ from Acquisition import aq_base, aq_inner from Products.CMFCore.utils import getToolByName from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Core.Folder import Folder from Products.ERP5Type.Document import newTempBase from Products.ERP5Type.XMLObject import XMLObject @@ -68,9 +69,7 @@ class Predicate(XMLObject, Folder): meta_type = 'ERP5 Predicate' portal_type = 'Predicate' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isPredicate = 1 + isPredicate = ConstantGetter('isPredicate', value=True) # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PredicateMatrix.py b/product/ERP5/Document/PredicateMatrix.py index 6afb8a2c69..7277894e63 100644 --- a/product/ERP5/Document/PredicateMatrix.py +++ b/product/ERP5/Document/PredicateMatrix.py @@ -44,8 +44,6 @@ class PredicateMatrix(XMLMatrix): meta_type = 'ERP5 Predicate Matrix' portal_type = 'Predicate Matrix' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 predicate_matrix_base_id = "movement" # Declarative security diff --git a/product/ERP5/Document/Pricing.py b/product/ERP5/Document/Pricing.py index 6f46d08e51..db32bf3413 100644 --- a/product/ERP5/Document/Pricing.py +++ b/product/ERP5/Document/Pricing.py @@ -43,8 +43,6 @@ class Pricing(MappedValue, XMLMatrix): meta_type = 'ERP5 Pricing' portal_type = 'Pricing' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/ProductionReport.py b/product/ERP5/Document/ProductionReport.py index b977571dfc..609d09c1ad 100644 --- a/product/ERP5/Document/ProductionReport.py +++ b/product/ERP5/Document/ProductionReport.py @@ -41,7 +41,6 @@ class ProductionReport(Delivery): # CMF Type Definition meta_type = 'ERP5 Production Report' portal_type = 'Production Report' - isDelivery = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/ProductionReportCell.py b/product/ERP5/Document/ProductionReportCell.py index 24d28b771f..fa44cd7349 100644 --- a/product/ERP5/Document/ProductionReportCell.py +++ b/product/ERP5/Document/ProductionReportCell.py @@ -41,7 +41,6 @@ class ProductionReportCell(DeliveryCell): meta_type = 'ERP5 Production Report Cell' portal_type = 'Production Report Cell' - isMovement = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Project.py b/product/ERP5/Document/Project.py index 4dce8e6b77..5a379faf43 100644 --- a/product/ERP5/Document/Project.py +++ b/product/ERP5/Document/Project.py @@ -47,8 +47,6 @@ class Project(Order): meta_type = 'ERP5 Project' portal_type = 'Project' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/ProjectReport.py b/product/ERP5/Document/ProjectReport.py index f4094f7de0..a07d6c2741 100644 --- a/product/ERP5/Document/ProjectReport.py +++ b/product/ERP5/Document/ProjectReport.py @@ -49,8 +49,6 @@ class ProjectReport(Delivery): meta_type = 'ERP5 Project Report' portal_type = 'Project Report' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/PropertyDivergenceTester.py b/product/ERP5/Document/PropertyDivergenceTester.py index a072444d45..bc0bdc404f 100644 --- a/product/ERP5/Document/PropertyDivergenceTester.py +++ b/product/ERP5/Document/PropertyDivergenceTester.py @@ -48,8 +48,6 @@ class PropertyDivergenceTester(Predicate): meta_type = 'ERP5 Property Divergence Tester' portal_type = 'Property Divergence Tester' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/QuantityDivergenceTester.py b/product/ERP5/Document/QuantityDivergenceTester.py index d604ee1fa3..49de972413 100644 --- a/product/ERP5/Document/QuantityDivergenceTester.py +++ b/product/ERP5/Document/QuantityDivergenceTester.py @@ -44,8 +44,6 @@ class QuantityDivergenceTester(PropertyDivergenceTester): meta_type = 'ERP5 Quantity Divergence Tester' portal_type = 'Quantity Divergence Tester' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/QuantitySplitSolver.py b/product/ERP5/Document/QuantitySplitSolver.py index a34f8f9bcf..ce2af213f8 100644 --- a/product/ERP5/Document/QuantitySplitSolver.py +++ b/product/ERP5/Document/QuantitySplitSolver.py @@ -40,8 +40,6 @@ class QuantitySplitSolver(XMLObject): meta_type = 'ERP5 Quantity Split Solver' portal_type = 'Quantity Split Solver' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 isIndexable = 0 # We do not want to fill the catalog with objects on which we need no reporting # Declarative security diff --git a/product/ERP5/Document/Resource.py b/product/ERP5/Document/Resource.py index 91cd063b83..8f62398afe 100644 --- a/product/ERP5/Document/Resource.py +++ b/product/ERP5/Document/Resource.py @@ -51,8 +51,6 @@ class Resource(XMLMatrix, Variated): meta_type = 'ERP5 Resource' portal_type = 'Resource' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/RoleDefinition.py b/product/ERP5/Document/RoleDefinition.py index 5a812e1862..043b762439 100644 --- a/product/ERP5/Document/RoleDefinition.py +++ b/product/ERP5/Document/RoleDefinition.py @@ -37,8 +37,6 @@ class RoleDefinition(XMLObject): # CMF Type Definition meta_type = 'ERP5 Role Definition' portal_type = 'Role Definition' - isPortalContent = 1 - isRADContent = 1 add_permission = Permissions.ChangeLocalRoles # Declarative security diff --git a/product/ERP5/Document/Rule.py b/product/ERP5/Document/Rule.py index 85a8accf0d..4ef35992b9 100644 --- a/product/ERP5/Document/Rule.py +++ b/product/ERP5/Document/Rule.py @@ -68,9 +68,6 @@ class Rule(Predicate, XMLObject): meta_type = 'ERP5 Rule' portal_type = 'Rule' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isPredicate = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/SaleOpportunity.py b/product/ERP5/Document/SaleOpportunity.py index 5b25fcc016..553fcc41a1 100644 --- a/product/ERP5/Document/SaleOpportunity.py +++ b/product/ERP5/Document/SaleOpportunity.py @@ -42,9 +42,6 @@ class SaleOpportunity(Ticket): meta_type = 'ERP5 Sale Opportunity' portal_type = 'Sale Opportunity' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isDelivery = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/SetPricing.py b/product/ERP5/Document/SetPricing.py index d6f0d1af0a..e7c20dc90e 100644 --- a/product/ERP5/Document/SetPricing.py +++ b/product/ERP5/Document/SetPricing.py @@ -43,8 +43,6 @@ class SetPricing(MappedValue, XMLMatrix): meta_type = 'ERP5 Set Pricing' portal_type = 'Set Pricing' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/SimulationMovement.py b/product/ERP5/Document/SimulationMovement.py index 0e1b19a40e..52e7ab2a68 100644 --- a/product/ERP5/Document/SimulationMovement.py +++ b/product/ERP5/Document/SimulationMovement.py @@ -99,7 +99,6 @@ class SimulationMovement(Movement, PropertyRecordableMixin): """ meta_type = 'ERP5 Simulation Movement' portal_type = 'Simulation Movement' - isMovement = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/SolverDecision.py b/product/ERP5/Document/SolverDecision.py index d3bf6db32b..b3f73d3970 100644 --- a/product/ERP5/Document/SolverDecision.py +++ b/product/ERP5/Document/SolverDecision.py @@ -64,8 +64,6 @@ class SolverDecision(XMLObject): meta_type = 'ERP5 Solver Decision' portal_type = 'Solver Decision' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 isIndexable = 0 # We do not want to fill the catalog with objects on which we need no reporting # Declarative security diff --git a/product/ERP5/Document/SolverProcess.py b/product/ERP5/Document/SolverProcess.py index f239d950db..e14746a00a 100644 --- a/product/ERP5/Document/SolverProcess.py +++ b/product/ERP5/Document/SolverProcess.py @@ -58,8 +58,6 @@ class SolverProcess(XMLObject, ActiveProcess): meta_type = 'ERP5 Solver Process' portal_type = 'Solver Process' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 isIndexable = 0 # We do not want to fill the catalog with objects on which we need no reporting # Declarative security diff --git a/product/ERP5/Document/SolverTypeInformation.py b/product/ERP5/Document/SolverTypeInformation.py index 8ea675b3c5..c8c969122c 100644 --- a/product/ERP5/Document/SolverTypeInformation.py +++ b/product/ERP5/Document/SolverTypeInformation.py @@ -40,8 +40,6 @@ class SolverTypeInformation(ERP5TypeInformation): # CMF Type Definition meta_type = 'ERP5 Solver Type Information' portal_type = 'Solver Type' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/StringDivergenceTester.py b/product/ERP5/Document/StringDivergenceTester.py index 72ba24020c..f4705e7d12 100644 --- a/product/ERP5/Document/StringDivergenceTester.py +++ b/product/ERP5/Document/StringDivergenceTester.py @@ -44,8 +44,6 @@ class StringDivergenceTester(Predicate): meta_type = 'ERP5 String Divergence Tester' portal_type = 'String Divergence Tester' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/SubscriptionItem.py b/product/ERP5/Document/SubscriptionItem.py index e0c0deb70c..64f5766752 100644 --- a/product/ERP5/Document/SubscriptionItem.py +++ b/product/ERP5/Document/SubscriptionItem.py @@ -40,8 +40,6 @@ class SubscriptionItem(Item): """ meta_type = 'ERP5 Subscription Item' portal_type = 'Subscription Item' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Supply.py b/product/ERP5/Document/Supply.py index 69f33aa509..ff92f3561a 100644 --- a/product/ERP5/Document/Supply.py +++ b/product/ERP5/Document/Supply.py @@ -41,9 +41,6 @@ class Supply(Path, XMLObject): # CMF Type Definition meta_type = 'ERP5 Supply' portal_type = 'Supply' - isPortalContent = 1 - isRADContent = 1 - isPredicate = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/SupplyCell.py b/product/ERP5/Document/SupplyCell.py index 289c6eaca1..68ada5bf28 100644 --- a/product/ERP5/Document/SupplyCell.py +++ b/product/ERP5/Document/SupplyCell.py @@ -46,8 +46,6 @@ class SupplyCell(Predicate, DeliveryCell, Path): meta_type = 'ERP5 Supply Cell' portal_type = 'Supply Cell' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/SupplyLine.py b/product/ERP5/Document/SupplyLine.py index ba224d9946..641c74880e 100644 --- a/product/ERP5/Document/SupplyLine.py +++ b/product/ERP5/Document/SupplyLine.py @@ -29,6 +29,7 @@ from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.XMLMatrix import XMLMatrix from Products.ERP5.Document.DeliveryLine import DeliveryLine from Products.ERP5.Document.Path import Path @@ -43,9 +44,7 @@ class SupplyLine(DeliveryLine, Path): meta_type = 'ERP5 Supply Line' portal_type = 'Supply Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isPredicate = 1 + isPredicate = ConstantGetter('isPredicate', value=True) # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/SupplyRule.py b/product/ERP5/Document/SupplyRule.py index 0fee903cc9..c94cc87b89 100644 --- a/product/ERP5/Document/SupplyRule.py +++ b/product/ERP5/Document/SupplyRule.py @@ -43,8 +43,6 @@ class SupplyRule(MappedValue, XMLMatrix): meta_type = 'ERP5 Supply Rule' portal_type = 'Supply Rule' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Telephone.py b/product/ERP5/Document/Telephone.py index c294e8b183..9735e7df75 100644 --- a/product/ERP5/Document/Telephone.py +++ b/product/ERP5/Document/Telephone.py @@ -54,8 +54,6 @@ class Telephone(Coordinate, Base): meta_type = 'ERP5 Telephone' portal_type = 'Telephone' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/TextDocument.py b/product/ERP5/Document/TextDocument.py index 73d51f1c00..9b5062949a 100644 --- a/product/ERP5/Document/TextDocument.py +++ b/product/ERP5/Document/TextDocument.py @@ -71,9 +71,6 @@ class TextDocument(Document, TextContent): meta_type = 'ERP5 Text Document' portal_type = 'Text Document' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isDocument = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Ticket.py b/product/ERP5/Document/Ticket.py index e9c820fe86..83844cde5a 100644 --- a/product/ERP5/Document/Ticket.py +++ b/product/ERP5/Document/Ticket.py @@ -29,6 +29,7 @@ from AccessControl import ClassSecurityInfo from Products.ERP5Type import Permissions, PropertySheet, Constraint, interfaces +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5.Document.Movement import Movement from Products.ERP5.Document.Project import Project @@ -57,9 +58,7 @@ class Ticket(Movement, Project): meta_type = 'ERP5 Ticket' portal_type = 'Ticket' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 - isDelivery = 1 + isDelivery = ConstantGetter('isDelivery', value=True) # Declarative security security = ClassSecurityInfo() @@ -84,4 +83,4 @@ class Ticket(Movement, Project): Only account movements which are not associated to a delivery Whenever delivery is there, delivery has priority """ - return 1 \ No newline at end of file + return 1 diff --git a/product/ERP5/Document/TradeCondition.py b/product/ERP5/Document/TradeCondition.py index a9b4d82fd8..5a96f6822b 100644 --- a/product/ERP5/Document/TradeCondition.py +++ b/product/ERP5/Document/TradeCondition.py @@ -58,7 +58,6 @@ class TradeCondition(Path, Transformation, XMLMatrix): meta_type = 'ERP5 Trade Condition' portal_type = 'Trade Condition' model_line_portal_type_list = ('Trade Model Line',) - isPredicate = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Transformation.py b/product/ERP5/Document/Transformation.py index 774c169861..84cc77e577 100644 --- a/product/ERP5/Document/Transformation.py +++ b/product/ERP5/Document/Transformation.py @@ -56,8 +56,6 @@ class Transformation(XMLObject, Predicate, Variated): Matrixbox must be rewrite for a clean implementation of n base category """ - isMovement = 1 # XXX very stupid, but for doing a test on catalog - meta_type = 'ERP5 Transformation' portal_type = 'Transformation' diff --git a/product/ERP5/Document/Url.py b/product/ERP5/Document/Url.py index b740fd7e6c..7e9d358f01 100644 --- a/product/ERP5/Document/Url.py +++ b/product/ERP5/Document/Url.py @@ -143,8 +143,6 @@ class Url(Coordinate, Base, UrlMixIn): meta_type = 'ERP5 Url' portal_type = 'Url' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/VariatedProperty.py b/product/ERP5/Document/VariatedProperty.py index 8d0f0e91c5..8125fde454 100644 --- a/product/ERP5/Document/VariatedProperty.py +++ b/product/ERP5/Document/VariatedProperty.py @@ -51,8 +51,6 @@ class VariatedProperty(XMLObject, XMLMatrix): meta_type = 'ERP5 Variated Property' portal_type = 'Variated Property' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Variation.py b/product/ERP5/Document/Variation.py index 5aaa1e0895..277a2cca10 100644 --- a/product/ERP5/Document/Variation.py +++ b/product/ERP5/Document/Variation.py @@ -42,8 +42,6 @@ class Variation(XMLObject): meta_type = 'ERP5 Variation' portal_type = 'Variation' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/WebSection.py b/product/ERP5/Document/WebSection.py index fcbc25d8fd..c540956cb3 100644 --- a/product/ERP5/Document/WebSection.py +++ b/product/ERP5/Document/WebSection.py @@ -77,8 +77,6 @@ class WebSection(Domain, PermanentURLMixIn): # CMF Type Definition meta_type = 'ERP5 Web Section' portal_type = 'Web Section' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/WebSite.py b/product/ERP5/Document/WebSite.py index dcc5f14585..b750c7a133 100644 --- a/product/ERP5/Document/WebSite.py +++ b/product/ERP5/Document/WebSite.py @@ -140,8 +140,6 @@ class WebSite(WebSection): # CMF Type Definition meta_type = 'ERP5 Web Site' portal_type = 'Web Site' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5/Document/Wiki.py b/product/ERP5/Document/Wiki.py index 1dab671319..9ebb253ebe 100644 --- a/product/ERP5/Document/Wiki.py +++ b/product/ERP5/Document/Wiki.py @@ -55,8 +55,6 @@ class Wiki( Document ): meta_type='ERP5 Wiki' portal_type='Wiki' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() @@ -337,4 +335,4 @@ class Wiki( Document ): if preformatted: append('</pre>') - return '\n'.join(line_list) \ No newline at end of file + return '\n'.join(line_list) diff --git a/product/ERP5/ERP5Site.py b/product/ERP5/ERP5Site.py index 7b55e2a619..448d379439 100644 --- a/product/ERP5/ERP5Site.py +++ b/product/ERP5/ERP5Site.py @@ -28,6 +28,8 @@ from Products.ERP5Type import Permissions, PropertySheet, Constraint from Products.ERP5Type.Core.Folder import FolderMixIn from Acquisition import aq_base, aq_parent, aq_inner, aq_acquire from Products.ERP5Type import allowClassTool +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter +from Products.ERP5Type.Cache import caching_instance_method from Products.ERP5Type.Cache import CachingMethod from Products.ERP5Type.ERP5Type import ERP5TypeInformation from Products.ERP5.Document.BusinessTemplate import BusinessTemplate @@ -187,7 +189,8 @@ class ERP5Site(FolderMixIn, CMFSite): uid = 0 last_id = 0 icon = 'portal.gif' - isIndexable = 1 # Default value, prevents error during upgrade + # Default value, prevents error during upgrade + isIndexable = ConstantGetter('isIndexable', value=True) _properties = ( { 'id':'title', @@ -427,11 +430,14 @@ class ERP5Site(FolderMixIn, CMFSite): # Fall back to the default. return getattr(ERP5Defaults, id, None) - def _getPortalGroupedTypeList(self, group): + def _getPortalGroupedTypeList(self, group, enable_sort=True): """ Return a list of portal types classified to a specific group. The result is sorted by language (using the user language as default) + + Enable_sort parameter was added in order to allows looking groups + of portal type without sorting. This is better for performance """ def getTypeList(group): type_list = [] @@ -439,7 +445,10 @@ class ERP5Site(FolderMixIn, CMFSite): if group in getattr(pt, 'group_list', ()): type_list.append(pt.getId()) - if len(type_list) >= 2: + if enable_sort and len(type_list) >= 2: + # XXX (Seb), this code must be moved in another place. + # It is inefficient to always sort here for some particular + # needs of the user interface translate = localizer_tool.translate type_list.sort(key=lambda x:translate('ui', x)) return tuple(type_list) @@ -449,12 +458,23 @@ class ERP5Site(FolderMixIn, CMFSite): # language should be cached in Transaction Cache if performance issue getTypeList = CachingMethod(getTypeList, - id=(('_getPortalGroupedTypeList', language), group), - cache_factory='erp5_content_medium') + id=(('_getPortalGroupedTypeList', language), group, + enable_sort), + cache_factory='erp5_content_medium', + ) return getTypeList(group) # Although this method is called get*List, it # returns a tuple - renaming to be considered + @caching_instance_method(id='ERP5Site._getPortalGroupedTypeSet', + cache_factory='erp5_content_long') + def _getPortalGroupedTypeSet(self, group): + """ + Same as _getPortalGroupedTypeList, but returns a set, better for + performance when looking for matching portal types + """ + return set(self._getPortalGroupedTypeList(group, enable_sort=False)) + def _getPortalGroupedCategoryList(self, group): """ Return a list of base categories classified to a specific group. @@ -1425,7 +1445,7 @@ class ERP5Generator(PortalGenerator): portal = self.klass(id=id) # Make sure reindex will not be called until business templates # will be installed - setattr(portal, 'isIndexable', 0) + setattr(portal, 'isIndexable', ConstantGetter('isIndexable', value=False)) parent._setObject(id, portal) # Return the fully wrapped object. p = parent.this()._getOb(id) @@ -1792,7 +1812,7 @@ class ERP5Generator(PortalGenerator): # When no SQL connection was define on the site, # we don't want to make it crash if p.erp5_sql_connection_type is not None: - setattr(p, 'isIndexable', 1) + setattr(p, 'isIndexable', ConstantGetter('isIndexable', value=True)) portal_catalog = p.portal_catalog # Clear portal ids sql table, like this we do not take # ids for a previously created web site diff --git a/product/ERP5/Extensions/InventoryBrain.py b/product/ERP5/Extensions/InventoryBrain.py index 58f8275f55..8c03bf222e 100644 --- a/product/ERP5/Extensions/InventoryBrain.py +++ b/product/ERP5/Extensions/InventoryBrain.py @@ -235,9 +235,9 @@ class InventoryListBrain(ZSQLBrain): # default case, if it's a movement, return link to the explanation of this # movement. - o = self.getObject() - if getattr(o, 'isMovement', 0): - explanation = o.getExplanationValue() + document = self.getObject() + if document.isMovement(): + explanation = document.getExplanationValue() if explanation is not None: return '%s/%s/view' % ( self.portal_url.getPortalObject().absolute_url(), diff --git a/product/ERP5/Tool/TrashTool.py b/product/ERP5/Tool/TrashTool.py index 48fe265b59..d5df6bae54 100644 --- a/product/ERP5/Tool/TrashTool.py +++ b/product/ERP5/Tool/TrashTool.py @@ -28,6 +28,7 @@ from AccessControl import ClassSecurityInfo +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Globals import InitializeClass, DTMLFile from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type import Permissions @@ -101,7 +102,7 @@ class TrashTool(BaseTool): copy.seek(0) backup = connection.importFile(copy) try: - backup.isIndexable = 0 + backup.isIndexable = ConstantGetter('isIndexable', value=False) backup_object_container._setObject(object_id, backup) except AttributeError: # XXX we can go here due to formulator because attribute field_added diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_item_list.catalog_keys.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_item_list.catalog_keys.xml index 280fabdb6a..cef8023f0d 100644 --- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_item_list.catalog_keys.xml +++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_item_list.catalog_keys.xml @@ -6,8 +6,8 @@ <value>1</value> </item> <item key="_filter_expression_archive" type="str"> - <value>python: isMovement</value> + <value>python: here.providesIMovement()</value> </item> <item key="_filter_type_archive" type="tuple"> </item> -</catalog_method> \ No newline at end of file +</catalog_method> diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_movement_category_list.catalog_keys.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_movement_category_list.catalog_keys.xml index 280fabdb6a..cef8023f0d 100644 --- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_movement_category_list.catalog_keys.xml +++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_movement_category_list.catalog_keys.xml @@ -6,8 +6,8 @@ <value>1</value> </item> <item key="_filter_expression_archive" type="str"> - <value>python: isMovement</value> + <value>python: here.providesIMovement()</value> </item> <item key="_filter_type_archive" type="tuple"> </item> -</catalog_method> \ No newline at end of file +</catalog_method> diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_movement_list.catalog_keys.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_movement_list.catalog_keys.xml index 280fabdb6a..cef8023f0d 100644 --- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_movement_list.catalog_keys.xml +++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_movement_list.catalog_keys.xml @@ -6,8 +6,8 @@ <value>1</value> </item> <item key="_filter_expression_archive" type="str"> - <value>python: isMovement</value> + <value>python: here.providesIMovement()</value> </item> <item key="_filter_type_archive" type="tuple"> </item> -</catalog_method> \ No newline at end of file +</catalog_method> diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_non_movement_category_list.catalog_keys.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_non_movement_category_list.catalog_keys.xml index a18c9cdbe0..e61491cc19 100644 --- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_non_movement_category_list.catalog_keys.xml +++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_non_movement_category_list.catalog_keys.xml @@ -6,8 +6,8 @@ <value>1</value> </item> <item key="_filter_expression_archive" type="str"> - <value>python: not isMovement</value> + <value>python: not here.providesIMovement()</value> </item> <item key="_filter_type_archive" type="tuple"> </item> -</catalog_method> \ No newline at end of file +</catalog_method> diff --git a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_stock_list.catalog_keys.xml b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_stock_list.catalog_keys.xml index 29207f86f5..1c0ffbea01 100644 --- a/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_stock_list.catalog_keys.xml +++ b/product/ERP5/bootstrap/erp5_mysql_innodb_catalog/CatalogMethodTemplateItem/portal_catalog/erp5_mysql_innodb/z_catalog_stock_list.catalog_keys.xml @@ -6,8 +6,8 @@ <value>1</value> </item> <item key="_filter_expression_archive" type="str"> - <value>python: isMovement and not isInventoryMovement</value> + <value>python: here.providesIMovement() and not isInventoryMovement</value> </item> <item key="_filter_type_archive" type="tuple"> </item> -</catalog_method> \ No newline at end of file +</catalog_method> diff --git a/product/ERP5Banking/Document/BankingOperation.py b/product/ERP5Banking/Document/BankingOperation.py index 7c87753ca4..47c6e74e74 100755 --- a/product/ERP5Banking/Document/BankingOperation.py +++ b/product/ERP5Banking/Document/BankingOperation.py @@ -45,8 +45,6 @@ class BankingOperation(BaobabMixin, AccountingTransaction): # CMF Type Definition meta_type = 'ERP5Banking Banking Operation' portal_type = 'Banking Operation' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Banking/Document/BankingOperationLine.py b/product/ERP5Banking/Document/BankingOperationLine.py index 15a3ae6b32..fcd19bcd03 100755 --- a/product/ERP5Banking/Document/BankingOperationLine.py +++ b/product/ERP5Banking/Document/BankingOperationLine.py @@ -35,8 +35,6 @@ class BankingOperationLine(BaobabMixin, AccountingTransactionLine): # CMF Type Definition meta_type = 'ERP5Banking Banking Operation Line' portal_type = 'Banking Operation Line' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Banking/Document/CashContainer.py b/product/ERP5Banking/Document/CashContainer.py index cd848588da..976838ba97 100755 --- a/product/ERP5Banking/Document/CashContainer.py +++ b/product/ERP5Banking/Document/CashContainer.py @@ -43,8 +43,6 @@ class CashContainer(Container): meta_type = 'ERP5Banking Cash Container' portal_type = 'Cash Container' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Banking/Document/CashCurrency.py b/product/ERP5Banking/Document/CashCurrency.py index 7c106256c9..93640cd0d3 100755 --- a/product/ERP5Banking/Document/CashCurrency.py +++ b/product/ERP5Banking/Document/CashCurrency.py @@ -45,8 +45,6 @@ class CashCurrency(Resource): meta_type = 'ERP5Banking Cash Currency' portal_type = 'Cash Currency' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Banking/Document/CashDelivery.py b/product/ERP5Banking/Document/CashDelivery.py index 27b4f70f40..30d25f52b7 100755 --- a/product/ERP5Banking/Document/CashDelivery.py +++ b/product/ERP5Banking/Document/CashDelivery.py @@ -38,8 +38,6 @@ class CashDelivery(BankingOperation): meta_type = 'ERP5Banking Cash Delivery' portal_type = 'Cash Delivery' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Banking/Document/CashDeliveryCell.py b/product/ERP5Banking/Document/CashDeliveryCell.py index 5814656ff2..55ed2a46df 100755 --- a/product/ERP5Banking/Document/CashDeliveryCell.py +++ b/product/ERP5Banking/Document/CashDeliveryCell.py @@ -43,8 +43,6 @@ class CashDeliveryCell(BaobabMixin, DeliveryCell): meta_type = 'ERP5Banking Cash Delivery Cell' portal_type = 'Cash Delivery Cell' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Banking/Document/CashDeliveryLine.py b/product/ERP5Banking/Document/CashDeliveryLine.py index aebd9db7f6..d73b0520dd 100755 --- a/product/ERP5Banking/Document/CashDeliveryLine.py +++ b/product/ERP5Banking/Document/CashDeliveryLine.py @@ -44,8 +44,6 @@ class CashDeliveryLine(BaobabMixin, DeliveryLine): meta_type = 'ERP5Banking Cash Delivery Line' portal_type = 'Cash Delivery Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Banking/Document/CashInventory.py b/product/ERP5Banking/Document/CashInventory.py index 50b7717b7b..e815dab61b 100644 --- a/product/ERP5Banking/Document/CashInventory.py +++ b/product/ERP5Banking/Document/CashInventory.py @@ -39,9 +39,6 @@ class CashInventory(Inventory, BankingOperation): # CMF Type Definition meta_type = 'ERP5Banking Cash Inventory' portal_type = 'Cash Inventory' - isPortalContent = 1 - isRADContent = 1 - isDelivery = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Banking/Document/CashInventoryCell.py b/product/ERP5Banking/Document/CashInventoryCell.py index b1eb5e28a9..010d11c46a 100755 --- a/product/ERP5Banking/Document/CashInventoryCell.py +++ b/product/ERP5Banking/Document/CashInventoryCell.py @@ -40,8 +40,6 @@ class CashInventoryCell(InventoryCell, CashDeliveryCell): meta_type = 'ERP5Banking Cash Inventory Cell' portal_type = 'Cash Inventory Cell' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Banking/Document/CashInventoryLine.py b/product/ERP5Banking/Document/CashInventoryLine.py index adda58dd6b..124bb36ca0 100755 --- a/product/ERP5Banking/Document/CashInventoryLine.py +++ b/product/ERP5Banking/Document/CashInventoryLine.py @@ -41,8 +41,6 @@ class CashInventoryLine(InventoryLine, CashDeliveryLine): meta_type = 'ERP5Banking Cash Inventory Line' portal_type = 'Cash Inventory Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Banking/Document/CheckOperationLine.py b/product/ERP5Banking/Document/CheckOperationLine.py index 59a0479662..036fd59026 100755 --- a/product/ERP5Banking/Document/CheckOperationLine.py +++ b/product/ERP5Banking/Document/CheckOperationLine.py @@ -39,8 +39,6 @@ class CheckOperationLine(BaobabMixin, DeliveryLine): meta_type = 'ERP5Banking Check Operation Line' portal_type = 'Cash Operation Line' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Catalog/Document/Archive.py b/product/ERP5Catalog/Document/Archive.py index 02efb48a00..2c872b573e 100755 --- a/product/ERP5Catalog/Document/Archive.py +++ b/product/ERP5Catalog/Document/Archive.py @@ -43,8 +43,6 @@ class Archive(Predicate): meta_type = 'ERP5 Archive' portal_type = 'Archive' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() @@ -59,6 +57,3 @@ class Archive(Predicate): , PropertySheet.Archive ) - isIndexable = 1 - - diff --git a/product/ERP5Form/CreatePropertySheet.py b/product/ERP5Form/CreatePropertySheet.py index d3d1fd1565..33da47fd1d 100644 --- a/product/ERP5Form/CreatePropertySheet.py +++ b/product/ERP5Form/CreatePropertySheet.py @@ -137,8 +137,6 @@ class %(class_name)s(Node, XMLObject): meta_type = 'ERP5 %(portal_type_name)s' portal_type = '%(portal_type_name)s' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative Security security = ClassSecurityInfo() diff --git a/product/ERP5Form/Document/Preference.py b/product/ERP5Form/Document/Preference.py index d64f15a9da..e65a997cc7 100644 --- a/product/ERP5Form/Document/Preference.py +++ b/product/ERP5Form/Document/Preference.py @@ -50,8 +50,6 @@ class Preference( Folder ): meta_type = 'ERP5 Preference' portal_type = 'Preference' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Declarative properties property_sheets = \ diff --git a/product/ERP5OOo/Document/OOoDocument.py b/product/ERP5OOo/Document/OOoDocument.py index a059528cb8..662ad396b4 100644 --- a/product/ERP5OOo/Document/OOoDocument.py +++ b/product/ERP5OOo/Document/OOoDocument.py @@ -121,8 +121,6 @@ class OOoDocument(PermanentURLMixIn, File, CachedConvertableMixin): # CMF Type Definition meta_type = 'ERP5 OOo Document' portal_type = 'OOo Document' - isPortalContent = 1 - isRADContent = 1 searchable_property_list = ('asText', 'title', 'description', 'id', 'reference', 'version', 'short_title', diff --git a/product/ERP5SyncML/Conflict.py b/product/ERP5SyncML/Conflict.py index 01f0e6350d..b6230e0f19 100644 --- a/product/ERP5SyncML/Conflict.py +++ b/product/ERP5SyncML/Conflict.py @@ -33,6 +33,7 @@ from SyncCode import SyncCode from AccessControl import ClassSecurityInfo from Products.CMFCore.utils import getToolByName from Acquisition import Implicit, aq_base +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Core.Folder import Folder from Products.ERP5Type.Base import Base from Products.ERP5Type import Permissions @@ -52,8 +53,8 @@ class Conflict(SyncCode, Base): subscriber_value : the value sent by the remote box """ - isIndexable = 0 - isPortalContent = 0 # Make sure RAD generated accessors at the class level + isIndexable = ConstantGetter('isIndexable', value=False) + # Make sure RAD generated accessors at the class level def __init__(self, object_path=None, keyword=None, xupdate=None, publisher_value=None, subscriber_value=None, subscriber=None): diff --git a/product/ERP5SyncML/Publication.py b/product/ERP5SyncML/Publication.py index b96ca0e44a..22a6065bac 100644 --- a/product/ERP5SyncML/Publication.py +++ b/product/ERP5SyncML/Publication.py @@ -120,8 +120,6 @@ class Publication(Subscription): meta_type='ERP5 Publication' portal_type='SyncML Publication' # may be useful in the future... - isPortalContent = 1 - isRADContent = 1 icon = None # Declarative properties diff --git a/product/ERP5SyncML/Signature.py b/product/ERP5SyncML/Signature.py index 118690068b..9107918aa3 100644 --- a/product/ERP5SyncML/Signature.py +++ b/product/ERP5SyncML/Signature.py @@ -33,6 +33,7 @@ from SyncCode import SyncCode from AccessControl import ClassSecurityInfo from Products.CMFCore.utils import getToolByName from Acquisition import Implicit, aq_base +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Core.Folder import Folder from Products.ERP5Type.Base import Base from Products.ERP5Type import Permissions @@ -57,8 +58,8 @@ class Signature(Folder, SyncCode, File): only needed on the server. xml -- the xml of the object at the time where it was synchronized """ - isIndexable = 0 - isPortalContent = 0 # Make sure RAD generated accessors at the class level + isIndexable = ConstantGetter('isIndexable', value=False) + # Make sure RAD generated accessors at the class level # Constructor def __init__(self, diff --git a/product/ERP5SyncML/Subscription.py b/product/ERP5SyncML/Subscription.py index 091bbce605..49ab20e494 100644 --- a/product/ERP5SyncML/Subscription.py +++ b/product/ERP5SyncML/Subscription.py @@ -32,6 +32,7 @@ from SyncCode import SyncCode from AccessControl import ClassSecurityInfo from Products.CMFCore.utils import getToolByName from Acquisition import Implicit, aq_base +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Core.Folder import Folder from Products.ERP5Type.Base import Base from Products.ERP5Type import Permissions @@ -97,10 +98,8 @@ class Subscription(Folder, XMLSyncUtils, File): meta_type = 'ERP5 Subscription' portal_type = 'SyncML Subscription' # may be useful in the future... - isPortalContent = 1 - isRADContent = 1 icon = None - isIndexable = 0 + isIndexable = ConstantGetter('isIndexable', value=False) user = None # Declarative properties diff --git a/product/ERP5Type/Accessor/Constant.py b/product/ERP5Type/Accessor/Constant.py index c8a93c013b..159f93ec0c 100644 --- a/product/ERP5Type/Accessor/Constant.py +++ b/product/ERP5Type/Accessor/Constant.py @@ -1,8 +1,8 @@ -# -*- coding: utf-8 -*- ############################################################################## # -# Copyright (c) 2007 Nexedi SA and Contributors. All Rights Reserved. +# Copyright (c) 2002-2009 Nexedi SARL and Contributors. All Rights Reserved. # Jean-Paul Smets-Solanes <jp@nexedi.com> +# Sebastien Robin <seb@nexedi.com> # # WARNING: This program as such is intended to be used by professional # programmers who take the whole responsability of assessing all potential @@ -32,6 +32,40 @@ from Accessor import Accessor # Creation of default constructor class func_code: pass +class PropertyGetter: + """ + This is class is mostly used in order to handle compatibility + issues when we wish to make a property a method. For instance, + we would like to change from isIndexable=1 to a method isIndexable(). + """ + + def __init__(self, id, value=None): + self._id = id + self.__name__ = id + self.value = value + + def __call__(self): + return self.value + + def __nonzero__(self): + return bool(self.value) + + def __int__(self): + return int(self.value) + + def __float__(self): + return float(self.value) + + # following methods are used for < > == !鈦� , etc + def __eq__(self, other): + return int(self.value) == int(other) + + def __ne__(self, other): + return int(self.value) != int(other) + + def __cmp__(self, other): + return cmp(int(self.value), int(other)) + class Getter(Accessor): """ Returns a constant value, either by method call @@ -39,11 +73,8 @@ class Getter(Accessor): This method can be useful to turn existing constant properties of classes into methods, yet retaining compatibility. - - TODO: - - make unit test """ - _need__name__=1 + _need__name__ = 1 # Generic Definition of Method Object # This is required to call the method form the Web @@ -53,20 +84,11 @@ class Getter(Accessor): func_code.co_argcount = 1 func_defaults = () - def __init__(self, id, accessor_id, value): + def __init__(self, id, key, value=None): self._id = id + self._key = key self.__name__ = id - self._accessor_id = accessor_id self.value = value def __call__(self, instance): return self.value - - def __nonzero__(self): - return bool(self.value) - - def __int__(self): - return int(self.value) - - def __float__(self): - return float(self.value) diff --git a/product/ERP5Type/Accessor/Interface.py b/product/ERP5Type/Accessor/Interface.py new file mode 100644 index 0000000000..799110e9fe --- /dev/null +++ b/product/ERP5Type/Accessor/Interface.py @@ -0,0 +1,54 @@ +############################################################################## +# +# Copyright (c) 2002-2009 Nexedi SARL and Contributors. All Rights Reserved. +# Sebastien Robin <seb@nexedi.com> +# +# WARNING: This program as such is intended to be used by professional +# programmers who take the whole responsability of assessing all potential +# consequences resulting from its eventual inadequacies and bugs +# End users who are looking for a ready-to-use solution with commercial +# garantees and support are strongly adviced to contract a Free Software +# Service Company +# +# This program is Free Software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License +# as published by the Free Software Foundation; either version 2 +# of the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +############################################################################## + +from Accessor import Accessor + +# Creation of default constructor +class func_code: pass + +class Getter(Accessor): + """ + This getter will calls the provides method. This allows + lazy evaluation of the interface list provided by every portal type + """ + _need__name__ = 1 + + # Generic Definition of Method Object + # This is required to call the method form the Web + # More information at http://www.zope.org/Members/htrd/howto/FunctionTemplate + func_code = func_code() + func_code.co_varnames = ('self', ) + func_code.co_argcount = 1 + func_defaults = () + + def __init__(self, id, key): + self._id = id + self._key = key + + def __call__(self, instance): + return instance.provides(self._key) diff --git a/product/ERP5Type/Base.py b/product/ERP5Type/Base.py index b35da060fc..939b396c28 100644 --- a/product/ERP5Type/Base.py +++ b/product/ERP5Type/Base.py @@ -62,6 +62,7 @@ from Products.ERP5Type.Utils import UpperCase from Products.ERP5Type.Utils import convertToUpperCase, convertToMixedCase from Products.ERP5Type.Utils import createExpressionContext from Products.ERP5Type.Accessor.Accessor import Accessor +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Accessor.TypeDefinition import list_types from Products.ERP5Type.Accessor import Base as BaseAccessor from Products.ERP5Type.mixin.property_translatable import PropertyTranslatableBuiltInDictMixIn @@ -742,20 +743,20 @@ class Base( CopyContainer, meta_type = 'ERP5 Base Object' portal_type = 'Base Object' #_local_properties = () # no need since getattr - isPortalContent = 1 # All those attributes should become a methods isRADContent = 1 # - isCapacity = 0 # - isCategory = 0 # - isBaseCategory = 0 # - isInventoryMovement = 0 # - isMovement = 0 # - isDelivery = 0 # - isInventory = 0 # - isIndexable = 1 # If set to 0, reindexing will not happen (useful for optimization) - isPredicate = 0 # - isTemplate = 0 # - isDocument = 0 # - isTempDocument = 0 # If set to 0, instances are temporary. + isPortalContent = ConstantGetter('isPortalContent', value=True) + isCapacity = ConstantGetter('isCapacity', value=False) + isCategory = ConstantGetter('isCategory', value=False) + isBaseCategory = ConstantGetter('isBaseCategory', value=False) + isInventoryMovement = ConstantGetter('isInventoryMovement', value=False) + isDelivery = ConstantGetter('isDelivery', value=False) + isInventory = ConstantGetter('isInventory', value=False) + # If set to 0, reindexing will not happen (useful for optimization) + isIndexable = ConstantGetter('isIndexable', value=True) + isPredicate = ConstantGetter('isPredicate', value=False) + isTemplate = ConstantGetter('isTemplate', value=False) + isDocument = ConstantGetter('isDocument', value=False) + isTempDocument = ConstantGetter('isTempDocument', value=False) # Dynamic method acquisition system (code generation) aq_method_generated = {} @@ -789,6 +790,11 @@ class Base( CopyContainer, CMFCatalogAware.manage_options ) + # Place for all is... method + security.declareProtected(Permissions.AccessContentsInformation, 'isMovement') + def isMovement(self): + return 0 + security.declareProtected( Permissions.ModifyPortalContent, 'setTitle' ) def setTitle(self, value): """ sets the title. (and then reindexObject)""" @@ -811,6 +817,18 @@ class Base( CopyContainer, """ initializeClassDynamicProperties(self, self.__class__) + security.declareProtected( Permissions.AccessContentsInformation, 'provides' ) + def provides(self, interface_name): + """ + Check if the current class provides a particular interface + """ + result = False + for interface in implementedBy(self.__class__): + if interface.getName() == interface_name: + result = True + break + return result + def _aq_key(self): return (self.portal_type, self.__class__) @@ -3351,8 +3369,8 @@ class Base( CopyContainer, catalog = getToolByName(self, 'portal_catalog', None) if catalog is not None: catalog.unindexObject(self, uid=self.getUid()) - self.isIndexable = 0 - self.isTemplate = 1 + self.isIndexable = ConstantGetter('isIndexable', value=False) + self.isTemplate = ConstantGetter('isTemplate', value=True) # XXX reset security here security.declareProtected(Permissions.ModifyPortalContent,'makeTemplateInstance') @@ -3750,8 +3768,8 @@ class TempBase(Base): If we need Base services (categories, edit, etc) in temporary objects we shoud used TempBase """ - isIndexable = 0 - isTempDocument = 1 + isIndexable = ConstantGetter('isIndexable', value=False) + isTempDocument = ConstantGetter('isTempDocument', value=True) # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Type/Core/ActionInformation.py b/product/ERP5Type/Core/ActionInformation.py index 74ed6912c5..64c3b49e45 100644 --- a/product/ERP5Type/Core/ActionInformation.py +++ b/product/ERP5Type/Core/ActionInformation.py @@ -44,8 +44,6 @@ class ActionInformation(XMLObject): meta_type = 'ERP5 Action Information' portal_type = 'Action Information' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 icon = None # Override DynamicType.icon from CMFCore # Declarative security diff --git a/product/ERP5Type/Core/CacheFactory.py b/product/ERP5Type/Core/CacheFactory.py index 747401918f..a438337356 100644 --- a/product/ERP5Type/Core/CacheFactory.py +++ b/product/ERP5Type/Core/CacheFactory.py @@ -42,8 +42,6 @@ class CacheFactory(XMLObject): meta_type = 'ERP5 Cache Factory' portal_type = 'Cache Factory' - isPortalContent = 1 - isRADContent = 1 allowed_types = ('ERP5 Ram Cache', 'ERP5 Distributed Ram Cache', diff --git a/product/ERP5Type/Core/DistributedRamCache.py b/product/ERP5Type/Core/DistributedRamCache.py index bca5d9d9c2..3d1db9e536 100644 --- a/product/ERP5Type/Core/DistributedRamCache.py +++ b/product/ERP5Type/Core/DistributedRamCache.py @@ -40,8 +40,6 @@ class DistributedRamCache(XMLObject): meta_type = 'ERP5 Distributed Ram Cache' portal_type = 'Distributed Ram Cache' - isPortalContent = 1 - isRADContent = 1 allowed_types = () diff --git a/product/ERP5Type/Core/Folder.py b/product/ERP5Type/Core/Folder.py index f1b368f81a..61111795f1 100644 --- a/product/ERP5Type/Core/Folder.py +++ b/product/ERP5Type/Core/Folder.py @@ -404,8 +404,6 @@ class Folder(CopyContainer, CMFBTreeFolder, CMFHBTreeFolder, Base, FolderMixIn, meta_type = 'ERP5 Folder' portal_type = 'Folder' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 # Overload _properties define in OFS/Folder # _properties=({'id':'title', 'type': 'string','mode':'wd'},) diff --git a/product/ERP5Type/Core/MemcachedPlugin.py b/product/ERP5Type/Core/MemcachedPlugin.py index 692c5d10d4..56662a8152 100644 --- a/product/ERP5Type/Core/MemcachedPlugin.py +++ b/product/ERP5Type/Core/MemcachedPlugin.py @@ -40,8 +40,6 @@ class MemcachedPlugin(XMLObject): meta_type = 'ERP5 Memcached Plugin' portal_type = 'Memcached Plugin' - isPortalContent = 1 - isRADContent = 1 allowed_types = () diff --git a/product/ERP5Type/Core/RamCache.py b/product/ERP5Type/Core/RamCache.py index 130986447c..5d070394ea 100644 --- a/product/ERP5Type/Core/RamCache.py +++ b/product/ERP5Type/Core/RamCache.py @@ -40,8 +40,6 @@ class RamCache(XMLObject): """ meta_type = 'ERP5 Ram Cache' portal_type = 'Ram Cache' - isPortalContent = 1 - isRADContent = 1 allowed_types = () security = ClassSecurityInfo() diff --git a/product/ERP5Type/Core/RoleInformation.py b/product/ERP5Type/Core/RoleInformation.py index f593f96a67..86c64fb189 100644 --- a/product/ERP5Type/Core/RoleInformation.py +++ b/product/ERP5Type/Core/RoleInformation.py @@ -53,8 +53,6 @@ class RoleInformation(XMLObject): meta_type = 'ERP5 Role Information' portal_type = 'Role Information' add_permission = Permissions.AddPortalContent - isPortalContent = 1 - isRADContent = 1 security = ClassSecurityInfo() security.declareObjectProtected(AccessContentsInformation) diff --git a/product/ERP5Type/ERP5Type.py b/product/ERP5Type/ERP5Type.py index 645f21ee9c..d5609ac28a 100755 --- a/product/ERP5Type/ERP5Type.py +++ b/product/ERP5Type/ERP5Type.py @@ -195,8 +195,6 @@ class ERP5TypeInformation(XMLObject, portal_type = 'Base Type' meta_type = 'ERP5 Base Type' - isPortalContent = 1 - isRADContent = 1 security = ClassSecurityInfo() security.declareObjectProtected(Permissions.AccessContentsInformation) diff --git a/product/ERP5Type/Tool/ClassTool.py b/product/ERP5Type/Tool/ClassTool.py index 57681b18ca..20a953e46a 100644 --- a/product/ERP5Type/Tool/ClassTool.py +++ b/product/ERP5Type/Tool/ClassTool.py @@ -335,8 +335,6 @@ class %s(XMLObject): # CMF Type Definition meta_type = 'MYPROJECT Template Document' portal_type = 'Template Document' - isPortalContent = 1 - isRADContent = 1 # Declarative security security = ClassSecurityInfo() diff --git a/product/ERP5Type/Utils.py b/product/ERP5Type/Utils.py index feed33933f..a32e61ed10 100644 --- a/product/ERP5Type/Utils.py +++ b/product/ERP5Type/Utils.py @@ -36,6 +36,8 @@ import warnings from md5 import new as md5_new from sha import new as sha_new +from zope.interface import implementedBy + from Products.ERP5Type.Globals import package_home from Products.ERP5Type.Globals import DevelopmentMode from Acquisition import aq_base @@ -59,6 +61,10 @@ from Products.ZCatalog.Lazy import LazyMap from Products.ERP5Type import Permissions from Products.ERP5Type import Constraint +from Products.ERP5Type.Accessor.Constant import PropertyGetter as \ + PropertyConstantGetter +from Products.ERP5Type.Accessor.Constant import Getter as ConstantGetter +from Products.ERP5Type.Accessor.Interface import Getter as InterfaceGetter from Products.ERP5Type.Cache import getReadOnlyTransactionCache from Products.ERP5Type.TransactionalVariable import getTransactionalVariable from zLOG import LOG, BLATHER, PROBLEM, WARNING @@ -393,6 +399,13 @@ def updateGlobals(this_module, global_hook, # Do not consider private keys if key[0:2] != '__': setattr(Permissions, key, getattr(permissions_module, key)) + else: + # We have to parse interface list in order to generate some accessors + # even if we are on the ERP5Type product + path, module_id_list = getModuleIdList(product_path, 'interfaces') + import_method = importLocalInterface + for module_id in module_id_list: + import_method(module_id, path=path, is_erp5_type=is_erp5_type) # Return core document_class list (for ERP5Type only) # this was introduced to permit overriding ERP5Type Document classes @@ -464,7 +477,7 @@ class TempDocumentConstructor(DocumentConstructor): def __init__(self, klass): # Create a new class to set permissions specific to temporary objects. class TempDocument(klass): - isTempDocument = 1 + isTempDocument = PropertyConstantGetter('isTempDocument', value=True) __roles__ = None # Replace some attributes. @@ -568,7 +581,7 @@ def registerBaseCategories(property_sheet): for bc in category_list : base_category_dict[bc] = 1 -def importLocalInterface(module_id, path = None): +def importLocalInterface(module_id, path = None, is_erp5_type=False): if path is None: instance_home = getConfiguration().instancehome path = os.path.join(instance_home, "interfaces") @@ -576,9 +589,18 @@ def importLocalInterface(module_id, path = None): f = open(path) try: class_id = "I" + convertToUpperCase(module_id) - module = imp.load_source(class_id, path, f) - import Products.ERP5Type.interfaces - setattr(Products.ERP5Type.interfaces, class_id, getattr(module, class_id)) + if not is_erp5_type: + module = imp.load_source(class_id, path, f) + import Products.ERP5Type.interfaces + setattr(Products.ERP5Type.interfaces, class_id, getattr(module, class_id)) + + # Create interface getter + accessor_name = 'provides' + class_id + accessor = InterfaceGetter(accessor_name, class_id) + setattr(BaseClass, accessor_name, accessor) + BaseClass.security.declareProtected( + Permissions.AccessContentsInformation, accessor_name) + finally: f.close() @@ -804,7 +826,8 @@ def setDefaultClassProperties(property_holder): """Initialize default properties for ERP5Type Documents. """ if not property_holder.__dict__.has_key('isPortalContent'): - property_holder.isPortalContent = 1 + property_holder.isPortalContent = PropertyConstantGetter('isPortalContent', + value=True) if not property_holder.__dict__.has_key('isRADContent'): property_holder.isRADContent = 1 if not property_holder.__dict__.has_key('add_permission'): @@ -934,6 +957,7 @@ def importLocalDocument(class_id, document_path = None): if not m.has_key(name): m[name] = [] m[name].append(method) m[name+'__roles__']=pr + return document_class, constructors def initializeLocalRegistry(directory_name, import_local_method, @@ -1525,6 +1549,29 @@ def setDefaultProperties(property_holder, object=None, portal=None): raise TypeError, '"%s" is invalid type for propertysheet' % \ prop['type'] + # Create for every portal type group an accessor (like isPortalDeliveryType) + # In the future, this should probalby use categories + if portal is not None: # we can not do anything without portal + # import lately in order to avoid circular dependency + from Products.ERP5Type.ERP5Type import ERP5TypeInformation + portal_type = object.portal_type + for group in ERP5TypeInformation.defined_group_list: + value = portal_type in portal._getPortalGroupedTypeSet(group) + prop = { + 'id' : group, + 'description' : "accessor to know the membership of portal group %s" \ + % group, + 'type' : 'group_type', + 'default' : value, + 'group_type' : group, + } + createDefaultAccessors( + property_holder, + prop['id'], + prop=prop, + read_permission=Permissions.AccessContentsInformation, + portal=portal) + ##################################################### # Accessor initialization ##################################################### @@ -1554,6 +1601,13 @@ def createDefaultAccessors(property_holder, id, prop = None, createTranslationAcquiredPropertyAccessors(property_holder, prop, portal=portal) + ###################################################### + # Create Portal Category Type Accessors. + if prop.get('group_type'): + createGroupTypeAccessors(property_holder, prop, + read_permission=read_permission, + portal=portal) + ###################################################### # Create Getters if prop.has_key('acquisition_base_category'): @@ -2600,6 +2654,22 @@ def createRelatedValueAccessors(property_holder, id, read_permission=Permissions if accessor_name[0] != '_': BaseClass.security.declareProtected(read_permission, accessor_name) +def createGroupTypeAccessors(property_holder, prop, + read_permission=None, portal=None): + """ + Generate accessors that allows to know if we belongs to a particular + group of portal types + """ + # Getter + group = prop['group_type'] + accessor_name = 'is' + UpperCase(group) + 'Type' + value = prop['default'] + accessor_args = (value,) + if not hasattr(property_holder, accessor_name): + property_holder.registerAccessor(accessor_name, id, ConstantGetter, + accessor_args) + property_holder.declareProtected(read_permission, accessor_name) + def createTranslationAcquiredPropertyAccessors( property_holder, property, diff --git a/product/ERP5Type/XMLMatrix.py b/product/ERP5Type/XMLMatrix.py index a8d7ed2185..45185def42 100644 --- a/product/ERP5Type/XMLMatrix.py +++ b/product/ERP5Type/XMLMatrix.py @@ -33,6 +33,7 @@ from Products.ERP5Type import Permissions from Products.ERP5Type.Core.Folder import Folder from Products.ERP5Type.Utils import cartesianProduct from Products.ERP5Type.Base import TempBase +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from zLOG import LOG from string import join, replace @@ -302,9 +303,10 @@ class XMLMatrix(Folder): #o.immediateReindexObject() # STILL A PROBLEM -> getUidForPath XXX if object_id not in new_object_id_list: # do not unindex a new object - o.isIndexable = 1 + o.isIndexable = ConstantGetter('isIndexable', value=True) o.unindexObject(path='%s/%s' % (self.getUrl() , object_id)) - o.isIndexable = 0 # unindexed already forced + # unindexed already forced + o.isIndexable = ConstantGetter('isIndexable', value=False) self._delObject('temp_' + object_id) # object will be removed # from catalog automaticaly # We don't need the old index any more, we @@ -430,10 +432,10 @@ class XMLMatrix(Folder): if cell is not None: new_id = old_id + appended_id self._delObject(old_id) - cell.isIndexable = 0 + cell.isIndexable = ConstantGetter('isIndexable', value=False) cell.id = new_id self._setObject(new_id, aq_base(cell)) - cell.isIndexable = 1 + cell.isIndexable = ConstantGetter('isIndexable', value=True) cell.reindexObject() #cell.unindexObject(path='%s/%s' % (self.getUrl(), old_id)) elif len(current_range) > len(kw): @@ -444,10 +446,10 @@ class XMLMatrix(Folder): if cell is not None: new_id = old_id[:-removed_id_len] self._delObject(old_id) - cell.isIndexable = 0 + cell.isIndexable = ConstantGetter('isIndexable', value=False) cell.id = new_id self._setObject(new_id, aq_base(cell)) - cell.isIndexable = 1 + cell.isIndexable = ConstantGetter('isIndexable', value=True) cell.reindexObject() #cell.unindexObject(path='%s/%s' % (self.getUrl(), old_id)) @@ -751,7 +753,7 @@ class TempXMLMatrix(XMLMatrix): If we need Base services (categories, edit, etc) in temporary objects we shoud used TempBase """ - isIndexable = 0 + isIndexable = ConstantGetter('isIndexable', value=False) def newCellContent(self, id): """ diff --git a/product/ERP5Type/XMLObject.py b/product/ERP5Type/XMLObject.py index d41f77223e..b9faaddf95 100644 --- a/product/ERP5Type/XMLObject.py +++ b/product/ERP5Type/XMLObject.py @@ -54,8 +54,6 @@ class XMLObject( Folder ): """ meta_type = 'ERP5 XML Object' portal_type = 'XML Object' - isPortalContent = 1 - isRADContent = 1 # The only declarative factory_type_information in ERP5 factory_type_information = \ diff --git a/product/ERP5Type/tests/ERP5TypeTestCase.py b/product/ERP5Type/tests/ERP5TypeTestCase.py index fc4cea5934..efc1db885a 100644 --- a/product/ERP5Type/tests/ERP5TypeTestCase.py +++ b/product/ERP5Type/tests/ERP5TypeTestCase.py @@ -53,6 +53,7 @@ from Testing.ZopeTestCase.PortalTestCase import PortalTestCase, user_name from Products.CMFCore.utils import getToolByName from Products.DCWorkflow.DCWorkflow import ValidationFailed from Products.ERP5Type.Base import _aq_reset +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from zLOG import LOG, DEBUG import backportUnittest @@ -1176,12 +1177,14 @@ def optimize(): self._filepath = self.get_filepath() PythonScript._makeFunction = _makeFunction - # Do not reindex portal types sub objects + # Do not reindex portal types sub objects by default # We will probably disable reindexing for other types later - from Products.ERP5Type.Document.RoleInformation import RoleInformation - RoleInformation.isIndexable = 0 - from Products.ERP5Type.Document.ActionInformation import ActionInformation - ActionInformation.isIndexable = 0 + full_indexing_set = set(os.environ.get('enable_full_indexing', '').split(',')) + if not 'portal_types' in full_indexing_set: + from Products.ERP5Type.Document.RoleInformation import RoleInformation + RoleInformation.isIndexable = ConstantGetter('isIndexable', value=False) + from Products.ERP5Type.Document.ActionInformation import ActionInformation + ActionInformation.isIndexable = ConstantGetter('isIndexable', value=False) optimize() diff --git a/product/ERP5Type/tests/runUnitTest.py b/product/ERP5Type/tests/runUnitTest.py index 3c1ae5300e..1785bdb936 100755 --- a/product/ERP5Type/tests/runUnitTest.py +++ b/product/ERP5Type/tests/runUnitTest.py @@ -68,6 +68,12 @@ Options: you don't want to update them all. You can give a list delimited with commas (e.g. erp5_core,erp5_xhtml_style). This can be regular expressions. + + --enable_full_indexing=STRING + By default, unit test do not reindex everything + for performance reasons. Provide list of documents + (delimited with comas) for which we want to force + indexing. This can only be for now 'portal_types' """ def getUnitTestFile(): @@ -478,6 +484,7 @@ def main(): "save", "load", "email_from_address=", + "enable_full_indexing=", "run_only=", "update_only=", "update_business_templates"] ) @@ -524,6 +531,9 @@ def main(): os.environ["cmf_activity_sql_connection_string"] = arg elif opt == "--email_from_address": os.environ["email_from_address"] = arg + elif opt == "--enable_full_indexing": + # Here we disable optimisations related to indexing + os.environ["enable_full_indexing"] = arg elif opt == "--save": os.environ["erp5_save_data_fs"] = "1" elif opt == "--load": diff --git a/product/ERP5Type/tests/testERP5Type.py b/product/ERP5Type/tests/testERP5Type.py index 8d7815c730..e6d3a97362 100644 --- a/product/ERP5Type/tests/testERP5Type.py +++ b/product/ERP5Type/tests/testERP5Type.py @@ -41,6 +41,7 @@ from zLOG import LOG, INFO from Products.CMFCore.Expression import Expression from Products.CMFCore.tests.base.testcase import LogInterceptor from Products.CMFCore.WorkflowCore import WorkflowException +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Base import _aq_reset from Products.ERP5Type.tests.utils import installRealClassTool from Products.ERP5Type.Utils import removeLocalPropertySheet @@ -2600,6 +2601,48 @@ class TestPropertySheet: person.validate() self.assertRaises(WorkflowException, person.validate) + def test_PropertyConstantGetter(self): + """ + Check the boolean constant getter. Make sure + it works both like a property and a method + """ + person = self.getPersonModule().newContent(portal_type='Person') + person.foo = ConstantGetter('foo', value=False) + self.assertFalse(person.foo) + self.assertFalse(person.foo()) + self.assertEqual(person.foo(), 0) + self.assertEqual(person.foo, 0) + person.foo = ConstantGetter('foo', value=True) + self.assertTrue(person.foo) + self.assertTrue(person.foo()) + self.assertEqual(person.foo(), 1) + self.assertEqual(person.foo, 1) + + def test_GroupTypeAccessors(self): + """ + Check that we have automatic accessors in order to check + if the portal type of an instance is part of a group + """ + person = self.getPersonModule().newContent(portal_type='Person') + method = getattr(person, 'isDeliveryType', None) + self.assertNotEquals(None, method) + self.assertEquals(0, method()) + method = getattr(person, 'isNodeType', None) + self.assertNotEquals(None, method) + self.assertEquals(1, method()) + + def test_providesAccessors(self): + """ + Check that we have automatic accessors in order to check + if an instance provices a particular interface + """ + person = self.getPersonModule().newContent(portal_type='Person') + method = getattr(person, 'providesIMovement', None) + self.assertNotEquals(None, method) + self.assertEquals(False, method()) + method = getattr(person, 'providesICategoryAccessProvider', None) + self.assertNotEquals(None, method) + self.assertTrue(method()) class TestAccessControl(ERP5TypeTestCase): # Isolate test in a dedicaced class in order not to break other tests diff --git a/product/ERP5Wizard/Tool/WizardTool.py b/product/ERP5Wizard/Tool/WizardTool.py index 0f8be90dd1..afcbfc4e21 100644 --- a/product/ERP5Wizard/Tool/WizardTool.py +++ b/product/ERP5Wizard/Tool/WizardTool.py @@ -30,6 +30,7 @@ from AccessControl import ClassSecurityInfo from ZPublisher.HTTPRequest import FileUpload from Globals import InitializeClass, DTMLFile +from Products.ERP5Type.Accessor.Constant import PropertyGetter as ConstantGetter from Products.ERP5Type.Tool.BaseTool import BaseTool from Products.ERP5Type import Permissions from Products.ERP5Wizard import _dtmldir @@ -169,8 +170,7 @@ class WizardTool(BaseTool): id = 'portal_wizard' meta_type = 'ERP5 Wizard Tool' portal_type = 'Wizard Tool' - isPortalContent = 1 - isRADContent = 1 + isPortalContent = ConstantGetter('isPortalContent', value=True) property_sheets = () security = ClassSecurityInfo() security.declareProtected(Permissions.ManagePortal, 'manage_overview') -- 2.30.9