Commit 2dd6ad08 authored by Sebastien Robin's avatar Sebastien Robin

- 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
parent 3a9c4b53
No related merge requests found
......@@ -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()
......
......@@ -63,8 +63,6 @@ class ActiveProcess(Base):
meta_type = 'CMF Active Process'
portal_type = 'Active Process'
isPortalContent = 0
isRADContent = 1
icon = None
# Declarative security
......
......@@ -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)
......
......@@ -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
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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, )
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......
......@@ -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()
......
......@@ -40,8 +40,6 @@ class Binder(Folder, Document):
meta_type = 'ERP5 Binder'
portal_type = 'Binder'
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -65,7 +65,6 @@ class BusinessPath(Path):
"""
meta_type = 'ERP5 Business Path'
portal_type = 'Business Path'
isPredicate = 1
# Declarative security
security = ClassSecurityInfo()
......
......@@ -48,7 +48,6 @@ class BusinessProcess(Path, XMLObject):
"""
meta_type = 'ERP5 Business Process'
portal_type = 'Business Process'
isPredicate = 1
# Declarative security
security = ClassSecurityInfo()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -44,7 +44,6 @@ class ContainerCell(DeliveryCell):
meta_type = 'ERP5 Container Cell'
portal_type = 'Container Cell'
isCell = 1
isMovement = 1
# Declarative security
security = ClassSecurityInfo()
......
......@@ -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()
......
......@@ -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, )
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......@@ -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()
......
......@@ -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()
......
......@@ -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,
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......@@ -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()
......
......@@ -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()
......
......@@ -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
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......
......@@ -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()
......
......@@ -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
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -41,7 +41,6 @@ class Order(Delivery):
# CMF Type Definition
meta_type = 'ERP5 Order'
portal_type = 'Order'
isDelivery = 1
# Declarative security
security = ClassSecurityInfo()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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)
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......
......@@ -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()
......
......@@ -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()
......
......@@ -41,7 +41,6 @@ class ProductionReportCell(DeliveryCell):
meta_type = 'ERP5 Production Report Cell'
portal_type = 'Production Report Cell'
isMovement = 1
# Declarative security
security = ClassSecurityInfo()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......
......@@ -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()
......
......@@ -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
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -99,7 +99,6 @@ class SimulationMovement(Movement, PropertyRecordableMixin):
"""
meta_type = 'ERP5 Simulation Movement'
portal_type = 'Simulation Movement'
isMovement = 1
# Declarative security
security = ClassSecurityInfo()
......
......@@ -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
......
......@@ -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
......
......@@ -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()
......
......@@ -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()
......
......@@ -40,8 +40,6 @@ class SubscriptionItem(Item):
"""
meta_type = 'ERP5 Subscription Item'
portal_type = 'Subscription Item'
isPortalContent = 1
isRADContent = 1
# Declarative security
security = ClassSecurityInfo()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......@@ -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()
......
......@@ -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'
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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)
......@@ -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
......
......@@ -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(),
......
......@@ -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
......
......@@ -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>
......@@ -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>
......@@ -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>
......@@ -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>
......@@ -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>
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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()
......
......@@ -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
......@@ -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()
......
......@@ -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 = \
......
......@@ -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',
......
......@@ -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):
......
......@@ -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
......
......@@ -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,
......
......@@ -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
......
# -*- 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)
##############################################################################
#
# 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)
......@@ -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()
......
......@@ -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
......
......@@ -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',
......
......@@ -40,8 +40,6 @@ class DistributedRamCache(XMLObject):
meta_type = 'ERP5 Distributed Ram Cache'
portal_type = 'Distributed Ram Cache'
isPortalContent = 1
isRADContent = 1
allowed_types = ()
......
......@@ -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'},)
......
......@@ -40,8 +40,6 @@ class MemcachedPlugin(XMLObject):
meta_type = 'ERP5 Memcached Plugin'
portal_type = 'Memcached Plugin'
isPortalContent = 1
isRADContent = 1
allowed_types = ()
......
......@@ -40,8 +40,6 @@ class RamCache(XMLObject):
"""
meta_type = 'ERP5 Ram Cache'
portal_type = 'Ram Cache'
isPortalContent = 1
isRADContent = 1
allowed_types = ()
security = ClassSecurityInfo()
......
......@@ -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)
......
......@@ -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)
......
......@@ -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()
......
......@@ -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,
......
......@@ -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):
"""
......
......@@ -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 = \
......
......@@ -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()
......
......@@ -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":
......
......@@ -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
......
......@@ -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')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment