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.webpage import page
    from invenio 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)
        ]
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.webpage import page
    from invenio 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)]
    def display_answer_helper(self, labels_and_urls, ln=CFG_SITE_LANG):
        """
        Helper function to 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)
    def display_answer_helper(self, labels_and_urls, ln=CFG_SITE_LANG):
        """
        Helper function to 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)
from invenio import search_engine
from invenio import bibrecord
from invenio import bibformat

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.bibtask import task_low_level_submission

from invenio.webuser import collect_user_info, isUserSuperAdmin

from invenio.dbquery import run_sql

from invenio 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_subfield = ""):
        """Initialization."""
        self._subfield = subfield
        self._value = value
        self._new_value = new_value
        self._condition = condition
        self._condition_subfield = condition_subfield
        self._condition_exact_match = condition_exact_match
        self._modifications = 0

    def process_field(self, record, tag, field_number):
from invenio import search_engine
from invenio import bibrecord
from invenio import bibformat

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.bibtask import task_low_level_submission

from invenio.webuser import collect_user_info, isUserSuperAdmin

from invenio.dbquery import run_sql

from invenio 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_subfield=""):
        """Initialization."""
        self._subfield = subfield
        self._value = value
    CFG_SITE_SUPPORT_EMAIL,
    CFG_SITE_SECURE_URL,
    CFG_SITE_URL,
    CFG_VERSION,
    CFG_WEBSTYLE_INSPECT_TEMPLATES,
    CFG_WEBSTYLE_TEMPLATE_SKIN,
    CFG_INSPIRE_SITE,
)

from invenio.messages import gettext_set_language, language_list_long, is_language_rtl
from invenio.urlutils import make_canonical_urlargd, create_html_link
from invenio.dateutils import convert_datecvs_to_datestruct, convert_datestruct_to_dategui
from invenio.bibformat import format_record
from invenio import template

websearch_templates = template.load("websearch")


class Template:
    def tmpl_navtrailbox_body(self, ln, title, previous_links, separator, prolog, epilog):
        """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)

          - 'prolog' *string* - HTML code to prefix the navtrail item with
     CFG_SITE_LANG, \
     CFG_SITE_NAME, \
     CFG_SITE_NAME_INTL, \
     CFG_SITE_SUPPORT_EMAIL, \
     CFG_SITE_SECURE_URL, \
     CFG_SITE_URL, \
     CFG_VERSION, \
     CFG_WEBSTYLE_INSPECT_TEMPLATES, \
     CFG_WEBSTYLE_TEMPLATE_SKIN
from invenio.messages import gettext_set_language, language_list_long
from invenio.urlutils import make_canonical_urlargd, create_html_link
from invenio.dateutils import convert_datecvs_to_datestruct, \
                              convert_datestruct_to_dategui
from invenio.bibformat import format_record
from invenio import template
websearch_templates = template.load('websearch')


class Template:
    def tmpl_navtrailbox_body(self, ln, title, previous_links, separator,
                              prolog, epilog):
        """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)
from invenio.template import load
from invenio.webinterface_handler import wash_urlargd
from invenio.webuser import collect_user_info
from invenio import access_control_engine as acce
from invenio import dbquery
from invenio import bibtask
from invenio import bibrecord

import bibclassify_config as bconfig
import bibclassify_text_extractor
import bibclassify_engine
import bibclassify_ontology_reader as bor

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

template = load('bibclassify')


