def format_template_update_attributes(req, bft, ln=CFG_SITE_LANG, name="", description="", duplicate=None): """ Update the name and description of given format template @param req: the request object @param ln: language @param description: the new description @param name: the new name @param bft: the filename of the template to update @param duplicate: the filename of template that we want to copy (the code) @return: a web page (or redirection to a web page) """ ln = wash_language(ln) _ = gettext_set_language(ln) try: uid = getUid(req) except: return error_page('Error', req) (auth_code, auth_msg) = check_user(req, 'cfgbibformat') if not auth_code: if duplicate is not None: duplicate = wash_url_argument(duplicate, 'str') name = wash_url_argument(name, 'str') description = wash_url_argument(description, 'str') bft = bibformatadminlib.update_format_template_attributes( bft, name, description, duplicate) redirect_to_url( req, "format_template_show?ln=%(ln)s&bft=%(bft)s" % { 'ln': ln, 'bft': bft }) else: return page_not_authorized(req=req, text=auth_msg)
def format_template_update_attributes(req, bft, ln=CFG_SITE_LANG, name = "", description="", duplicate=None): """ Update the name and description of given format template @param req: the request object @param ln: language @param description: the new description @param name: the new name @param bft: the filename of the template to update @param duplicate: the filename of template that we want to copy (the code) @return: a web page (or redirection to a web page) """ ln = wash_language(ln) _ = gettext_set_language(ln) try: uid = getUid(req) except: return error_page('Error', req) (auth_code, auth_msg) = check_user(req, 'cfgbibformat') if not auth_code: if duplicate is not None: duplicate = wash_url_argument(duplicate, 'str') name = wash_url_argument(name, 'str') description = wash_url_argument(description, 'str') bft = bibformatadminlib.update_format_template_attributes(bft, name, description, duplicate) redirect_to_url(req, "format_template_show?ln=%(ln)s&bft=%(bft)s" % {'ln':ln, 'bft':bft}) else: return page_not_authorized(req=req, text=auth_msg)
ln = wash_language(ln) _ = gettext_set_language(ln) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) (auth_code, auth_msg) = check_user(req, "cfgbibformat") if not auth_code: if duplicate is not None: duplicate = wash_url_argument(duplicate, "str") name = wash_url_argument(name, "str") description = wash_url_argument(description, "str") bft = bibformatadminlib.update_format_template_attributes(bft, name, description, duplicate) redirect_to_url(req, "format_template_show?ln=%(ln)s&bft=%(bft)s" % {"ln": ln, "bft": bft}) else: return page_not_authorized(req=req, text=auth_msg) def format_template_delete(req, bft, ln=CFG_SITE_LANG, chosen_option=""): """ Delete a format template @param req: the request object @param bft: the filename of the template to delete @param ln: language @param chosen_option: empty string when user has not yet confirm. Else "Delete" to confirm @return: a web page (or redirection to a web page)
ln = wash_language(ln) _ = gettext_set_language(ln) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) (auth_code, auth_msg) = check_user(req, 'cfgbibformat') if not auth_code: if duplicate is not None: duplicate = wash_url_argument(duplicate, 'str') name = wash_url_argument(name, 'str') description = wash_url_argument(description, 'str') bft = bibformatadminlib.update_format_template_attributes( bft, name, description, duplicate) redirect_to_url( req, "format_template_show?ln=%(ln)s&bft=%(bft)s" % { 'ln': ln, 'bft': bft }) else: return page_not_authorized(req=req, text=auth_msg) def format_template_delete(req, bft, ln=CFG_SITE_LANG, chosen_option=""): """ Delete a format template @param req: the request object