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