several minor fixes

This commit is contained in:
Romain Bignon 2010-11-11 21:04:34 +01:00
commit 1fce063052

View file

@ -37,7 +37,7 @@ __all__ = ['PriorityConnection']
class PriorityConnection(Optimization): class PriorityConnection(Optimization):
CONFIG = ValuesDict(ValueInt('minimal', label='Minimal of godchilds', default=5), CONFIG = ValuesDict(ValueInt('minimal', label='Minimal of godchilds', default=5),
Value('domain', label='Domain to use for fake accounts emails', default='aum.example.com'), Value('domain', label='Domain to use for fake accounts emails', default='aum.example.com'),
Value('interval', label='Interval of checks (seconds)', default=3600) ValueInt('interval', label='Interval of checks (seconds)', default=3600)
) )
def __init__(self, sched, storage, browser): def __init__(self, sched, storage, browser):
@ -110,7 +110,7 @@ class PriorityConnection(Optimization):
# We'll check later # We'll check later
return return
missing_godchilds = self.config['minimal'] - nb_godchilds missing_godchilds = int(self.config['minimal']) - nb_godchilds
if missing_godchilds <= 0: if missing_godchilds <= 0:
return return
@ -128,7 +128,7 @@ class PriorityConnection(Optimization):
sex= 1, #slut sex= 1, #slut
birthday_d= random.randint(1,28), birthday_d= random.randint(1,28),
birthday_m= random.randint(1,12), birthday_m= random.randint(1,12),
birthday_y= random.randint(1970, 1990), birthday_y= random.randint(1975, 1990),
zipcode= 75001, zipcode= 75001,
country= 'fr', country= 'fr',
godfather= my_id) godfather= my_id)
@ -153,7 +153,10 @@ class PriorityConnection(Optimization):
self.logger.info('Fake account "%s" created (godfather=%s)' % (name, my_id)) self.logger.info('Fake account "%s" created (godfather=%s)' % (name, my_id))
def activity_fakes(self): def activity_fakes(self):
try:
fakes = self.storage.get('priority_connection', 'fakes', default={}) fakes = self.storage.get('priority_connection', 'fakes', default={})
if len(fakes) == 0:
return
while 1: while 1:
name = random.choice(fakes.keys()) name = random.choice(fakes.keys())
fake = fakes[name] fake = fakes[name]
@ -175,3 +178,6 @@ class PriorityConnection(Optimization):
# deblock # deblock
browser.deblock(profile.get_id()) browser.deblock(profile.get_id())
return return
except BrowserUnavailable:
# don't care
pass