예제 #1
0
def generate_error_page(req,
                        admin_was_alerted=True,
                        page_already_started=False):
    """
    Returns an iterable with the error page to be sent to the user browser.
    """
    from invenio.legacy.webpage import page
    from invenio.legacy import template
    webstyle_templates = template.load('webstyle')
    ln = req.form.get('ln', CFG_SITE_LANG)
    if page_already_started:
        return [
            webstyle_templates.tmpl_error_page(
                status=req.get_wsgi_status(),
                ln=ln,
                admin_was_alerted=admin_was_alerted)
        ]
    else:
        return [
            page(title=req.get_wsgi_status(),
                 body=webstyle_templates.tmpl_error_page(
                     status=req.get_wsgi_status(),
                     ln=ln,
                     admin_was_alerted=admin_was_alerted),
                 language=ln,
                 req=req)
        ]
예제 #2
0
def generate_error_page(req, admin_was_alerted=True, page_already_started=False):
    """
    Returns an iterable with the error page to be sent to the user browser.
    """
    from invenio.legacy.webpage import page
    from invenio.legacy import template
    webstyle_templates = template.load('webstyle')
    ln = req.form.get('ln', CFG_SITE_LANG)
    if page_already_started:
        return [webstyle_templates.tmpl_error_page(status=req.get_wsgi_status(), ln=ln, admin_was_alerted=admin_was_alerted)]
    else:
        return [page(title=req.get_wsgi_status(), body=webstyle_templates.tmpl_error_page(status=req.get_wsgi_status(), ln=ln, admin_was_alerted=admin_was_alerted), language=ln, req=req)]
예제 #3
0
    def display_answer_helper(self, labels_and_urls, ln=CFG_SITE_LANG):
        """Display HTML to return an answer as HTML.

        Use this function to process your list of response and return
        an HTML-formatted string in your L{answer} function.

        :param labels_and_urls: list of answers in the form (label, URL)
        :param ln: the language in which is used to answer
        :return: HTML-formatted string
        """
        websearch_templates = template.load("websearch")
        label = self.get_label(ln=ln)
        return websearch_templates.tmpl_print_service_list_links(label, labels_and_urls, ln=ln)
예제 #4
0
    def display_answer_helper(self, labels_and_urls, ln=CFG_SITE_LANG):
        """Display HTML to return an answer as HTML.

        Use this function to process your list of response and return
        an HTML-formatted string in your L{answer} function.

        :param labels_and_urls: list of answers in the form (label, URL)
        :param ln: the language in which is used to answer
        :return: HTML-formatted string
        """
        websearch_templates = template.load('websearch')
        label = self.get_label(ln=ln)
        return websearch_templates.tmpl_print_service_list_links(
            label, labels_and_urls, ln=ln)
예제 #5
0
from invenio.base.i18n import gettext_set_language
from invenio.legacy.bibdocfile.api import BibRecDocs
from invenio.legacy.search_engine import get_record
from invenio.legacy.template import load
from invenio.ext.legacy.handler import wash_urlargd
import invenio.modules.access.engine as acce
from invenio.legacy.bibsched import bibtask
from invenio.legacy.bibupload.engine import open_marc_file, xml_marc_to_records
from invenio.legacy import bibrecord, dbquery
from invenio.legacy.bibclassify.engine import get_tmp_file, build_marc, _parse_marc_code
from invenio.legacy.bibclassify import (config as bconfig, ontology_reader as
                                        bor)

log = bconfig.get_logger("bibclassify.webinterface")

template = load('bibclassify')


