[open-ils-commits] r577 - in constrictor/trunk: . contrib/evergreen (erickson)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jul 10 12:07:45 EDT 2009
Author: erickson
Date: 2009-07-10 12:07:43 -0400 (Fri, 10 Jul 2009)
New Revision: 577
Modified:
constrictor/trunk/constrictor.properties
constrictor/trunk/constrictor.py
constrictor/trunk/contrib/evergreen/eg_utils.py
Log:
added configurable dictionary file option, fixed comment typo
Modified: constrictor/trunk/constrictor.properties
===================================================================
--- constrictor/trunk/constrictor.properties 2009-07-09 21:26:08 UTC (rev 576)
+++ constrictor/trunk/constrictor.properties 2009-07-10 16:07:43 UTC (rev 577)
@@ -61,6 +61,7 @@
evergreen.username=demo
evergreen.password=demo123
evergreen.workstation=demo
+evergreen.dictionary=/usr/share/dict/words
#evergreen.titleIDs=
#evergreen.patronIDs=
#evergreen.orgIDs=
Modified: constrictor/trunk/constrictor.py
===================================================================
--- constrictor/trunk/constrictor.py 2009-07-09 21:26:08 UTC (rev 576)
+++ constrictor/trunk/constrictor.py 2009-07-10 16:07:43 UTC (rev 577)
@@ -38,7 +38,7 @@
-s test script to run (property constrictor.script)
-t number of threads to launch (property constrictor.numThreads)
-i number of test iterations per thread (property constrictor.numIterations)
- -d database file (constrictor.property dbFile)
+ -d database file (property constrictor.dbFile)
-p port to listen for controller connections on
-l listen address for incoming controller connections
''' % sys.argv[0]
Modified: constrictor/trunk/contrib/evergreen/eg_utils.py
===================================================================
--- constrictor/trunk/contrib/evergreen/eg_utils.py 2009-07-09 21:26:08 UTC (rev 576)
+++ constrictor/trunk/contrib/evergreen/eg_utils.py 2009-07-10 16:07:43 UTC (rev 577)
@@ -10,7 +10,8 @@
import os, errno, random
props = Properties.getProperties()
-words = None
+words = []
+default_dictionary = '/usr/share/dict/words'
def init():
global words
@@ -40,9 +41,15 @@
props.setProperty('evergreen.orgIDs', str(user.home_ou()))
- words_file = open('/usr/share/dict/words') # add config property
- words = words_file.readlines()
- words_file.close()
+ dict_file = props.getProperty('evergreen.dictionary') or default_dictionary
+ try:
+ words_file = open(dict_file)
+ except Exception:
+ logError("Unable to open dictionary file '%s'" % dict_file)
+ return
+
+ words = words_file.readlines()
+ words_file.close()
def initOsrf():
@@ -183,7 +190,10 @@
phrase = ''
for i in range(0, num_words):
- word = words[ int(random.random() * len(words)) ]
+ try:
+ word = words[ int(random.random() * len(words)) ]
+ except IndexError:
+ continue
phrase += '%s ' % word[0:len(word)-1]
return phrase
More information about the open-ils-commits
mailing list