Salve, spero di non essere troppo ermetico.
Ho cercato di seguire il libro di Aspeli cap 10
per implementare due Content Type
CatalogFolder e CatalogInstance,
con
CatalogInstance contenuto in CatalogFolder
Sembra tutto ok,
ma nella fase di testing non riesco a capire quante volte
viene chiamato validate_filexmlSrc.
Con
f = open('/tmp/out-3','a')
registro vedo tre chiamate ad ogni test
e sembra
da vari lanci con files di diverse dimensioni che la prima sia sempre ok.
open('/tmp/test-output.html','a').write(browser.contents)
mi dice che il content type f1 e' stato inserito correttamente.
Qualche idea ?
Grazie
--
luigi
class CatalogInstance(folder.ATFolder):
##
## varie cose qui
##
implements(ICatalogInstance)
portal_type = "CatalogInstance"
_at_rename_after_creation = True
schema = CatalogInstanceSchema
images = atapi.ATFieldProperty('images')
style = atapi.ATFieldProperty('style')
file_xml_src = atapi.ATFieldProperty('filexmlSrc')
catalog = None
def validate_filexmlSrc(self,value):
f = open('/tmp/out-3','a')
f.write(value.filename+":")
src = "\n".join(value.readlines())
if src is not None :
f.write(str(len(src))+"\n\n")
else:
f.write('None'+"\n\n")
f.close()
return None
README.txt :
## varie altre cose qui
Addable content
---------------
Catalog content is managed inside one root content types, a "Catalog
Folder"
>>> browser.open(portal_url)
Verify that we have the links to create catalogs item menu:
>>>
browser.getLink(url='/createObject?type_name=Catalog+Folder').click()
We set the title for this catalog folder
>>> browser.getControl(name='title').value='TestCatalogs'
>>> browser.getControl(name='form_submit').click()
Then we make a catalog instance 'f1' inside TestCatalogs
>>>
browser.getLink(url='/createObject?type_name=CatalogInstance').click()
>>> browser.getControl(name='title').value='f1'
>>>
browser.getControl(name='filexmlSrc_file').add_file(open('/tmp/catalog.xml'),'text/xml',
'catalog.xml')
>>> browser.getControl(name='form_submit').click()
>>> open('/tmp/test-output.html','a').write(browser.contents)
/tmp/out-3:
catalog.xml:8473289
catalog.xml:0
catalog.xml:8381003
_______________________________________________
Plone-IT mailing list
[email protected]
http://lists.plone.org/mailman/listinfo/plone-it
http://www.nabble.com/Plone---Italy-f21728.html