def handle(self, *args, **options): datastore_size = REDIS_DATASTORE.dbsize() if datastore_size > 0: raise CommandError( "REDIS_DATASTORE must be empty, size is {0}".format( datastore_size)) InitializeEmptyRLSP()
def get_news(): news = [] # In demo mode, just create a news item regarding the # statistics of the REDIS_DATASTORE if REDIS_DATASTORE is not None: body_text = "<p><strong>Totals:</strong>" for key in CREATIVE_WORK_CLASSES: body_text += '{0} = {1}<br>'.format( key, REDIS_DATASTORE.get('global bf:{0}'.format(key))) body_text += '</p><p>Total number of keys={0}</p>'.format( REDIS_DATASTORE.dbsize()) item = {'heading': 'Current Statistics for Redis Datastore', 'body': body_text} news.append(item) ## body_html = '<ul>' ## for row in REDIS_DATASTORE.zrevrange('prospector-holdings', ## 0, ## -1, ## withscores=True): ## org_key, score = row[0], row[1] ## body_html += '''<li>{0} Total Holdings={1}</li>'''.format( ## REDIS_DATASTORE.hget(org_key, 'label'), ## score) ## body_html += '</ul>' ## item2 = {'heading': 'Institutional Collections', ## 'body': body_html} ## news.append(item2) return news