Пример #1
0
 def create(self, docs, **kwargs):
     for doc in docs:
         if doc.get('remove_first'):
             drop_elastic(superdesk.app)
             drop_mongo(superdesk.app)
         user = get_resource_service('users').find_one(username=get_default_user()['username'], req=None)
         if not user:
             get_resource_service('users').post([get_default_user()])
         prepopulate_data(doc.get('profile') + '.json', get_default_user())
     return ['OK']
Пример #2
0
 def create(self, docs, **kwargs):
     for doc in docs:
         if doc.get("remove_first"):
             drop_elastic(superdesk.app)
             drop_mongo(superdesk.app)
         user = get_resource_service("users").find_one(username=get_default_user()["username"], req=None)
         if not user:
             get_resource_service("users").post([get_default_user()])
         prepopulate_data(doc.get("profile") + ".json", get_default_user())
     return ["OK"]
Пример #3
0
 def create(self, docs, **kwargs):
     for doc in docs:
         if doc.get('remove_first'):
             drop_elastic(superdesk.app)
             drop_mongo(superdesk.app)
         user = get_resource_service('users').find_one(
             username=get_default_user()['username'], req=None)
         if not user:
             get_resource_service('users').post([get_default_user()])
         prepopulate_data(doc.get('profile') + '.json', get_default_user())
     return ['OK']
Пример #4
0
    def create(self, docs, **kwargs):
        for doc in docs:
            if doc.get('remove_first'):
                drop_mongo(superdesk.app)
                drop_elastic(superdesk.app)
                app.data.init_elastic(superdesk.app)

            user = get_resource_service('users').find_one(username=get_default_user()['username'], req=None)
            if not user:
                get_resource_service('users').post([get_default_user()])
            prepopulate_data(doc.get('profile') + '.json', get_default_user())
            if app.config.get('SUPERDESK_TESTING'):
                for provider in ['paimg', 'aapmm']:
                    if provider not in allowed_search_providers:
                        register_search_provider(provider, provider)
        return ['OK']
Пример #5
0
    def create(self, docs, **kwargs):
        for doc in docs:
            if doc.get('remove_first'):
                drop_elastic(superdesk.app)
                drop_mongo(superdesk.app)
                # call the create index with settings
                superdesk.app.data.elastic.create_index(
                    superdesk.app.config['ELASTICSEARCH_INDEX'],
                    superdesk.app.config['ELASTICSEARCH_SETTINGS']
                )
                superdesk.app.data.elastic.put_mapping(superdesk.app)

            user = get_resource_service('users').find_one(username=get_default_user()['username'], req=None)
            if not user:
                get_resource_service('users').post([get_default_user()])
            prepopulate_data(doc.get('profile') + '.json', get_default_user())
        return ['OK']
Пример #6
0
    def create(self, docs, **kwargs):
        for doc in docs:
            if doc.get('remove_first'):
                drop_elastic(superdesk.app)
                drop_mongo(superdesk.app)
                # call the create index with settings
                superdesk.app.data.elastic.create_index(
                    superdesk.app.config['ELASTICSEARCH_INDEX'],
                    superdesk.app.config['ELASTICSEARCH_SETTINGS'])
                superdesk.app.data.elastic.put_mapping(superdesk.app)

            user = get_resource_service('users').find_one(
                username=get_default_user()['username'], req=None)
            if not user:
                get_resource_service('users').post([get_default_user()])
            prepopulate_data(doc.get('profile') + '.json', get_default_user())
        return ['OK']