Commit 1ff851b1 authored by Arnaud Fontaine's avatar Arnaud Fontaine

ZODB Components: Preparation of erp5_base migration from FS: Fix pylint bad-indentation warnings.

parent 187c6554
......@@ -32,22 +32,22 @@ from Products.ERP5Type.XMLObject import XMLObject
class AgentPrivilege(XMLObject):
"""
An Agent Privilege allow the Bank Account owner to give permissions to an Agent for a given period of time, for a maximum amount of money.
"""
# CMF Type Definition
meta_type = 'ERP5 Agent Privilege'
portal_type = 'Agent Privilege'
"""
An Agent Privilege allow the Bank Account owner to give permissions to an Agent for a given period of time, for a maximum amount of money.
"""
# CMF Type Definition
meta_type = 'ERP5 Agent Privilege'
portal_type = 'Agent Privilege'
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.AgentPrivilege
)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.AgentPrivilege
)
......@@ -33,22 +33,22 @@ from Products.ERP5.Document.Path import Path
class Assignment(Path):
# CMF Type Definition
meta_type = 'ERP5 Assignment'
portal_type = 'Assignment'
add_permission = Permissions.AddPortalContent
# CMF Type Definition
meta_type = 'ERP5 Assignment'
portal_type = 'Assignment'
add_permission = Permissions.AddPortalContent
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Path
, PropertySheet.Assignment
)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Path
, PropertySheet.Assignment
)
......@@ -34,43 +34,43 @@ from Products.ERP5.Document.Node import Node
from Products.ERP5.Document.Coordinate import Coordinate
class BankAccount(Node, Coordinate):
"""
"""
A bank account number holds a collection of numbers and codes
(ex. SWIFT, RIB, etc.) which may be used to identify a bank account.
A Bank Account is owned by a Person or an Organisation. A Bank Account
contain Agents with Agent Privileges used by the owner to delegate the
management of the bank account to trusted third-party Persons.
"""
"""
meta_type = 'ERP5 Bank Account'
portal_type = 'Bank Account'
add_permission = Permissions.AddPortalContent
meta_type = 'ERP5 Bank Account'
portal_type = 'Bank Account'
add_permission = Permissions.AddPortalContent
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.CategoryCore
, PropertySheet.Task
, PropertySheet.Resource
, PropertySheet.Reference
, PropertySheet.BankAccount
)
# Declarative properties
property_sheets = ( PropertySheet.CategoryCore
, PropertySheet.Task
, PropertySheet.Resource
, PropertySheet.Reference
, PropertySheet.BankAccount
)
security.declareProtected(Permissions.AccessContentsInformation, 'getReference')
def getReference(self, *args, **kw):
"""reference depends on the site configuration.
"""
value = self._baseGetReference(*args, **kw)
if value in (None, ''):
# Try to get a skin from type name
method = self._getTypeBasedMethod('getReference')
if method is not None:
return method(*args, **kw)
return value
security.declareProtected(Permissions.AccessContentsInformation, 'getReference')
def getReference(self, *args, **kw):
"""reference depends on the site configuration.
"""
value = self._baseGetReference(*args, **kw)
if value in (None, ''):
# Try to get a skin from type name
method = self._getTypeBasedMethod('getReference')
if method is not None:
return method(*args, **kw)
return value
# XXX The following "helper methods" have been commented out, and kept in the
# code as an example.
......
......@@ -33,27 +33,27 @@ from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.Path import Path
class Career(Path):
"""
"""
Contains information about abilities, salary, grade, role... of a
Person at a certain career step.
"""
# CMF Type Definition
meta_type = 'ERP5 Career'
portal_type = 'Career'
add_permission = Permissions.AddPortalContent
"""
# CMF Type Definition
meta_type = 'ERP5 Career'
portal_type = 'Career'
add_permission = Permissions.AddPortalContent
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Path
, PropertySheet.Reference
, PropertySheet.Assignment
)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Task
, PropertySheet.Arrow
, PropertySheet.Path
, PropertySheet.Reference
, PropertySheet.Assignment
)
This diff is collapsed.
......@@ -204,7 +204,7 @@ class Image(TextConvertableMixin, File, OFSImage):
"""Return list of HTML <a> tags for displays."""
links = []
for display in self.displayIds(exclude):
links.append('<a href="%s?display=%s">%s</a>' % (self.REQUEST['URL'], display, display))
links.append('<a href="%s?display=%s">%s</a>' % (self.REQUEST['URL'], display, display))
return links
security.declareProtected(Permissions.AccessContentsInformation, 'displayMap')
......@@ -367,11 +367,11 @@ class Image(TextConvertableMixin, File, OFSImage):
cwd='/',
close_fds=True)
try:
# XXX: The only portable way is to pass what stdin.write can accept,
# which is a string for PIPE.
image, err = process.communicate(data)
# XXX: The only portable way is to pass what stdin.write can accept,
# which is a string for PIPE.
image, err = process.communicate(data)
finally:
del process
del process
if image:
return StringIO(image)
raise ConversionError('Image conversion failed (%s).' % err)
......
......@@ -33,7 +33,7 @@ from Products.ERP5Type import Permissions, PropertySheet, interfaces
from Products.ERP5.Document.Node import Node
class Organisation(Node):
"""
"""
An Organisation object holds the information about
an organisation (ex. a division in a company, a company,
a service in a public administration).
......@@ -46,27 +46,27 @@ class Organisation(Node):
Organisation objects inherit from the MetaNode base class
(one of the 5 base classes in the ERP5 universal business model)
"""
"""
meta_type = 'ERP5 Organisation'
portal_type = 'Organisation'
add_permission = Permissions.AddPortalContent
meta_type = 'ERP5 Organisation'
portal_type = 'Organisation'
add_permission = Permissions.AddPortalContent
zope.interface.implements(interfaces.INode)
zope.interface.implements(interfaces.INode)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Organisation
, PropertySheet.Mapping
, PropertySheet.Task
, PropertySheet.Reference
)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.Organisation
, PropertySheet.Mapping
, PropertySheet.Task
, PropertySheet.Reference
)
This diff is collapsed.
......@@ -33,36 +33,36 @@ from Products.ERP5Type.ERP5Type \
import ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT
class RoleDefinition(XMLObject):
# CMF Type Definition
meta_type = 'ERP5 Role Definition'
portal_type = 'Role Definition'
add_permission = Permissions.ChangeLocalRoles
# CMF Type Definition
meta_type = 'ERP5 Role Definition'
portal_type = 'Role Definition'
add_permission = Permissions.ChangeLocalRoles
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
zope.interface.implements(interfaces.ILocalRoleGenerator)
zope.interface.implements(interfaces.ILocalRoleGenerator)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.RoleDefinition
)
# Default Properties
property_sheets = ( PropertySheet.Base
, PropertySheet.XMLObject
, PropertySheet.CategoryCore
, PropertySheet.DublinCore
, PropertySheet.RoleDefinition
)
def _setRoleName(self, value):
if value and value not in \
zip(*self.RoleDefinition_getRoleNameItemList())[1]:
raise Unauthorized("You are not allowed to give %s role" % value)
self._baseSetRoleName(value)
def _setRoleName(self, value):
if value and value not in \
zip(*self.RoleDefinition_getRoleNameItemList())[1]:
raise Unauthorized("You are not allowed to give %s role" % value)
self._baseSetRoleName(value)
security.declarePrivate("getLocalRolesFor")
def getLocalRolesFor(self, ob, user_name=None):
group_id_generator = getattr(ob,
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT)
role_list = self.getRoleName(),
return {group_id: role_list
for group_id in group_id_generator(category_order=('agent',),
agent=self.getAgentList())}
security.declarePrivate("getLocalRolesFor")
def getLocalRolesFor(self, ob, user_name=None):
group_id_generator = getattr(ob,
ERP5TYPE_SECURITY_GROUP_ID_GENERATION_SCRIPT)
role_list = self.getRoleName(),
return {group_id: role_list
for group_id in group_id_generator(category_order=('agent',),
agent=self.getAgentList())}
......@@ -32,49 +32,49 @@ from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5.Document.Path import Path
class SupplyCell(Path):
"""A Supply Cell is used for different variations in a supply line.
"""
"""A Supply Cell is used for different variations in a supply line.
"""
meta_type = 'ERP5 Supply Cell'
portal_type = 'Supply Cell'
add_permission = Permissions.AddPortalContent
meta_type = 'ERP5 Supply Cell'
portal_type = 'Supply Cell'
add_permission = Permissions.AddPortalContent
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.SupplyLine
, PropertySheet.Discount
, PropertySheet.Path
, PropertySheet.FlowCapacity
, PropertySheet.Predicate
, PropertySheet.MappedValue
, PropertySheet.Reference
)
# Declarative properties
property_sheets = ( PropertySheet.Base
, PropertySheet.CategoryCore
, PropertySheet.Amount
, PropertySheet.Task
, PropertySheet.Movement
, PropertySheet.Price
, PropertySheet.SupplyLine
, PropertySheet.Discount
, PropertySheet.Path
, PropertySheet.FlowCapacity
, PropertySheet.Predicate
, PropertySheet.MappedValue
, PropertySheet.Reference
)
security.declareProtected( Permissions.AccessContentsInformation,
'hasCellContent' )
def hasCellContent(self, base_id='movement'):
"""A cell cannot have cell content itself.
"""
return 0
security.declareProtected( Permissions.AccessContentsInformation,
'hasCellContent' )
def hasCellContent(self, base_id='movement'):
"""A cell cannot have cell content itself.
"""
return 0
# Override getQuantityUnitXXX to negate same methods defined in
# Amount class. Because cell must acquire quantity unit from line
# not from resource.
security.declareProtected( Permissions.AccessContentsInformation,
'getQuantityUnitValue')
def getQuantityUnitValue(self):
return self.getParentValue().getQuantityUnitValue()
# Override getQuantityUnitXXX to negate same methods defined in
# Amount class. Because cell must acquire quantity unit from line
# not from resource.
security.declareProtected( Permissions.AccessContentsInformation,
'getQuantityUnitValue')
def getQuantityUnitValue(self):
return self.getParentValue().getQuantityUnitValue()
security.declareProtected( Permissions.AccessContentsInformation,
'getQuantityUnit')
def getQuantityUnit(self, checked_permission=None):
return self.getParentValue().getQuantityUnit(checked_permission=checked_permission)
security.declareProtected( Permissions.AccessContentsInformation,
'getQuantityUnit')
def getQuantityUnit(self, checked_permission=None):
return self.getParentValue().getQuantityUnit(checked_permission=checked_permission)
This diff is collapsed.
......@@ -791,9 +791,9 @@ class BuilderMixin(XMLObject, Amount, Predicate):
category_index_dict[i.getId()] = i.getIntIndex()
def sort_movement_group(a, b):
return cmp(category_index_dict.get(a.getCollectOrderGroup()),
category_index_dict.get(b.getCollectOrderGroup())) or \
cmp(a.getIntIndex(), b.getIntIndex())
return cmp(category_index_dict.get(a.getCollectOrderGroup()),
category_index_dict.get(b.getCollectOrderGroup())) or \
cmp(a.getIntIndex(), b.getIntIndex())
if portal_type is None:
portal_type = self.getPortalMovementGroupTypeList()
movement_group_list = [x for x in self.contentValues(filter={'portal_type': portal_type}) \
......
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