Commit 0f42911a authored by Alexandre Boeglin's avatar Alexandre Boeglin

1/ Replaced static accessors defined in Entity.py with dynamic accessors created

from PropertySheet 'acquired_property_id' property.

2/ Changed the behaviour of Coordinate so that getText and _setText use
methods defined in subclasses if they exist.


git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@7116 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent a6ebc1e6
...@@ -137,7 +137,12 @@ class Coordinate(Base): ...@@ -137,7 +137,12 @@ class Coordinate(Base):
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected( Permissions.AccessContentsInformation,
'getText') 'getText')
getText = asText def getText(self):
"""
calls asText
"""
return self.asText()
security.declareProtected( Permissions.ModifyPortalContent, 'fromText' ) security.declareProtected( Permissions.ModifyPortalContent, 'fromText' )
def fromText(self, coordinate_text): def fromText(self, coordinate_text):
...@@ -150,7 +155,11 @@ class Coordinate(Base): ...@@ -150,7 +155,11 @@ class Coordinate(Base):
return script(text=coordinate_text) return script(text=coordinate_text)
security.declareProtected(Permissions.ModifyPortalContent, '_setText') security.declareProtected(Permissions.ModifyPortalContent, '_setText')
_setText = fromText def _setText(self, value):
"""
calls fromText
"""
return self.fromText(value)
security.declareProtected( Permissions.AccessContentsInformation, security.declareProtected( Permissions.AccessContentsInformation,
'standardTextFormat') 'standardTextFormat')
......
This diff is collapsed.
...@@ -34,7 +34,7 @@ from Products.ERP5Type.XMLObject import XMLObject ...@@ -34,7 +34,7 @@ from Products.ERP5Type.XMLObject import XMLObject
from Products.ERP5.Core.MetaNode import MetaNode from Products.ERP5.Core.MetaNode import MetaNode
class Organisation(Entity, MetaNode, XMLObject): class Organisation(MetaNode, XMLObject):
""" """
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,
......
...@@ -49,7 +49,7 @@ try : ...@@ -49,7 +49,7 @@ try :
except ImportError: except ImportError:
pw_encrypt = lambda pw:pw pw_encrypt = lambda pw:pw
class Person(Entity, Node, XMLObject): class Person(Node, XMLObject):
""" """
An Person object holds the information about An Person object holds the information about
an person (ex. you, me, someone in the company, an person (ex. you, me, someone in the company,
......
...@@ -62,10 +62,16 @@ class Url(Coordinate, Base): ...@@ -62,10 +62,16 @@ class Url(Coordinate, Base):
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
'asText') 'asText')
def asText(self): def asText(self):
"""
Returns a text representation of the Url
"""
return self.url_string return self.url_string
security.declareProtected(Permissions.ModifyPortalContent, 'fromText') security.declareProtected(Permissions.ModifyPortalContent, 'fromText')
def fromText(self, text): def fromText(self, text):
"""
set the Url from its text representation
"""
self.url_string = text self.url_string = text
security.declareProtected(Permissions.AccessContentsInformation, security.declareProtected(Permissions.AccessContentsInformation,
......
...@@ -105,6 +105,8 @@ class Organisation: ...@@ -105,6 +105,8 @@ class Organisation:
'description' : 'The default address of this organisations', 'description' : 'The default address of this organisations',
'type' : 'content', 'type' : 'content',
'portal_type' : ('Address'), 'portal_type' : ('Address'),
'acquired_property_id' : ( 'text', 'street_address', 'city',
'zip_code', 'region', 'region_title'),
'acquisition_base_category' : ('region', ), 'acquisition_base_category' : ('region', ),
'acquisition_portal_type' : ('Category',), 'acquisition_portal_type' : ('Category',),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
...@@ -118,6 +120,7 @@ class Organisation: ...@@ -118,6 +120,7 @@ class Organisation:
'description' : 'The default phone for this organisation', 'description' : 'The default phone for this organisation',
'type' : 'content', 'type' : 'content',
'portal_type' : ('Telephone'), 'portal_type' : ('Telephone'),
'acquired_property_id' : ( 'text', 'telephone_number' ),
'acquisition_base_category' : ('region', ), 'acquisition_base_category' : ('region', ),
'acquisition_portal_type' : ('Category',), 'acquisition_portal_type' : ('Category',),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
...@@ -131,6 +134,7 @@ class Organisation: ...@@ -131,6 +134,7 @@ class Organisation:
'description' : 'A default mobile phone for this organisation', 'description' : 'A default mobile phone for this organisation',
'type' : 'content', 'type' : 'content',
'portal_type' : ('Telephone'), 'portal_type' : ('Telephone'),
'acquired_property_id' : ( 'text', 'telephone_number' ),
'acquisition_base_category' : ('region', ), 'acquisition_base_category' : ('region', ),
'acquisition_portal_type' : ('Category',), 'acquisition_portal_type' : ('Category',),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
...@@ -144,6 +148,7 @@ class Organisation: ...@@ -144,6 +148,7 @@ class Organisation:
'description' : 'The defaut fax phone number for this organisation', 'description' : 'The defaut fax phone number for this organisation',
'type' : 'content', 'type' : 'content',
'portal_type' : ('Fax'), 'portal_type' : ('Fax'),
'acquired_property_id' : ( 'text', 'telephone_number' ),
'acquisition_base_category' : ('region', ), 'acquisition_base_category' : ('region', ),
'acquisition_portal_type' : ('Category',), 'acquisition_portal_type' : ('Category',),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
...@@ -157,6 +162,7 @@ class Organisation: ...@@ -157,6 +162,7 @@ class Organisation:
'description' : 'The default email address for this organisation', 'description' : 'The default email address for this organisation',
'type' : 'content', 'type' : 'content',
'portal_type' : ('Email'), 'portal_type' : ('Email'),
'acquired_property_id' : ( 'text', ),
'acquisition_base_category' : ('region', ), 'acquisition_base_category' : ('region', ),
'acquisition_portal_type' : ('Category',), 'acquisition_portal_type' : ('Category',),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
...@@ -170,6 +176,7 @@ class Organisation: ...@@ -170,6 +176,7 @@ class Organisation:
'description' : 'An alternate email address for this organisation', 'description' : 'An alternate email address for this organisation',
'type' : 'content', 'type' : 'content',
'portal_type' : ('Email'), 'portal_type' : ('Email'),
'acquired_property_id' : ( 'text', ),
'acquisition_base_category' : ('region', ), 'acquisition_base_category' : ('region', ),
'acquisition_portal_type' : ('Category',), 'acquisition_portal_type' : ('Category',),
'acquisition_copy_value' : 0, 'acquisition_copy_value' : 0,
......
...@@ -98,6 +98,8 @@ class Person: ...@@ -98,6 +98,8 @@ class Person:
, 'description' : 'The current address of the person' , 'description' : 'The current address of the person'
, 'type' : 'content' , 'type' : 'content'
, 'portal_type' : ( 'Address', ) , 'portal_type' : ( 'Address', )
, 'acquired_property_id' : ( 'text', 'street_address', 'city',
'zip_code', 'region', 'region_title')
, 'acquisition_base_category': ( 'subordination', ) , 'acquisition_base_category': ( 'subordination', )
, 'acquisition_portal_type' : ( 'Organisation', ) , 'acquisition_portal_type' : ( 'Organisation', )
, 'acquisition_copy_value' : 0 , 'acquisition_copy_value' : 0
...@@ -113,6 +115,7 @@ class Person: ...@@ -113,6 +115,7 @@ class Person:
, 'description' : 'The current telephone of the person' , 'description' : 'The current telephone of the person'
, 'type' : 'content' , 'type' : 'content'
, 'portal_type' : ( 'Telephone', ) , 'portal_type' : ( 'Telephone', )
, 'acquired_property_id' : ( 'text', 'telephone_number' )
, 'acquisition_base_category': ( 'subordination', ) , 'acquisition_base_category': ( 'subordination', )
, 'acquisition_portal_type' : ( 'Organisation', ) , 'acquisition_portal_type' : ( 'Organisation', )
, 'acquisition_copy_value' : 0 , 'acquisition_copy_value' : 0
...@@ -127,6 +130,7 @@ class Person: ...@@ -127,6 +130,7 @@ class Person:
, 'description' : 'The current mobile telephone of the person' , 'description' : 'The current mobile telephone of the person'
, 'type' : 'content' , 'type' : 'content'
, 'portal_type' : ( 'Telephone', ) , 'portal_type' : ( 'Telephone', )
, 'acquired_property_id' : ( 'text', 'telephone_number' )
, 'acquisition_base_category': ( 'subordination', ) , 'acquisition_base_category': ( 'subordination', )
, 'acquisition_portal_type' : ( 'Organisation', ) , 'acquisition_portal_type' : ( 'Organisation', )
, 'acquisition_copy_value' : 0 , 'acquisition_copy_value' : 0
...@@ -141,6 +145,7 @@ class Person: ...@@ -141,6 +145,7 @@ class Person:
, 'description' : 'The current fax of the person' , 'description' : 'The current fax of the person'
, 'type' : 'content' , 'type' : 'content'
, 'portal_type' : ( 'Fax', ) , 'portal_type' : ( 'Fax', )
, 'acquired_property_id' : ( 'text', 'telephone_number' )
, 'acquisition_base_category': ( 'subordination', ) , 'acquisition_base_category': ( 'subordination', )
, 'acquisition_portal_type' : ( 'Organisation', ) , 'acquisition_portal_type' : ( 'Organisation', )
, 'acquisition_copy_value' : 0 , 'acquisition_copy_value' : 0
...@@ -155,6 +160,7 @@ class Person: ...@@ -155,6 +160,7 @@ class Person:
, 'description' : 'The current email of the person' , 'description' : 'The current email of the person'
, 'type' : 'content' , 'type' : 'content'
, 'portal_type' : ( 'Email', ) , 'portal_type' : ( 'Email', )
, 'acquired_property_id' : ( 'text', )
, 'acquisition_base_category': ( 'subordination', ) , 'acquisition_base_category': ( 'subordination', )
, 'acquisition_portal_type' : ( 'Organisation', ) , 'acquisition_portal_type' : ( 'Organisation', )
, 'acquisition_copy_value' : 0 , 'acquisition_copy_value' : 0
...@@ -169,6 +175,7 @@ class Person: ...@@ -169,6 +175,7 @@ class Person:
, 'description' : 'An alternate email of the person' , 'description' : 'An alternate email of the person'
, 'type' : 'content' , 'type' : 'content'
, 'portal_type' : ( 'Email', ) , 'portal_type' : ( 'Email', )
, 'acquired_property_id' : ( 'text', )
, 'acquisition_base_category': ( 'subordination', ) , 'acquisition_base_category': ( 'subordination', )
, 'acquisition_portal_type' : ( 'Organisation', ) , 'acquisition_portal_type' : ( 'Organisation', )
, 'acquisition_copy_value' : 0 , 'acquisition_copy_value' : 0
......
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