def article(self, req, form):
     """
     Article page.
     Washes all the parameters and stores them in journal_defaults dict
     for subsequent format_elements.
     Passes on to logic function and eventually returns HTML.
     """
     argd = wash_urlargd(form, {'name': (str, ""),
                                 'issue': (str, ""),
                                 'category': (str, ""),
                                 'number': (str, ""),
                                 'ln': (str, ""),
                                }
                         )
     try:
         ln = wash_journal_language(argd['ln'])
         journal_name = wash_journal_name(ln, argd['name'])
         issue = wash_issue_number(ln, journal_name,
                                   argd['issue'])
         issue_year = issue.split('/')[1]
         issue_number = issue.split('/')[0]
         category = wash_category(ln, argd['category'], journal_name, issue_number)
         number = wash_article_number(ln, argd['number'], journal_name)
         recid = get_recid_from_legacy_number(issue, category, int(number))
     except InvenioWebJournalNoJournalOnServerError, e:
         register_exception(req=req)
         return e.user_box(req)
 def article(self, req, form):
     """
     Article page.
     Washes all the parameters and stores them in journal_defaults dict
     for subsequent format_elements.
     Passes on to logic function and eventually returns HTML.
     """
     argd = wash_urlargd(form, {'name': (str, ""),
                                 'issue': (str, ""),
                                 'category': (str, ""),
                                 'number': (str, ""),
                                 'ln': (str, ""),
                                }
                         )
     try:
         ln = wash_journal_language(argd['ln'])
         journal_name = wash_journal_name(ln, argd['name'])
         issue = wash_issue_number(ln, journal_name,
                                   argd['issue'])
         issue_year = issue.split('/')[1]
         issue_number = issue.split('/')[0]
         category = wash_category(ln, argd['category'], journal_name, issue_number)
         number = wash_article_number(ln, argd['number'], journal_name)
         recid = get_recid_from_legacy_number(issue, category, int(number))
     except InvenioWebJournalNoJournalOnServerError, e:
         register_exception(req=req)
         return e.user_box(req)
 def index(self, req, form):
     """
     Index page.
     Washes all the parameters and stores them in journal_defaults dict
     for subsequent format_elements.
     Passes on to logic function and eventually returns HTML.
     """
     argd = wash_urlargd(form, {"name": (str, ""), "issue": (str, ""), "category": (str, ""), "ln": (str, "")})
     try:
         ln = wash_journal_language(argd["ln"])
         journal_name = wash_journal_name(ln, argd["name"])
         issue_number = wash_issue_number(ln, journal_name, argd["issue"])
         category = wash_category(ln, argd["category"], journal_name, issue_number)
     except InvenioWebJournalNoJournalOnServerError, e:
         register_exception(req=req)
         return e.user_box(req)
 def index(self, req, form):
     """
     Index page.
     Washes all the parameters and stores them in journal_defaults dict
     for subsequent format_elements.
     Passes on to logic function and eventually returns HTML.
     """
     argd = wash_urlargd(form, {'name': (str, ""),
                                 'issue': (str, ""),
                                 'category': (str, ""),
                                 'ln': (str, "")}
                         )
     try:
         ln = wash_journal_language(argd['ln'])
         journal_name = wash_journal_name(ln, argd['name'])
         issue_number = wash_issue_number(ln, journal_name,
                                          argd['issue'])
         category = wash_category(ln, argd['category'], journal_name, issue_number)
     except InvenioWebJournalNoJournalOnServerError, e:
         register_exception(req=req)
         return e.user_box(req)
            except InvenioWebJournalNoJournalOnServerError, e:
                register_exception(req=req)
                return e.user_box(req)
            except InvenioWebJournalNoNameError, e:
                return e.user_box(req)
            try:
                issue = wash_issue_number(ln, journal_name, argd["issue"])
                issue_year = issue.split("/")[1]
                issue_number = issue.split("/")[0]
            except InvenioWebJournalIssueNumberBadlyFormedError, e:
                register_exception(req=req)
                return e.user_box(req)
            except InvenioWebJournalJournalIdNotFoundDBError, e:
                register_exception(req=req)
                return e.user_box(req)
            category = wash_category(ln, argd["category"], journal_name, issue).replace(" ", "%20")
            redirect_to_url(
                req,
                CFG_SITE_URL
                + "/journal/%(name)s/%(issue_year)s/%(issue_number)s/%(category)s/?ln=%(ln)s"
                % {
                    "name": journal_name,
                    "issue_year": issue_year,
                    "issue_number": issue_number,
                    "category": category,
                    "ln": ln,
                },
            )

        ## End support for legacy urls
                register_exception(req=req)
                return e.user_box(req)
            except InvenioWebJournalNoNameError, e:
                return e.user_box(req)
            try:
                issue = wash_issue_number(ln, journal_name,
                                          argd['issue'])
                issue_year = issue.split('/')[1]
                issue_number = issue.split('/')[0]
            except InvenioWebJournalIssueNumberBadlyFormedError, e:
                register_exception(req=req)
                return e.user_box(req)
            except InvenioWebJournalJournalIdNotFoundDBError, e:
                register_exception(req=req)
                return e.user_box(req)
            category = wash_category(ln, argd['category'], journal_name, issue).replace(' ', '%20')
            redirect_to_url(req, CFG_SITE_URL + '/journal/%(name)s/%(issue_year)s/%(issue_number)s/%(category)s/?ln=%(ln)s' % \
                            {'name': journal_name,
                             'issue_year': issue_year,
                             'issue_number': issue_number,
                             'category': category,
                             'ln': ln})

        ## End support for legacy urls

        # Check that given journal name exists and that it is written
        # with correct casing.
        redirect_p = False
        try:
            washed_journal_name = wash_journal_name(argd['ln'], journal_name)
            if washed_journal_name != journal_name:
                register_exception(req=req)
                return e.user_box(req)
            except InvenioWebJournalNoNameError, e:
                return e.user_box(req)
            try:
                issue = wash_issue_number(ln, journal_name,
                                          argd['issue'])
                issue_year = issue.split('/')[1]
                issue_number = issue.split('/')[0]
            except InvenioWebJournalIssueNumberBadlyFormedError, e:
                register_exception(req=req)
                return e.user_box(req)
            except InvenioWebJournalJournalIdNotFoundDBError, e:
                register_exception(req=req)
                return e.user_box(req)
            category = wash_category(ln, argd['category'], journal_name, issue).replace(' ', '%20')
            redirect_to_url(req, CFG_SITE_URL + '/journal/%(name)s/%(issue_year)s/%(issue_number)s/%(category)s/?ln=%(ln)s' % \
                            {'name': journal_name,
                             'issue_year': issue_year,
                             'issue_number': issue_number,
                             'category': category,
                             'ln': ln})

        ## End support for legacy urls

        # Check that given journal name exists and that it is written
        # with correct casing.
        redirect_p = False
        try:
            washed_journal_name = wash_journal_name(argd['ln'], journal_name)
            if washed_journal_name != journal_name: