[Erp5-dev] _local_properties
Jérome Perrin
jerome at nexedi.com
Wed Mar 26 16:19:37 CET 2008
Tomasz Brzezina a écrit :
> i made such new properties in PropertySheet folder:
>
> _properties = (
> {'id' : 'family_number',
> 'description' : '',
> 'type' : 'string',
> 'mode' : 'w',
> 'default' : '',},
> {'id' : 'in_family_number',
> 'description' : '',
> 'type' : 'string',
> 'mode' : 'w',
> 'default' : '',},
> {'id' : 'reference',
> 'description' : '',
> 'type' : 'string',
> 'mode' : 'w',
> 'acquisition_base_category' : ('object',),
> 'acquisition_portal_type' : Expression('python: []'),
> 'acquisition_accessor_id' : 'getReference',
> 'alt_accessor_id' : ('LoyaltyCard_getReference',),
> 'acquisition_mask_value' : 0,
> 'default' : '',},
> {'id' : 'title',
> 'description' : '',
> 'type' : 'string',
> 'mode' : 'w',
> 'acquisition_base_category' : ('object',),
> 'acquisition_portal_type' : Expression('python: []'),
> 'acquisition_accessor_id' : 'getTitle',
> 'alt_accessor_id' : ('LoyaltyCard_getTitle',),
> 'acquisition_mask_value' : 0,
> 'default' : '',}
> )
>
> I use it in portal_type/Loyalty_Card selecting it in PropertySheets listbox
>
> everything appears well, but I wonder WHY
>
> /erp5/person_module/1/2/Base_viewDict
>
> returns:
>
> __ac_local_roles__ {'zope': ['Owner']}
> _local_properties ({'type': 'string', 'id': 'in_family_number'},)
> categories ('discount_type/staff',)
> family_number '0001'
> id '2'
> in_family_number '34'
> portal_type 'Loyalty Card'
> start_date_range_max DateTime('2020/12/31')
> start_date_range_min DateTime('1990/01/01')
> title '34201230100010'
> uid 2393L
> workflow_history {'edit_workflow': <WorkflowHistoryList object at
> 0x-4b3f7b14 ({'comment': '', 'actor': 'zope', 'state': 'current',
> 'time': DateTime('2008/03/25 13:54:26.027 GMT+1'), 'action': 'edit',
> 'serial': '0.0.0.0'}, {'comment': '', 'actor': 'zope', 'state':
> 'current', 'time': DateTime('2008/03/25 14:11:59.504 GMT+1'), 'action':
> 'edit', 'serial': '884.44230.28517.51524'}, {'comment': '', 'actor':
> 'zope', 'state': 'current', 'time': DateTime('2008/03/25 14:54:46.408
> GMT+1'), 'action': 'edit', 'serial': '884.44247.65075.10888'},
> {'comment': '', 'actor': 'zope', 'state': 'current', 'time':
> DateTime('2008/03/25 14:55:06.347 GMT+1'), 'action': 'edit', 'serial':
> '884.44290.50798.60842'}, {'comment': '', 'actor': 'zope', 'state':
> 'current', 'time': DateTime('2008/03/25 15:05:11.557 GMT+1'), 'action':
> 'edit', 'serial': '884.44291.6998.5922'})>}
>
> The question is: why in_family_number IS _local_properties, and
> family_number IS NOT...
Hello,
A local property "in_family_number" will be created if you don't have
"in_family_number" defined in your property sheets, and you call
context.edit(in_family_number='something').
This is what happens when you edit a document with a form containing a
"my_in_family_number" field. So if you created your form and used it to
edit some documents before you actually associated this property sheet
to the document type, you are in this situation.
If you use svn revision > 20148, calling fixConsistency on this document
will repair this automatically by removing the local property.
Jérome
More information about the Erp5-dev
mailing list