def wash_journal_name(ln, journal_name, guess=True):
    """
    Washes the journal name parameter. In case of non-empty string,
    returns it, otherwise redirects to a guessing function.

    If 'guess' is True the function tries to fix the capitalization of
    the journal name.
    """
    if guess or not journal_name:
        return guess_journal_name(ln, journal_name)
    else:
        return journal_name
Пример #2
0
def perform_administrate(ln=CFG_SITE_LANG, journal_name=None, as_editor=True):
    """
    Administration of a journal

    Show the current and next issues/publications, and display links
    to more specific administrative pages.

    Parameters:
        journal_name  -  the journal to be administrated
                  ln  -  language
        with_editor_rights  -  True if can edit configuration. Read-only mode otherwise
    """
    if journal_name is None:
        try:
            journal_name = guess_journal_name(ln)
        except InvenioWebJournalNoJournalOnServerError, e:
            return e.user_box()
Пример #3
0
def perform_administrate(ln=CFG_SITE_LANG, journal_name=None, as_editor=True):
    """
    Administration of a journal

    Show the current and next issues/publications, and display links
    to more specific administrative pages.

    Parameters:
        journal_name  -  the journal to be administrated
                  ln  -  language
        with_editor_rights  -  True if can edit configuration. Read-only mode otherwise
    """
    if journal_name is None:
        try:
            journal_name = guess_journal_name(ln)
        except InvenioWebJournalNoJournalOnServerError, e:
            return e.user_box()
 def test_guess_journal_name(self):
     """webjournal - tries to take a guess what a user was looking for on
     the server if not providing a name for the journal"""
     name = wju.guess_journal_name('en', journal_name=None)
     self.assertEqual(name, 'AtlantisTimes')
 def test_guess_journal_name(self):
     """webjournal - tries to take a guess what a user was looking for on
     the server if not providing a name for the journal"""
     name = wju.guess_journal_name('en', journal_name=None)
     self.assertEqual(name, 'AtlantisTimes' )