-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Yuri wrote:
> Hi!
> 
>   I'm would like to create some objects from an External Method. The 
> objects uses schemaextender.
> 
>   docid is defined on the schemaextender and works. This is the script:
> 
> def importa(self):
>      """ importa le risore metalib """
>      for i in docs[:10]:
>       iden = str(i)
>       _createObjectByType('Document', self, iden)
>       ris = self[iden]
>       ris.setTitle(iden)
>       ris.processForm()
>       ris.reindexObject()
>       subtype = 'ultradoc'
>       subtyper = getUtility(ISubtyper)
>       subtyper.change_type(ris,subtype)
> 
> I can access the Schema of ris, but it misses the docid attribute, so I 
> cannot get the field, the mutator or anything else. The funny thing is 
> that If I run a similar script after this, I can take the schema with 
> all the fields and have also the 'docid' field.
> 
>

Fields introduced through schemaextender do not have accessor mutator
methods. You have to use

some_obj.getField(fieldname).set(some_obj, value)
value = some_obj.getField(fieldname).get(some_obj)

- -aj
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkw60IsACgkQCJIWIbr9KYw91gCgk2N/m83cWvTAB7t9Tw0yoPdn
KdYAn37Gwc14tL1b6dFHJsveSgdMNXp6
=7D0v
-----END PGP SIGNATURE-----

<<attachment: lists.vcf>>

_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to