I'm using collective.taxonomy and I wanted to know if its possible to create a term programmatically and control the key or term identifier instead of getting a generated value.
I was looking at the utility.py where the taxonomy can be retrieved and there is an add function. When I try to test it in an upgrade step that I can re-run:
from zope.component import getUtility
from zope.schema.interfaces import IVocabularyFactory
def testAddTaxnomy(context):
vocab = getUtility(IVocabularyFactory,'collective.taxonomy.assettypes')
vocab.add(language='en',value='Crane',key='Crane')
it ends up existing (I call inverted_data and generate a simple vocabulary, and it was there) , but if I go to the utility control panel to edit the taxonomy, its not present. Also, I'm not sure how to use to insert it as a 'sub' term.
The reason I would like to is to have more control in an upgrade step so I don't have to make a large xml file where I can set the 'termIdentifier'.