I am trying to fetch a Named Vocabulary and loop through its contents. Below is the code I have so far.
def get_car_types(self):
car_types = []
vtool = getToolByName(self, 'portal_vocabularies')
cars_vocab = vtool.getVocabularyByName('my.package.car_models')
for terms in cars_vocab:
print terms.value + ": " + terms.title
I get the following error:
AttributeError: 'int' object has no attribute 'startswith'
It points out that the error is somewhere around this line:
for terms in cars_vocab:
What could be the problem? How does one fetch a named vocabulary and loop through the values? I have been using this link.