Exemple #1
0
        new_value = raw_input(prmt)
        try:
            new_value = ast.literal_eval(new_value)
        except (SyntaxError, ValueError):
            pass

        print('>>>', key, '=', pformat(new_value))
        print(key, '=', pformat(new_value), file=new_config)

    with current_app.open_instance_resource(filename, 'w') as config_file:
        config_file.write(new_config.getvalue())


config_create = Manager(usage="Creates variables in config file.")
manager.add_command("create", config_create)


@config_create.command
@change_command_name
def secret_key(key=None, filename='invenio.cfg', silent=True):
    """Generate and append SECRET_KEY to invenio.cfg.

    Useful for the installation process.
    """
    print(">>> Going to generate random SECRET_KEY...")
    try:
        d = get_instance_config_object(filename)
    except Exception as e:
        print("ERROR: ", str(e), file=sys.stderr)
        sys.exit(1)
Exemple #2
0
    """
    from invenio.modules.upgrader.commands import cmd_upgrade
    cmd_upgrade()


@manager.command
def check():
    """
    Command for checking upgrades
    """
    from invenio.modules.upgrader.commands import cmd_upgrade_check
    cmd_upgrade_check()


show = Manager(usage="Display pending or applied upgrades.")
manager.add_command("show", show)


@show.command
def pending():
    """
    Command for showing upgrades ready to be applied
    """
    from invenio.modules.upgrader.commands import cmd_upgrade_show_pending
    cmd_upgrade_show_pending()


@show.command
def applied():
    """
    Command for showing all upgrades already applied.
Exemple #3
0
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.

"""Perform BibRecord operations."""

from invenio.ext.script import Manager

manager = Manager(usage=__doc__)

# Define sub-manager
bibrecord_cache = Manager(usage="Manipulates BibRecord cache.")

# Add sub-manager
manager.add_command("cache", bibrecord_cache)


@bibrecord_cache.command
def reset(split_by=1000):
    """Reset bibrecord structure cache."""
    from invenio.modules.formatter.models import Bibfmt
    from invenio.base.scripts.cache import reset_rec_cache
    from invenio.legacy.search_engine import get_record
    from invenio.ext.sqlalchemy import db
    from invenio.utils.serializers import serialize_via_marshal

    def get_recstruct_record(recid):
        value = serialize_via_marshal(get_record(recid))
        b = Bibfmt(id_bibrec=recid, format='recstruct',
                   last_updated=db.func.now(), value=value)
Exemple #4
0
    """
    from invenio_upgrader.commands import cmd_upgrade
    cmd_upgrade()


@manager.command
def check():
    """
    Command for checking upgrades
    """
    from invenio_upgrader.commands import cmd_upgrade_check
    cmd_upgrade_check()


show = Manager(usage="Display pending or applied upgrades.")
manager.add_command("show", show)


@show.command
def pending():
    """
    Command for showing upgrades ready to be applied
    """
    from invenio_upgrader.commands import cmd_upgrade_show_pending
    cmd_upgrade_show_pending()


@show.command
def applied():
    """
    Command for showing all upgrades already applied.
Exemple #5
0
        new_value = raw_input(prmt)
        try:
            new_value = ast.literal_eval(new_value)
        except (SyntaxError, ValueError):
            pass

        print('>>>', key, '=', pformat(new_value))
        print(key, '=', pformat(new_value), file=new_config)

    with current_app.open_instance_resource(filename, 'w') as config_file:
        config_file.write(new_config.getvalue())


config_create = Manager(usage="Creates variables in config file.")
manager.add_command("create", config_create)


@config_create.command
@change_command_name
def secret_key(key=None, filename='invenio.cfg', silent=True):
    """Generate and append SECRET_KEY to invenio.cfg.

    Useful for the installation process.
    """
    print(">>> Going to generate random SECRET_KEY...")
    try:
        d = get_instance_config_object(filename)
    except Exception as e:
        print("ERROR: ", str(e), file=sys.stderr)
        sys.exit(1)
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Invenio; if not, write to the Free Software Foundation, Inc.,
# 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
"""Perform BibRecord operations."""

from invenio.ext.script import Manager

manager = Manager(usage=__doc__)

# Define sub-manager
bibrecord_cache = Manager(usage="Manipulates BibRecord cache.")

# Add sub-manager
manager.add_command("cache", bibrecord_cache)


@bibrecord_cache.command
def reset(split_by=1000):
    """Reset bibrecord structure cache."""
    from invenio.modules.formatter.models import Bibfmt
    from invenio.base.scripts.cache import reset_rec_cache
    from invenio.legacy.search_engine import get_record
    from invenio.ext.sqlalchemy import db
    from invenio.utils.serializers import serialize_via_marshal

    def get_recstruct_record(recid):
        value = serialize_via_marshal(get_record(recid))
        b = Bibfmt(id_bibrec=recid,
                   format='recstruct',