details: http://www.bx.psu.edu/hg/galaxy/rev/17db30ce0486 changeset: 3264:17db30ce0486 user: Greg Von Kuster <greg@bx.psu.edu> date: Mon Jan 25 10:01:04 2010 -0500 description: Fix fast_compute_length performance by using version contributed by Bjoern Gruning, and fix email configuration bug in the user controller which was found by Ed Kirton. diffstat: lib/galaxy/web/controllers/user.py | 2 +- tools/fasta_tools/fasta_compute_length.py | 41 +++++++++++++++--------------- 2 files changed, 22 insertions(+), 21 deletions(-) diffs (73 lines): diff -r fe6e3c197d69 -r 17db30ce0486 lib/galaxy/web/controllers/user.py --- a/lib/galaxy/web/controllers/user.py Sun Jan 24 17:38:05 2010 -0500 +++ b/lib/galaxy/web/controllers/user.py Mon Jan 25 10:01:04 2010 -0500 @@ -593,7 +593,7 @@ for i in range(15): new_pass = new_pass + choice(chars) mail = os.popen("%s -t" % trans.app.config.sendmail_path, 'w') - mail.write("To: %s\nFrom: no-reply@%s\nSubject: Galaxy Password Reset\n\nYour password has been reset to \"%s\" (no quotes)." % (email, trans.request.remote_addr, new_pass) ) + mail.write("To: %s\nFrom: no-reply@nowhere.edu\nSubject: Galaxy Password Reset\n\nYour password has been reset to \"%s\" (no quotes)." % (email, new_pass) ) if mail.close(): return trans.show_error_message( 'Failed to reset password. If this problem persists, please submit a bug report.' ) reset_user.set_password_cleartext( new_pass ) diff -r fe6e3c197d69 -r 17db30ce0486 tools/fasta_tools/fasta_compute_length.py --- a/tools/fasta_tools/fasta_compute_length.py Sun Jan 24 17:38:05 2010 -0500 +++ b/tools/fasta_tools/fasta_compute_length.py Mon Jan 25 10:01:04 2010 -0500 @@ -12,35 +12,36 @@ def __main__(): infile = sys.argv[1] - outfile = sys.argv[2] - keep_first = int( sys.argv[3] ) - - fasta_title = fasta_seq = '' + out = open( sys.argv[2], 'w') + keep_first_char = int( sys.argv[3] ) + + fasta_title = '' + seq_len = 0 # number of char to keep in the title - if keep_first == 0: - keep_first = None + if keep_first_char == 0: + keep_first_char = None else: - keep_first += 1 + keep_first_char += 1 - out = open(outfile, 'w') - - for i, line in enumerate( file( infile ) ): - line = line.rstrip( '\r\n' ) + first_entry = True + + for line in open( infile ): + line = line.strip() if not line or line.startswith( '#' ): continue if line[0] == '>': - if len( fasta_seq ) > 0 : - out.write( "%s\t%d\n" % ( fasta_title[ 1:keep_first ], len( fasta_seq ) ) ) + if first_entry == False: + out.write( "%s\t%d\n" % ( fasta_title[ 1:keep_first_char ], seq_len ) ) + else: + first_entry = False fasta_title = line - fasta_seq = '' + seq_len = 0 else: - fasta_seq = "%s%s" % ( fasta_seq, line ) - - # check the last sequence - if len( fasta_seq ) > 0: - out.write( "%s\t%d\n" % ( fasta_title[ 1:keep_first ], len( fasta_seq ) ) ) - + seq_len += len(line) + + # last fasta-entry + out.write( "%s\t%d\n" % ( fasta_title[ 1:keep_first_char ], seq_len ) ) out.close() if __name__ == "__main__" : __main__() \ No newline at end of file