def main_page(req, recid, tabs, ln, template):
    """Generates the main page for the keyword tab - http://url/record/[recid]/keywords
    @var req: request object
    @var recid: int docid
    @var tabs: list of tab links
    @var ln: language id
    @var template: template object
    @return: nothing, writes using req object
    """

    form = req.form
    argd = wash_urlargd(
        form, {
Exemple #10
0
from invenio.webstat_engine import get_keyevent_snapshot_sessions

# Imports handling custom events
from invenio.webstat_engine import get_customevent_table
from invenio.webstat_engine import get_customevent_trend
from invenio.webstat_engine import get_customevent_dump

# Imports for handling outputting
from invenio.webstat_engine import create_graph_trend
from invenio.webstat_engine import create_graph_dump

# Imports for handling exports
from invenio.webstat_engine import export_to_python
from invenio.webstat_engine import export_to_csv

TEMPLATES = template.load('webstat')

# Constants
WEBSTAT_CACHE_INTERVAL = 600 # Seconds, cache_* functions not affected by this.
                             # Also not taking into account if BibSched has webstatadmin process.
WEBSTAT_RAWDATA_DIRECTORY = CFG_TMPDIR + "/"
WEBSTAT_GRAPH_DIRECTORY = CFG_WEBDIR + "/img/"

TYPE_REPOSITORY = [ ('gnuplot', 'Image - Gnuplot'),
                    ('asciiart', 'Image - ASCII art'),
                    ('asciidump', 'Image - ASCII dump'),
                    ('python', 'Data - Python code', export_to_python),
                    ('csv', 'Data - CSV', export_to_csv) ]

# Key event repository, add an entry here to support new key measures.
KEYEVENT_REPOSITORY = { 'collection population':
     CFG_SITE_LANG, \
     CFG_SITE_NAME, \
     CFG_SITE_NAME_INTL, \
     CFG_SITE_SUPPORT_EMAIL, \
     CFG_SITE_SECURE_URL, \
     CFG_SITE_URL, \
     CFG_VERSION, \
     CFG_WEBSTYLE_INSPECT_TEMPLATES, \
     CFG_WEBSTYLE_TEMPLATE_SKIN
from invenio.messages import gettext_set_language, language_list_long
from invenio.urlutils import make_canonical_urlargd, create_html_link
from invenio.dateutils import convert_datecvs_to_datestruct, \
                              convert_datestruct_to_dategui
from invenio.bibformat import format_record
from invenio import template
websearch_templates = template.load('websearch')

class Template:

    def tmpl_navtrailbox_body(self, ln, title, previous_links,
                              separator, prolog, epilog):
        """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)
from invenio.template import load
from invenio.webinterface_handler import wash_urlargd
from invenio.webuser import collect_user_info
from invenio import access_control_engine as acce
from invenio import dbquery
from invenio import bibtask
from invenio import bibrecord

import bibclassify_config as bconfig
import bibclassify_text_extractor
import bibclassify_engine
import bibclassify_ontology_reader as bor

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

template = load('bibclassify')



def main_page(req, recid, tabs, ln, template):
    """Generates the main page for the keyword tab - http://url/record/[recid]/keywords
    @var req: request object
    @var recid: int docid
    @var tabs: list of tab links
    @var ln: language id
    @var template: template object
    @return: nothing, writes using req object
    """

    form = req.form
    argd = wash_urlargd(form, {
__revision__ = "$Id: search_engine_query_parser.py,v 1.12 2008/06/13 15:35:13 rivanov Exp $"

from invenio.bibtask import write_message

# imports used in FieldExporter class
from invenio import search_engine
from invenio import bibrecord
from invenio import bibdocfile
import os

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

from invenio import template
fieldexporter_templates = template.load('bibexport_method_fieldexporter')
from invenio.messages 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)
from invenio.template import load
from invenio.webinterface_handler import wash_urlargd
from invenio.webuser import collect_user_info
from invenio import access_control_engine as acce
from invenio import dbquery
from invenio import bibtask
from invenio import bibrecord

import bibclassify_config as bconfig
import bibclassify_text_extractor
import bibclassify_engine
import bibclassify_ontology_reader as bor

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

template = load("bibclassify")


def main_page(req, recid, tabs, ln, template):
    """Generates the main page for the keyword tab - http://url/record/[recid]/keywords
    @var req: request object
    @var recid: int docid
    @var tabs: list of tab links
    @var ln: language id
    @var template: template object
    @return: nothing, writes using req object
    """

    form = req.form
    argd = wash_urlargd(
        form,
Exemple #15
0
# Imports for handling outputting
from invenio.webstat_engine import create_graph_trend
from invenio.webstat_engine import create_graph_dump

# Imports for handling exports
from invenio.webstat_engine import export_to_python
from invenio.webstat_engine import export_to_csv

if sys.hexversion < 0x2040000:
    # pylint: disable-msg=W0622
    from sets import Set as set

    # pylint: enable-msg=W0622


TEMPLATES = template.load("webstat")

# Constants
WEBSTAT_CACHE_INTERVAL = 600  # Seconds, cache_* functions not affected by this.
# Also not taking into account if BibSched has webstatadmin process.
WEBSTAT_RAWDATA_DIRECTORY = CFG_TMPDIR + "/"
WEBSTAT_GRAPH_DIRECTORY = CFG_WEBDIR + "/img/"

TYPE_REPOSITORY = [
    ("gnuplot", "Image - Gnuplot"),
    ("asciiart", "Image - ASCII art"),
    ("asciidump", "Image - ASCII dump"),
    ("python", "Data - Python code", export_to_python),
    ("csv", "Data - CSV", export_to_csv),
]
Exemple #16
0
from invenio.webstat_engine import get_keyevent_snapshot_sessions

# Imports handling custom events
from invenio.webstat_engine import get_customevent_table
from invenio.webstat_engine import get_customevent_trend
from invenio.webstat_engine import get_customevent_dump

# Imports for handling outputting
from invenio.webstat_engine import create_graph_trend
from invenio.webstat_engine import create_graph_dump

# Imports for handling exports
from invenio.webstat_engine import export_to_python
from invenio.webstat_engine import export_to_csv

TEMPLATES = template.load('webstat')

# Constants
WEBSTAT_CACHE_INTERVAL = 600  # Seconds, cache_* functions not affected by this.
# Also not taking into account if BibSched has webstatadmin process.
WEBSTAT_RAWDATA_DIRECTORY = CFG_TMPDIR + "/"
WEBSTAT_GRAPH_DIRECTORY = CFG_WEBDIR + "/img/"

TYPE_REPOSITORY = [('gnuplot', 'Image - Gnuplot'),
                   ('asciiart', 'Image - ASCII art'),
                   ('asciidump', 'Image - ASCII dump'),
                   ('python', 'Data - Python code', export_to_python),
                   ('csv', 'Data - CSV', export_to_csv)]

# Key event repository, add an entry here to support new key measures.
KEYEVENT_REPOSITORY = {