@task(queue='web')
def update_static_metadata(project_pk, path=None):
 project = Project.objects.get(pk=project_pk)
 if (not path):
  path = project.static_metadata_path()
 log.info(LOG_TEMPLATE.format(project=project.slug, version='', msg='Updating static metadata'))
 translations = [trans.language for trans in project.translations.all()]
 languages = set(translations)
 metadata = {'version': project.default_version, 'language': project.language, 'languages': list(languages), 'single_version': project.single_version}
 try:
  fh = open(path, 'w+')
  json.dump(metadata, fh)
  fh.close()
  Syncer.copy(path, path, host=socket.gethostname(), file=True)
 except (AttributeError, IOError) as e:
  log.debug(LOG_TEMPLATE.format(project=project.slug, version='', msg='Cannot write to metadata.json: {0}'.format(e)))

@ task ( queue = 'web' ) def update_static_metadata ( project_pk , path = None ) : project = Project . objects . get ( pk = project_pk ) if ( not path ) : path = project . static_metadata_path ( ) log . info ( LOG_TEMPLATE . format ( project = project . slug , version = '' , msg = 'Updating static metadata' ) ) translations = [ trans . language for trans in project . translations . all ( ) ] languages = set ( translations ) metadata = { 'version' : project . default_version , 'language' : project . language , 'languages' : list ( languages ) , 'single_version' : project . single_version } try : fh = open ( path , 'w+' ) json . dump ( metadata , fh ) fh . close ( ) Syncer . copy ( path , path , host = socket . gethostname ( ) , file = True ) except ( AttributeError , IOError ) as e : log . debug ( LOG_TEMPLATE . format ( project = project . slug , version = '' , msg = 'Cannot write to metadata.json: {0}' . format ( e ) ) )
this is here to avoid circular imports in models .