#NEWLINE# def update( user , password , lang = None ) : #NEWLINE# #INDENT# langs = getlangs ( lang ) #NEWLINE# puts ( ( 'Updating %s' % ', ' . join ( langs ) ) ) #NEWLINE# for loc in langs : #NEWLINE# #INDENT# with indent ( 2 ) : #NEWLINE# #INDENT# puts ( ( 'Downloading PO for %s' % loc ) ) #NEWLINE# #UNINDENT# url = ( 'https://www.transifex.com/projects/p/formhub/resource/django/l/%(lang)s/download/for_use/' % { #NEWLINE# #INDENT# 'lang' : loc , #NEWLINE# #UNINDENT# } ) #NEWLINE# try : #NEWLINE# #INDENT# tmp_po_file = download_with_login ( tmp_po_file , TX_LOGIN_URL , login = user , password = password , ext = 'po' , username_field = 'identification' , password_field = 'password' , form_id = 1 ) #NEWLINE# po_file = os . path . join ( REPO_ROOT , 'locale' , loc , 'LC_MESSAGES' , 'django.po' ) #NEWLINE# with indent ( 2 ) : #NEWLINE# #INDENT# puts ( ( 'Copying downloaded file to %s' % po_file ) ) #NEWLINE# #UNINDENT# shutil . move ( tmp_po_file , po_file ) #NEWLINE# #UNINDENT# except Exception as e : #NEWLINE# #INDENT# puts ( colored . red ( ( 'Unable to update %s from Transifex: %r' % ( loc , e ) ) ) ) #NEWLINE# #UNINDENT# puts ( colored . green ( ( 'sucesssfuly retrieved %s' % loc ) ) ) #NEWLINE# #UNINDENT# compile_mo ( langs )