Il 09/07/2010 18:12, cewing ha scritto:
>
> Yuri-11 wrote:
>    
>>
>> 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.
>>
>> Any idea? Is a problem of external methods, should I use a browser view?
>>
>>      
> Read this thread:
>
> http://plone.293351.n2.nabble.com/Accessors-for-SchemaExtender-fields-in-BrowserViews-td4610706.html
>
> Sounds a lot like your problem.
>
> c
>
>    
I've already tried this, but don't works...

It works ONLY if you create the object then you call the methods:

browser.pt:

<span tal:content="view/importa"  />
<span tal:content="view/finisci" />


browser.py:

     def importa(self):
         """ importa le risore metalib """
         for i in docs:
           iden = str(i)
           _createObjectByType('Document', self.context, iden)
           ris = self.context[iden]
           ris.setTitle(iden)
           ris.processForm()
           ris.reindexObject()
           subtype = 'ultradoc'
           subtyper = getUtility(ISubtyper)
           subtyper.change_type(ris,subtype)

     def finisci(self):
         """ end it!! """
         for o in self.context.objectValues():
           schema = o.Schema()
           campo = schema['docid']
           if campo == None:
             return 'nothing!'
           else:
             campo.getMutator(o)(o.id)
             o.reindexObject()

If you do "finisci" in "importa", the schemaextender "docid" field is 
not found (I call the browser view over a folder, first to create N 
objects, then fill the docid field with the id of the object).
_______________________________________________
Product-Developers mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/product-developers

Reply via email to