[Erp5-dev] own getter
Tomasz Brzezina
tomasz at brzezina.pl
Fri Mar 7 16:28:47 CET 2008
bartek pisze:
> Łukasz Nowak wrote:
>> Hello,
>>
>> On 2008-03-05, 13:11:44
>> Tomasz Brzezina <tomasz at brzezina.pl> wrote:
>>
>>> I made two new properties in PropertySheet/cavempPersonProperty.py
>>>
>>> and after adding it in right portal_types - everything works
>>> perfectly. But now I need an concatenation of those two which i need
>>> in listbox -
>>>
>>> so I have to made a getter which returns a concatenation. The
>>> question is: WHERE should I wrote the code. I think the
>>> PropertySheet/cavempPersonProperty.py is the wrong place - but I have
>>> no idea where is the right place. Of course I can write it in
>>> anywhere patching the existing code, but this will broke updating. So
>>> where should I put my code.
>> I hit same problem some time ago - I needed to made my own accessor.
>> What I done is getter in ZODB, and my property definition looks like:
>>
>> {
>> 'id' : 'trade_name',
>> 'description' : 'Trade name of resource',
>> 'type' : 'string',
>> 'mode' : 'w',
>> 'acquisition_base_category' : ('object',),
>> 'acquisition_portal_type' : Expression('python: []'),
>> 'acquisition_accessor_id' : 'getTradeName',
>> 'alt_accessor_id' : ('Base_getTradeName',),
>> 'acquisition_mask_value' : 1,
>> 'default' : '',
>> },
>>
>
> Cool - I never thought about doing it like that. Why is it not on the wiki??
well - can somebody explain sth more?
SHould I make a folder in custom called my_python_scripts and inside
make getCustomerNumber python script
and add property:
{
'id' : 'customer_number',
'description' : 'customer_number prepared by joining two other
properties',
'type' : 'string',
'mode' : 'w',
'acquisition_base_category' : ('object',),
'acquisition_portal_type' : Expression('python: []'),
'acquisition_accessor_id' : 'getCustomerNumber',
'alt_accessor_id' : ('my_python_scripts',),
'acquisition_mask_value' : 1,
'default' : '',
},
Or what?
--
Tomasz Brzezina
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3327 bytes
Desc: S/MIME Cryptographic Signature
URL: <http://mail.tiolive.com/pipermail/erp5-dev/attachments/20080307/2cc5ef90/attachment.bin>
More information about the Erp5-dev
mailing list