make_range function is fixed and properly tested

Fixes bug 1223293

Change-Id: I9c285be69cfa3e021cec418e5d794328b6066732
This commit is contained in:
Ilya Shakhat
2013-09-10 15:12:28 +04:00
parent 1774bd973f
commit 3e29cb9ea2
3 changed files with 56 additions and 10 deletions

View File

@@ -52,6 +52,14 @@ def read_json_from_uri(uri):
LOG.warn('Error while reading uri: %s' % e)
def make_range(start, stop, step):
last_full = stop - ((stop - start) % step)
for i in xrange(start, last_full, step):
yield xrange(i, i + step)
if stop > last_full:
yield xrange(last_full, stop)
def store_user(runtime_storage_inst, user):
runtime_storage_inst.set_by_key('user:%s' % user['user_id'], user)