def init(self, line): args = parse_argstring(self.init, line) new_state = args.type if new_state == "basic": initmodule.basic_init() if not self.init_state: self.init_state = INIT_STATES[new_state] else: initmodule.full_init() self.init_state = INIT_STATES[new_state]
def init(self, line): args = parse_argstring(self.init, line) new_state = args.state if new_state == "basic": initmodule.basic_init(**INIT_ARGS) elif new_state == "full": # drop reassignment warnings because we want to reassign node classes when plugins are loaded later, for example warnings.filterwarnings("ignore", "Reassigning polymorphic.*") initmodule.full_init(**INIT_ARGS) else: print("current init state is: " + initmodule.get_current_init_state())
import warnings from sqlalchemy import sql from sqlalchemy.orm.exc import NoResultFound import humanize sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import core.init as initmodule import core.config as config import filecmp import magic from utils.compat import * INIT_ARGS = dict(prefer_config_filename="mediatumipython.cfg") initmodule.basic_init(**INIT_ARGS) initmodule.register_workflow() import core.database.postgres.connector # log settings # # set this to INFO for SQL statement echo, DEBUG for even more info from SQLAlchemy SQLALCHEMY_LOGGING = logging.WARN SQL_LOGGING = logging.WARN core.database.postgres.connector.DEBUG_SHOW_TRACE = False core.database.postgres.connector.DEBUG = True # / log settings #
(at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ import sys sys.path += ["../", "."] import time from core.init import basic_init basic_init() import core.tree as tree from core.stats import buildStat from core.db import database """ if parameter is given it will be used as period, format: %Y-%m if not given, current month will be used as period """ db = database.getConnection() args = sys.argv period = time.strftime("%Y-%m") fname = None
""" from collections import OrderedDict from functools import partial import logging import os import sys import tempfile import warnings import pyaml import sqlalchemy from sqlalchemy_continuum import remove_versioning sys.path.append(".") from core import init init.basic_init(prefer_config_filename="manage.cfg") from core.database.postgres import db_metadata, mediatumfunc from core.database.postgres.alchemyext import exec_sqlfunc, disable_triggers, enable_triggers import configargparse logg = logging.getLogger("manage.py") from utils.log import TraceLogger TraceLogger.trace_level = logging.ERROR from core.database.init import init_database_values from core import db, Node import utils.search import utils.iplist from utils.postgres import truncate_tables, run_single_sql, vacuum_tables, vacuum_full_tables, vacuum_analyze_tables
import configargparse from functools import partial import logging import os.path import subprocess import sys import tempfile sys.path.append(".") from sqlalchemy_continuum import remove_versioning from core import init, plugins from collections import OrderedDict from utils.postgres import vacuum_analyze_tables init.basic_init(prefer_config_filename="mysql_migrate.cfg") plugins.init_plugins() import core.database.postgres from core.database.postgres import db_metadata from core.database.postgres.alchemyext import disable_triggers, enable_triggers, exec_sqlfunc from core.database.postgres.connector import read_and_prepare_sql core.database.postgres.SLOW_QUERY_SECONDS = 1000 logging.getLogger("migration.acl_migration").trace_level = logging.ERROR logging.getLogger("core.database.postgres").trace_level = logging.ERROR logg = logging.getLogger("mysql_migrate.py") from core import db
(at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see <http://www.gnu.org/licenses/>. """ import sys sys.path += ["../", "."] import time from core.init import basic_init basic_init(prefer_config_filename="stats.log") from core.stats import buildStatAll from core import init, db, Node from core import config from contenttypes import Collections, Collection import os, re, argparse, tempfile from itertools import imap, ifilter, repeat import operator """ if parameter is given it will be used as period, format: %Y-%m if not given, current month will be used as period """
# -*- coding: utf-8 -*- ''' Created on 06.08.2013 @author: stenzel ''' from __future__ import division, absolute_import import os.path import logging logging.basicConfig(level=logging.DEBUG) from mock import MagicMock import pytest from core.init import basic_init basic_init() from metadata import url BASEDIR = os.path.join(os.path.dirname(__file__), "test_data") @pytest.fixture def m(): return url.m_url() Field = MagicMock(name="field") @pytest.fixture def field(): field = Field() field.getValues.return_value = "\r\n"
import warnings from sqlalchemy import sql from sqlalchemy.orm.exc import NoResultFound import humanize sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) import core.init as initmodule import core.config as config import filecmp import magic from utils.compat import * INIT_ARGS = dict(prefer_config_filename="mediatumipython.cfg") initmodule.basic_init(**INIT_ARGS) initmodule.register_workflow() import core.database.postgres.connector # log settings # # set this to INFO for SQL statement echo, DEBUG for even more info from SQLAlchemy SQLALCHEMY_LOGGING = logging.WARN SQL_LOGGING = logging.WARN core.database.postgres.connector.DEBUG_SHOW_TRACE = False core.database.postgres.connector.DEBUG = True # / log settings # from core.database.postgres.node import t_noderelation
import sqlalchemy.orm # this is the Alembic Config object, which provides # access to the values within the .ini file in use. config = context.config sys.path.append(".") # Don't run DB initialization when we are running alembic commands from within the mediaTUM process. if not config.attributes.get("running_in_mediatum"): # Interpret the config file for Python logging. # This line sets up loggers basically. fileConfig(config.config_file_name) from core import init init.basic_init() sqlalchemy.orm.configure_mappers() from core import db from core.database.postgres import DB_SCHEMA_NAME # other values from the config, defined by the needs of env.py, # can be acquired: # my_important_option = config.get_main_option("my_important_option") # ... etc. def include_object(object, name, type_, reflected, compare_to): if type_ == "table": return object.schema == DB_SCHEMA_NAME
from collections import OrderedDict from functools import partial import logging import os import sys import tempfile import warnings import pyaml import sqlalchemy from sqlalchemy_continuum import remove_versioning sys.path.append(".") from core import init init.basic_init(prefer_config_filename="manage.cfg") from core.database.postgres import db_metadata, mediatumfunc from core.database.postgres.alchemyext import exec_sqlfunc, disable_triggers, enable_triggers import configargparse logg = logging.getLogger("manage.py") from utils.log import TraceLogger TraceLogger.trace_level = logging.ERROR from core.database.init import init_database_values from core import db, Node import utils.search import utils.iplist