Commit 4ec68740 authored by Jérome Perrin's avatar Jérome Perrin

Add more comments in Coordinate interface about the use of type based method...

Add more comments in Coordinate interface about the use of type based method in asText and fromText.
Mark Document.Coordinate implementing Coordinate interface.
Lookup the type based method in Telephone.fromText, remove the reindex_object in Telephone.fromText, as it is not part of the interface.



git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@11044 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 589281df
......@@ -78,6 +78,9 @@ class Coordinate(Base):
add_permission = Permissions.AddPortalContent
isPortalContent = 1
isRADContent = 1
# Declarative interface
__implements__ = (Interface.Coordinate)
# Declarative security (replaces __ac_permissions__)
security = ClassSecurityInfo()
......
......@@ -59,7 +59,7 @@ class Telephone(Coordinate, Base):
# Declarative security
security = ClassSecurityInfo()
security.declareObjectProtected(Permissions.AccessContentsInformation) # ???????
security.declareObjectProtected(Permissions.AccessContentsInformation)
# The standard parser is used to read phone numbers
# written in a standard syntax
......@@ -73,7 +73,12 @@ class Telephone(Coordinate, Base):
security.declareProtected(Permissions.ModifyPortalContent, 'fromText')
def fromText(self, coordinate_text,reindex_object=1):
def fromText(self, coordinate_text):
""" See ICoordinate.fromText """
method = self._getTypeBasedMethod('fromText')
if method is not None:
return method(text=coordinate_text)
if coordinate_text is None:
coordinate_text = ''
if self.standard_parser.match(coordinate_text):
......@@ -84,8 +89,7 @@ class Telephone(Coordinate, Base):
number = coordinate_text
self.edit(telephone_country = country,
telephone_area = area,
telephone_number = number,
reindex_object=reindex_object)
telephone_number = number, )
security.declareProtected(Permissions.ModifyPortalContent, '_setText')
_setText = fromText
......
......@@ -40,12 +40,17 @@ class Coordinate(Interface):
def asText():
"""
returns the coordinate as a text string
This method usually tries to lookup a skin named ${PortalType}_asText and
to use this script to display the coordinate text.
"""
pass
def fromText(coordinate_text):
"""
modifies the coordinate according to the input text
modifies the coordinate according to the input text.
This method usually tries to lookup a skin named ${PortalType}_fromText and
to use this script to modify the properties of this document.
"""
pass
......
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