def create_country_codes():
 user = tk.get_action('get_site_user')({'ignore_auth': True}, {})
 context = {'user': user['name']}
 try:
  data = {'id': 'country_codes'}
  tk.get_action('vocabulary_show')(context, data)
  logging.info('Example genre vocabulary already exists, skipping.')
 except tk.ObjectNotFound:
  logging.info("Creating vocab 'country_codes'")
  data = {'name': 'country_codes'}
  vocab = tk.get_action('vocabulary_create')(context, data)
  for tag in (u'uk', u'ie', u'de', u'fr', u'es'):
   logging.info("Adding tag {0} to vocab 'country_codes'".format(tag))
   data = {'name': tag, 'vocabulary_id': vocab['id']}
   tk.get_action('tag_create')(context, data)

def create_country_codes ( ) : user = tk . get_action ( 'get_site_user' ) ( { 'ignore_auth' : True } , { } ) context = { 'user' : user [ 'name' ] } try : data = { 'id' : 'country_codes' } tk . get_action ( 'vocabulary_show' ) ( context , data ) logging . info ( 'Example genre vocabulary already exists, skipping.' ) except tk . ObjectNotFound : logging . info ( "Creating vocab 'country_codes'" ) data = { 'name' : 'country_codes' } vocab = tk . get_action ( 'vocabulary_create' ) ( context , data ) for tag in ( u'uk' , u'ie' , u'de' , u'fr' , u'es' ) : logging . info ( "Adding tag {0} to vocab 'country_codes'" . format ( tag ) ) data = { 'name' : tag , 'vocabulary_id' : vocab [ 'id' ] } tk . get_action ( 'tag_create' ) ( context , data )
create country_codes vocab and tags .