131:be85d5073342
Anton Shestakov <av6@dwimlabs.net>, Thu, 11 Aug 2016 18:21:31 +0800
pipelines: make the second run quiet and check that nothing's changed Using exit within current shell (i.e. `{}` instead of `()`) is an experiment.

previous change 104:28caf44e903a

fruitbar/indexes.py

Permissions: -rw-r--r--

Other formats: Feeds:
from hashlib import md5
from CodernityDB.hash_index import HashIndex
class ProjectIndex(HashIndex):
def __init__(self, *args, **kwargs):
kwargs['key_format'] = '16s'
super(ProjectIndex, self).__init__(*args, **kwargs)
def make_key_value(self, data):
if data['_t'] == 'project':
return md5(data['workspace'].encode('utf-8')).digest(), None
def make_key(self, key):
return md5(key).digest()
class TaskIndex(HashIndex):
def __init__(self, *args, **kwargs):
kwargs['key_format'] = '16s'
super(TaskIndex, self).__init__(*args, **kwargs)
def make_key_value(self, data):
if data['_t'] == 'task':
return md5(data['workspace'].encode('utf-8')).digest(), None
def make_key(self, key):
return md5(key).digest()
def run_delete_for_project(self, db, workspace, project_id):
for task in db.get_many('task', workspace, with_doc=True):
if task['doc']['project_id'] == project_id:
db.delete(task['doc'])