Discussion:
[Erp5-dev] _local_properties
Tomasz Brzezina
2008-03-26 14:58:15 UTC
Permalink
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...
--
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/20080326/4807b301/attachment.bin>
Jérome Perrin
2008-03-26 15:19:37 UTC
Permalink
Post by Tomasz Brzezina
_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
__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',
'zope', 'state': 'current', 'time': DateTime('2008/03/25 14:54:46.408
GMT+1'), 'action': 'edit', 'serial': '884.44247.65075.10888'},
'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
Tomasz Brzezina
2008-03-26 16:39:32 UTC
Permalink
Post by Jérome Perrin
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.
yes, that's it! I decide to change property name, and first i change the
field name and than in propertysheet - and
it's possible that i edit some document before I restart zope
Post by Jérome Perrin
If you use svn revision > 20148, calling fixConsistency on this document
will repair this automatically by removing the local property.
ok I will try
--
T.

-------------- 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/20080326/ba9659bc/attachment.bin>
Tomasz Brzezina
2008-04-02 12:37:12 UTC
Permalink
Post by Jérome Perrin
If you use svn revision > 20148, calling fixConsistency on this document
will repair this automatically by removing the local property.
I have again this problem, but now i'm confused:

I add boolean property, restart zope, then add new fields to skin - and
modify some object - and Base_viewDict shows:

_local_properties ({'type': 'string', 'id': 'ads_home_agreement'},
{'type': 'string', 'id': 'home_ads_agreement'}, {'type': 'string', 'id':
'promotions_agreement'}, {'type': 'string', 'id': 'analysis_agreement'},
{'type': 'string', 'id': 'email_ads_agreement'})

(all of those properties are boolean!

fixConsistency generates:
*

Module Products.ERP5Type.Constraint.PropertyTypeValidity, line
97, in checkConsistency
095 | # if this property was a local property and has been
later added in a
096 | # property sheet, we want to remove it from
_local_properties
097>| if fixit and \
098 | property_id in [x['id'] for x in
obj._local_properties] and \
099 | len([x for x in obj._propertyMap() if x['id'] ==
property_id]) > 1:

AttributeError: _local_properties

What to do?
--
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/20080402/7da44bfe/attachment.bin>
Loading...