Commit 14db3188 authored by Jérome Perrin's avatar Jérome Perrin

Simplify class and property sheet hierarchy for coordinates

Coordinate base class already inherit from Base, so no need for class
inheriting from Coordinate to inherit from Base again. Also, no need to reapeat
the property sheets that are already defined on Coordinate.
parent 5e6a9e24
...@@ -52,9 +52,7 @@ class BankAccount(Node, Coordinate): ...@@ -52,9 +52,7 @@ class BankAccount(Node, Coordinate):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties # Declarative properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.CategoryCore
, PropertySheet.SimpleItem
, PropertySheet.CategoryCore
, PropertySheet.Task , PropertySheet.Task
, PropertySheet.Resource , PropertySheet.Resource
, PropertySheet.Reference , PropertySheet.Reference
......
...@@ -29,14 +29,13 @@ ...@@ -29,14 +29,13 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Base import Base
from Products.ERP5Type.Utils import deprecated from Products.ERP5Type.Utils import deprecated
from Products.ERP5.Document.Coordinate import Coordinate from Products.ERP5.Document.Coordinate import Coordinate
import string import string
class GeographicAddress(Coordinate, Base): class GeographicAddress(Coordinate):
""" """
A geographic address holds a complete set of A geographic address holds a complete set of
geographic coordinates including street, number, geographic coordinates including street, number,
...@@ -44,9 +43,6 @@ class GeographicAddress(Coordinate, Base): ...@@ -44,9 +43,6 @@ class GeographicAddress(Coordinate, Base):
Geographic address is a terminating leaf Geographic address is a terminating leaf
in the OFS. It can not contain anything. in the OFS. It can not contain anything.
Geographic address inherits from Base and
from the mix-in Coordinate
""" """
meta_type = 'ERP5 Geographic Address' meta_type = 'ERP5 Geographic Address'
portal_type = 'Address' portal_type = 'Address'
...@@ -57,11 +53,8 @@ class GeographicAddress(Coordinate, Base): ...@@ -57,11 +53,8 @@ class GeographicAddress(Coordinate, Base):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties # Declarative properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.SortIndex
, PropertySheet.SimpleItem
, PropertySheet.SortIndex
, PropertySheet.CategoryCore , PropertySheet.CategoryCore
, PropertySheet.Coordinate
, PropertySheet.GeographicAddress , PropertySheet.GeographicAddress
) )
......
...@@ -29,13 +29,12 @@ ...@@ -29,13 +29,12 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Base import Base
from Products.ERP5Type.Utils import convertToUpperCase from Products.ERP5Type.Utils import convertToUpperCase
from Products.ERP5Type.Utils import deprecated from Products.ERP5Type.Utils import deprecated
from Products.ERP5.Document.Coordinate import Coordinate from Products.ERP5.Document.Coordinate import Coordinate
class InternetProtocolAddress(Base, Coordinate): class InternetProtocolAddress(Coordinate):
""" """
A internet protocol address holds a address of A internet protocol address holds a address of
a computer on computer network using TCP/IP. a computer on computer network using TCP/IP.
...@@ -49,12 +48,9 @@ class InternetProtocolAddress(Base, Coordinate): ...@@ -49,12 +48,9 @@ class InternetProtocolAddress(Base, Coordinate):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties # Declarative properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.CategoryCore
, PropertySheet.SimpleItem , PropertySheet.InternetProtocolAddress
, PropertySheet.CategoryCore )
, PropertySheet.Coordinate
, PropertySheet.InternetProtocolAddress
)
def _splitCoordinateText(self, coordinate_text): def _splitCoordinateText(self, coordinate_text):
property_id_list = [i['id'] for i in PropertySheet.InternetProtocolAddress._properties] property_id_list = [i['id'] for i in PropertySheet.InternetProtocolAddress._properties]
......
...@@ -29,13 +29,12 @@ ...@@ -29,13 +29,12 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Base import Base
from Products.ERP5Type.Utils import deprecated from Products.ERP5Type.Utils import deprecated
from Products.ERP5.Document.Coordinate import Coordinate from Products.ERP5.Document.Coordinate import Coordinate
import re import re
class Telephone(Coordinate, Base): class Telephone(Coordinate):
""" """
A telephone is a coordinate which stores a telephone number A telephone is a coordinate which stores a telephone number
The telephone class may be used by multiple content types (ex. Fax, The telephone class may be used by multiple content types (ex. Fax,
...@@ -44,9 +43,6 @@ class Telephone(Coordinate, Base): ...@@ -44,9 +43,6 @@ class Telephone(Coordinate, Base):
A telephone is a terminating leaf A telephone is a terminating leaf
in the OFS. It can not contain anything. in the OFS. It can not contain anything.
Telephone inherits from Base and
from the mix-in Coordinate
A list of I18N telephone codes can be found here:: A list of I18N telephone codes can be found here::
http://kropla.com/dialcode.htm http://kropla.com/dialcode.htm
""" """
...@@ -60,11 +56,8 @@ class Telephone(Coordinate, Base): ...@@ -60,11 +56,8 @@ class Telephone(Coordinate, Base):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Declarative properties # Declarative properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.CategoryCore
, PropertySheet.SimpleItem
, PropertySheet.CategoryCore
, PropertySheet.SortIndex , PropertySheet.SortIndex
, PropertySheet.Coordinate
, PropertySheet.Telephone , PropertySheet.Telephone
) )
# This is a list of regex. # This is a list of regex.
......
...@@ -30,7 +30,6 @@ ...@@ -30,7 +30,6 @@
from AccessControl import ClassSecurityInfo from AccessControl import ClassSecurityInfo
from Products.CMFCore.utils import getToolByName from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet from Products.ERP5Type import Permissions, PropertySheet
from Products.ERP5Type.Base import Base
from Products.ERP5Type.Utils import deprecated from Products.ERP5Type.Utils import deprecated
from Products.ERP5.Document.Coordinate import Coordinate from Products.ERP5.Document.Coordinate import Coordinate
from Products.ERP5.mixin.url import UrlMixin, no_crawl_protocol_list,\ from Products.ERP5.mixin.url import UrlMixin, no_crawl_protocol_list,\
...@@ -39,7 +38,7 @@ from zLOG import LOG ...@@ -39,7 +38,7 @@ from zLOG import LOG
_marker = object() _marker = object()
class Url(Coordinate, Base, UrlMixin): class Url(Coordinate, UrlMixin):
""" """
A Url is allows to represent in a standard way coordinates A Url is allows to represent in a standard way coordinates
such as web sites, emails, ftp sites, etc. such as web sites, emails, ftp sites, etc.
...@@ -54,10 +53,7 @@ class Url(Coordinate, Base, UrlMixin): ...@@ -54,10 +53,7 @@ class Url(Coordinate, Base, UrlMixin):
security.declareObjectProtected(Permissions.AccessContentsInformation) security.declareObjectProtected(Permissions.AccessContentsInformation)
# Default Properties # Default Properties
property_sheets = ( PropertySheet.Base property_sheets = ( PropertySheet.Url
, PropertySheet.SimpleItem
, PropertySheet.Coordinate
, PropertySheet.Url
, PropertySheet.SortIndex , PropertySheet.SortIndex
) )
......
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