Re: creating a metadata set
Andy <[email protected]>
| Newsgroups | gmane.comp.web.zope.silva.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Guido,
Thanks for your reply. It seems one needs to create a metadata set in xml on
the fs and then import it into silva. Seems to save my MultiListFields just
fine. Seems like using the ZMI to create metadata for silva was never
tested. I guess that's why the link in the service_metadata says 'Browse'
and not 'Manage', and also why there is no 'export as xml' feature. At least
the latter would be nice, since one who isn't familiar with the xml format
could use the ZMI to create the set, and then export. Anyways, just a dream
I guess ;-)
Thanks so much for the help!
Andy
----
Here's the external method I used to import my metadata set:
def install_metadata(context):
root = context.get_root()
from os import path
from Products.SilvaMetadata.Extensions.SilvaInstall import install as
install_metadata
collection = root.service_metadata.getCollection()
if 'its-kb' in collection.objectIds():
collection.manage_delObjects(['its-kb'])
xml_file = '/export1/Zope-2.7.2-0/Products/SilvaECT/kb_metadata.xml'
fh = open(xml_file, 'r')
collection.importSet(fh)
# initialize the default set if not already initialized
for set in collection.getMetadataSets():
if not set.isInitialized():
set.initialize()
return 'Im in here!'
---
I created a python script to call this external method, and 'tested' that
script. The import process was nice enough to raise errors informing me
where my metadata wasn't valid.
> Hmmm... Weird, I created a couple of sets and they worked just fine. Of
> course I built them in XML on the filesystem, perhaps (although
> unlikely) that gives some extra options or something?
>
> >The catalog service says the indexes for my metadata set are in the
> > catalog.
> >
> >Any ideas why my set won't save?
>
> None whatsoever, however I'm not all that familiar with the system,
> especially not concerning creation via the ZMI. Perhaps you can try to
> create one on the fs and send us the XML if the problem persists?
> (Another option would obviously be that someone with some more insight
> would answer this question... ;)
>
> Cheers,
>
> Guido