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
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
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 as e: return e.user_box() if not can_read_xml_config(journal_name): return '<span style="color:#f00">Configuration could not be read. Please check that %s/webjournal/%s/%s-config.xml exists and can be read by the server.</span><br/>' % (CFG_ETCDIR, journal_name, journal_name) current_issue = get_current_issue(ln, journal_name) current_publication = get_issue_number_display(current_issue, journal_name, ln) issue_list = get_grouped_issues(journal_name, current_issue) next_issue_number = get_next_journal_issues(issue_list[-1], journal_name, 1) return wjt.tmpl_admin_administrate(journal_name, current_issue, current_publication, issue_list, next_issue_number[0], ln, as_editor=as_editor)
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 as e: return e.user_box() if not can_read_xml_config(journal_name): return '<span style="color:#f00">Configuration could not be read. Please check that %s/webjournal/%s/%s-config.xml exists and can be read by the server.</span><br/>' % (CFG_ETCDIR, journal_name, journal_name) current_issue = get_current_issue(ln, journal_name) current_publication = get_issue_number_display(current_issue, journal_name, ln) issue_list = get_grouped_issues(journal_name, current_issue) next_issue_number = get_next_journal_issues(issue_list[-1], journal_name, 1) return wjt.tmpl_admin_administrate(journal_name, current_issue, current_publication, issue_list, next_issue_number[0], ln, as_editor=as_editor)