from uuid import uuid4 from main import Init, init_collection init_coverages = Init('coverages', [{ 'title': 'default coverage', 'uuid': str(uuid4().hex) # keep this in synch with the entity }]) if __name__ == "__main__": init_collection(init_coverages)
from main import init_collection from users import init_users from coverages import init_coverages from core_config import init_core_config if __name__ == '__main__': for init in [ init_users, init_coverages, init_core_config ]: init_collection(init)
from uuid import uuid4 from main import Init, init_collection init_coverages = Init( 'coverages', [{ 'title': 'default coverage', 'uuid': str(uuid4().hex) # keep this in synch with the entity }]) if __name__ == "__main__": init_collection(init_coverages)
'key': 'new', 'direct': False, 'description': 'This report has been received' }, { 'key': 'assigned', 'direct': False, 'description': 'This report has been assigned for verification' }, { 'key': 'dismissed', 'direct': True, 'description': 'This report has been dismissed as irrelevant' }, { 'key': 'debunked', 'direct': True, 'description': 'This report has been found false' }, { 'key': 'verified', 'direct': True, 'description': 'This report has been verified' }, { # this status is not useful for its description. this is the value # that is set by the client side when the status is indirect. when # a status is indirect its value is not determined by the value of # the status property, but by other properties 'key': '', 'direct': True, 'description': '' }]) if __name__ == "__main__": init_collection(init_report_statuses)
from main import Init, init_collection init_steps = Init('steps', [{ 'description': 'I have contacted this citizen reporter', 'mandatory': False }, { 'description': 'I have obtained the rights to use this report from the citizen reporter', 'mandatory': False }, { 'description': 'I have determined the location of the report', 'mandatory': False }]) if __name__ == "__main__": init_collection(init_steps)
collection. Configuration is grouped in documents in order to be possibly overwritten by user settings. Every configuration document has a property named `type`. There should be a single document for every given `type` value. Generally, when one of the configuration keys is missing, the core will use internal defaults. """ from main import Init, init_collection init_core_config = Init( "core_config", [{ "type": "sms", "set": { # session duration in hours "sms_session_duration": 24, # whether to send an automatic reply or not "sms_reply_send": True, # content of the automatic reply "sms_reply_message": "Thank you for your report. Let us know more about it by telling us: 1) Your name 2) Your location. A reporter may contact you directly." } }]) if __name__ == "__main__": init_collection(init_core_config)
from main import init_collection from users import init_users from coverages import init_coverages from core_config import init_core_config from report_statuses import init_report_statuses from steps import init_steps if __name__ == '__main__': for init in [ init_users, init_coverages, init_core_config, init_report_statuses, init_steps ]: init_collection(init)
'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }] # like in https://github.com/superdesk/Live-Blog/blob/63c713a90b8e464aff62a032cb5d85f6b1220d1d/plugins/livedesk-sync/livedesk/core/impl/chained_sync.py#L303 for document in documents: document['password'] = '******' document['uuid'] = str(uuid4().hex) init_users = Init('users', documents) if __name__ == "__main__": init_collection(init_users)
}, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }, { 'username': '******', }] # like in https://github.com/superdesk/Live-Blog/blob/63c713a90b8e464aff62a032cb5d85f6b1220d1d/plugins/livedesk-sync/livedesk/core/impl/chained_sync.py#L303 for document in documents: document['password'] = '******' document['uuid'] = str(uuid4().hex) init_users = Init('users', documents) if __name__ == "__main__": init_collection(init_users)
""" ## Core configuration Configuration parameters are stored into the `core_config` collection. Configuration is grouped in documents in order to be possibly overwritten by user settings. Every configuration document has a property named `type`. There should be a single document for every given `type` value. Generally, when one of the configuration keys is missing, the core will use internal defaults. """ from main import Init, init_collection init_core_config = Init("core_config", [{ "type": "sms", "set" : { # session duration in hours "sms_session_duration": 24, # whether to send an automatic reply or not "sms_reply_send": True, # content of the automatic reply "sms_reply_message": "Thank you for your report. Let us know more about it by telling us: 1) Your name 2) Your location. A reporter may contact you directly." } }]) if __name__ == "__main__": init_collection(init_core_config)