def main_page(req, recid, tabs, ln, template):
    """Generate the main page for the keyword tab

    Url style : http://url/record/[recid]/keywords
    :param req: request object
    :param recid: int docid
    :param tabs: list of tab links
    :param ln: language id
    :param template: template object
    :return: nothing, writes using req object
    """
    form = req.form
    argd = wash_urlargd(
예제 #6
0
from invenio.legacy.bibsched.bibtask import write_message

# imports used in FieldExporter class
import invenio.legacy.search_engine
from invenio.legacy import bibrecord
from invenio.legacy.bibdocfile import api as bibdocfile
import os

# imports used in perform_request_... methods
from invenio.config import CFG_SITE_LANG
from . import fieldexporter_dblayer

from invenio.legacy import template

fieldexporter_templates = template.load('bibexport')
from invenio.base.i18n import gettext_set_language


def run_export_method(jobname):
    """Main function, reading params and running the task."""
    write_message("bibexport_fieldexporter: job %s started." % jobname)

    job = fieldexporter_dblayer.get_job_by_name(jobname)
    job_result = _run_job(job)

    if job_result.STATUS_CODE_OK != job_result.get_status():
        error_message = job_result.get_status_message()
        write_message("Error during %s execution. Error message: %s" %
                      (jobname, error_message))
예제 #7
0
파일: engine.py 프로젝트: mhellmic/b2share
from invenio.config import CFG_TMPSHAREDDIR, CFG_BIBEDITMULTI_LIMIT_INSTANT_PROCESSING,\
                           CFG_BIBEDITMULTI_LIMIT_DELAYED_PROCESSING,\
                           CFG_BIBEDITMULTI_LIMIT_DELAYED_PROCESSING_TIME
from time import strftime
from invenio.legacy.bibsched.bibtask import task_low_level_submission

from invenio.legacy.webuser import collect_user_info, isUserSuperAdmin

from invenio.legacy.dbquery import run_sql

from invenio.legacy.bibrecord.scripts import xmlmarc2textmarc as xmlmarc2textmarc

from invenio.legacy.bibedit.utils import record_locked_by_queue

from invenio.legacy import template
multiedit_templates = template.load('bibeditmulti')

# base command for subfields
class BaseSubfieldCommand:
    """Base class for commands manipulating subfields"""
    def __init__(self, subfield, value = "", new_value = "", condition = "", condition_exact_match=True , condition_does_not_exist=False, condition_subfield = "", additional_values = None):
        """Initialization."""
        if additional_values is None:
            additional_values = []
        self._subfield = subfield
        self._value = value
        self._additional_values = additional_values
        self._new_value = new_value
        self._condition = condition
        self._condition_subfield = condition_subfield
        self._condition_exact_match = condition_exact_match
예제 #8
0
from cgi import escape
from invenio.base.i18n import gettext_set_language
from invenio.legacy.bibdocfile.api import BibRecDocs
from invenio.legacy.search_engine import get_record
from invenio.legacy.template import load
from invenio.ext.legacy.handler import wash_urlargd
import invenio.modules.access.engine as acce
from invenio.legacy.bibsched import bibtask
from invenio.legacy.bibupload.engine import open_marc_file, xml_marc_to_records
from invenio.legacy import bibrecord, dbquery
from invenio.legacy.bibclassify.engine import get_tmp_file, build_marc, _parse_marc_code
from invenio.legacy.bibclassify import config as bconfig, ontology_reader as bor

log = bconfig.get_logger("bibclassify.webinterface")

template = load("bibclassify")


def main_page(req, recid, tabs, ln, template):
    """Generate the main page for the keyword tab

    Url style : http://url/record/[recid]/keywords
    :param req: request object
    :param recid: int docid
    :param tabs: list of tab links
    :param ln: language id
    :param template: template object
    :return: nothing, writes using req object
    """
    form = req.form
    argd = wash_urlargd(
예제 #9
0
from invenio.base.i18n import gettext_set_language
from invenio.legacy.bibdocfile.api import BibRecDocs
from invenio.legacy.search_engine import get_record
from invenio.legacy.template import load
from invenio.ext.legacy.handler import wash_urlargd
import invenio.modules.access.engine as acce
from invenio.legacy.bibsched import bibtask
from invenio.legacy.bibupload.engine import open_marc_file, xml_marc_to_records
from invenio.legacy import bibrecord, dbquery
from invenio.legacy.bibclassify.engine import get_tmp_file, build_marc, _parse_marc_code
from invenio.legacy.bibclassify import (config as bconfig,
                                        ontology_reader as bor)

log = bconfig.get_logger("bibclassify.webinterface")

template = load('bibclassify')


def main_page(req, recid, tabs, ln, template):
    """Generate the main page for the keyword tab

    Url style : http://url/record/[recid]/keywords
    :param req: request object
    :param recid: int docid
    :param tabs: list of tab links
    :param ln: language id
    :param template: template object
    :return: nothing, writes using req object
    """
    form = req.form
    argd = wash_urlargd(form, {
예제 #10
0
__revision__ = "$Id: search_engine_query_parser.py,v 1.12 2008/06/13 15:35:13 rivanov Exp $"

from invenio.legacy.bibsched.bibtask import write_message

# imports used in FieldExporter class
import invenio.legacy.search_engine
from invenio.legacy import bibrecord
from invenio.legacy.bibdocfile import api as bibdocfile
import os

# imports used in perform_request_... methods
from invenio.config import CFG_SITE_LANG
from . import fieldexporter_dblayer

from invenio.legacy import template
fieldexporter_templates = template.load('bibexport')
from invenio.base.i18n import gettext_set_language

def run_export_method(jobname):
    """Main function, reading params and running the task."""
    write_message("bibexport_fieldexporter: job %s started." % jobname)

    job = fieldexporter_dblayer.get_job_by_name(jobname)
    job_result = _run_job(job)

    if job_result.STATUS_CODE_OK != job_result.get_status():
        error_message = job_result.get_status_message()
        write_message("Error during %s execution. Error message: %s" % (jobname, error_message) )

    write_message("bibexport_fieldexporter: job %s started." % jobname)
예제 #11
0
     CFG_SITE_SECURE_URL, \
     CFG_SITE_URL, \
     CFG_VERSION, \
     CFG_WEBSTYLE_TEMPLATE_SKIN, \
     CFG_INSPIRE_SITE, \
     CFG_WEBLINKBACK_TRACKBACK_ENABLED

from invenio.base.i18n import gettext_set_language, language_list_long, is_language_rtl
from invenio.utils.url import make_canonical_urlargd, create_html_link, \
                             get_canonical_and_alternates_urls
from invenio.utils.date import convert_datecvs_to_datestruct, \
                              convert_datestruct_to_dategui
from invenio.modules.formatter import format_record
from bs4 import BeautifulSoup
from invenio.legacy import template
websearch_templates = template.load('websearch')


class Template:

    def tmpl_navtrailbox_body(self, ln, title, previous_links, separator,
                              prolog, epilog):
        """Bootstrap friendly-Create navigation trail box body

           Parameters:

          - 'ln' *string* - The language to display

          - 'title' *string* - page title;

          - 'previous_links' *string* - the trail content from site title until current page (both ends exclusive)