|
a/scripts/purge_project.py |
|
b/scripts/purge_project.py |
|
... |
|
... |
42 |
for name, cls in MappedClass._registry.iteritems():
|
42 |
for name, cls in MappedClass._registry.iteritems():
|
43 |
if 'project_id' in mapper(cls).property_index:
|
43 |
if 'project_id' in mapper(cls).property_index:
|
44 |
# Purge the things directly related to the project
|
44 |
# Purge the things directly related to the project
|
45 |
cls.query.remove(
|
45 |
cls.query.remove(
|
46 |
dict(project_id=project._id),
|
46 |
dict(project_id=project._id),
|
47 |
multiple=True)
|
47 |
)
|
48 |
elif 'app_config_id' in mapper(cls).property_index:
|
48 |
elif 'app_config_id' in mapper(cls).property_index:
|
49 |
# ... and the things related to its apps
|
49 |
# ... and the things related to its apps
|
50 |
cls.query.remove(
|
50 |
cls.query.remove(
|
51 |
dict(app_config_id={'$in':app_config_ids}),
|
51 |
dict(app_config_id={'$in':app_config_ids}),
|
52 |
multiple=True)
|
52 |
)
|
53 |
else:
|
53 |
else:
|
54 |
# Don't dump other things
|
54 |
# Don't dump other things
|
55 |
continue
|
55 |
continue
|
56 |
|
56 |
|
57 |
if __name__ == '__main__':
|
57 |
if __name__ == '__main__':
|