Changeset 103 for trunk/trac/contrib
- Timestamp:
- 05/01/08 21:46:48 (8 months ago)
- Files:
-
- trunk/trac/contrib/bugzilla2trac.py (modified) (3 diffs)
- trunk/trac/contrib/htdigest.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/trac/contrib/bugzilla2trac.py
r46 r103 15 15 Many enhancements, Bill Soudan <bill@soudan.net> 16 16 Other enhancements, Florent Guillaume <fg@nuxeo.com> 17 Reworked, Jeroen Ruigrok van der Werven <asmodai@ tendra.org>17 Reworked, Jeroen Ruigrok van der Werven <asmodai@in-nomine.org> 18 18 19 19 $Id$ … … 29 29 # 30 30 # Currently, the following bugzilla versions are known to work: 31 # 2.11 (2110), 2.16.5 (2165), 2.18.3 (2183), 2.19.1 (2191) 31 # 2.11 (2110), 2.16.5 (2165), 2.18.3 (2183), 2.19.1 (2191), 2.23.3 (2233) 32 32 # 33 33 # If you run this script on a version not listed here and it is successful, 34 # please report it to the Trac mailing list and drop a noteto35 # asmodai@tendra.org so we can update the list.34 # please file a ticket at http://trac.edgewall.org/ and assign it to 35 # jruigrok. 36 36 BZ_VERSION = 2180 37 37 … … 428 428 def getFieldName(self, cursor, fieldid): 429 429 if fieldid not in self.fieldNameCache: 430 cursor.execute("SELECT * FROM fielddefs WHERE fieldid = %s", 431 (fieldid)) 430 # fielddefs.fieldid got changed to fielddefs.id in Bugzilla 431 # 2.23.3. 432 if BZ_VERSION >= 2233: 433 cursor.execute("SELECT * FROM fielddefs WHERE id = %s", 434 (fieldid)) 435 else: 436 cursor.execute("SELECT * FROM fielddefs WHERE fieldid = %s", 437 (fieldid)) 432 438 fieldName = cursor.fetchall() 433 439 trunk/trac/contrib/htdigest.py
r57 r103 23 23 from getpass import getpass 24 24 25 def get_digest(userprefix):25 def ask_pass(): 26 26 pass1 = getpass('New password: ') 27 27 pass2 = getpass('Re-type new password: ') … … 29 29 print >>sys.stderr, "They don't match, sorry" 30 30 sys.exit(1) 31 return userprefix + md5.new(userprefix + pass1).hexdigest()31 return pass1 32 32 33 usage = "%prog [-c] passwordfile realm username" 33 def get_digest(userprefix, password=None): 34 if password == None: 35 password = ask_pass() 36 return make_digest(userprefix, password) 37 38 def make_digest(userprefix, password): 39 return userprefix + md5.new(userprefix + password).hexdigest() 40 41 usage = "%prog [-c] [-b] passwordfile realm username" 34 42 parser = OptionParser(usage=usage) 35 43 parser.add_option('-c', action='store_true', dest='create', default=False, 36 44 help='Create a new file') 45 parser.add_option('-b', action='store_true', dest='batch', default=False, 46 help='Batch mode, password on the commandline.') 37 47 38 48 opts, args = parser.parse_args() 39 49 40 50 try: 41 filename, realm, username = args 51 if opts.batch: 52 filename, realm, username, password = args 53 else: 54 filename, realm, username = args 55 password = None 42 56 except ValueError: 43 57 parser.error('Wrong number of arguments') … … 55 69 raise 56 70 try: 57 print >>f, get_digest(prefix )71 print >>f, get_digest(prefix, password) 58 72 finally: 59 73 f.close() … … 64 78 if line.startswith(prefix): 65 79 if not matched: 66 print get_digest(prefix )80 print get_digest(prefix, password) 67 81 matched = True 68 82 else: … … 71 85 f = open(filename, 'a') 72 86 try: 73 print >>f, get_digest(prefix )87 print >>f, get_digest(prefix, password) 74 88 finally: 75 89 f.close()