rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
'x_nb_2': nb_queries_distinct} | 'x_nb2': nb_queries_distinct} | def tmpl_display_alerts(self, ln, weburl, permanent, nb_queries_total, nb_queries_distinct, queries, guest, guesttxt): """ Displays the list of alerts |
urlargs=req.args) | req=req) | def index(req, ln=cdslang): navtrail_previous_links = brc.getnavtrail() # + """> <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py">BibRank Admin Interface</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) auth = brc.check_user(uid,'cfgbibrank') if not auth[0]: return... |
urlargs=req.args, | req=req, | def addrankarea(req, ln=cdslang, rnkcode='', template='', confirm=-1): navtrail_previous_links = brc.getnavtrail() + """> <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) auth = brc.check_use... |
body=brc.perform_modifytranslations(rnkID=rnkID, ln=ln, sel_type=sel_type, trans=trans, confirm=confirm), uid=uid, language=ln, urlargs=req.args, navtrail = navtrail_previous_links, lastupdated=__lastupdated__) | body=brc.perform_modifytranslations(rnkID=rnkID, ln=ln, sel_type=sel_type, trans=trans, confirm=confirm), uid=uid, language=ln, req=req, navtrail = navtrail_previous_links, lastupdated=__lastupdated__) | def modifytranslations(req, rnkID='', ln=cdslang, sel_type='', trans = [], confirm=0): navtrail_previous_links = brc.getnavtrail() + """> <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) auth... |
urlargs=req.args, | req=req, | def modifycollection(req, ln=cdslang, rnkID='', func='', colID='', confirm=0): navtrail_previous_links = brc.getnavtrail() + """> <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) auth = brc.c... |
urlargs=req.args, | req=req, | def deleterank(req, ln=cdslang, rnkID='', confirm=0): navtrail_previous_links = brc.getnavtrail() + """> <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) auth = brc.check_user(uid,'cfgbibrank... |
urlargs=req.args, | req=req, | def modifyrank(req, ln=cdslang, rnkID='', rnkcode='', template='', cfgfile='', confirm=0): navtrail_previous_links = brc.getnavtrail() + """> <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) ... |
urlargs=req.args, | req=req, | def showrankdetails(req, ln=cdslang, rnkID=''): navtrail_previous_links = brc.getnavtrail() + """> <a class=navtrail href="%s/admin/bibrank/bibrankadmin.py/">BibRank Admin Interface</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) auth = brc.check_user(uid,'cfgbibrank') if ... |
out += """guest :: <a class="userinfo" href="%s/youraccount.py/login">login</a>""" % weburl | out += """guest :: <a class="userinfo" href="%s/youraccount.py/info">info</a>:: <a class="userinfo" href="%s/youraccount.py/login">login</a> """%(weburl,weburl) | def create_user_infobox(uid): """Create info box on currenly logged user.""" out = "" if isGuestUser(uid): out += """guest :: <a class="userinfo" href="%s/youraccount.py/login">login</a>""" % weburl else: out += """%s :: <a class="userinfo" href="%s/youraccount.py/account">account</a></strong> :: <a class="userinfo" h... |
self.memory[name]['addresses'] = labels[name] | self.memory[name]['addresses'] = p_copy.deepcopy(labels[name]) | def __init__(self, labels=None): ''' Create an instance of the translator and init with the list of the defined labels and their rules. ''' if labels is None: labels = {} self.recIDs = [] self.recID = 0 self.recID_index = 0 self.record = None self.memory = {} pattern = address_pattern expr = re.compile(pattern) for nam... |
out += _("""If you don't own an account yet, please <a href="./register">register</a> an internal account.""") | out += _("""If you don't own an account yet, please <a href="../youraccount.py/register">register</a> an internal account.""") | def tmpl_login_form(self, ln, referer, internal, register_available, methods, selected_method, supportemail): """ Displays a login form |
try: return run_sql("""SELECT id FROM accROLE WHERE name = %s""" % (name_role, ))[0][0] | try: return run_sql("""SELECT id FROM accROLE WHERE name = %s""", (name_role, ))[0][0] | def acc_getRoleId(name_role): """get id of role, name given. """ try: return run_sql("""SELECT id FROM accROLE WHERE name = %s""" % (name_role, ))[0][0] except IndexError: return 0 |
try: return run_sql("""SELECT name FROM accROLE WHERE id = %s""" % (id_role, ))[0][0] | try: return run_sql("""SELECT name FROM accROLE WHERE id = %s""", (id_role, ))[0][0] | def acc_getRoleName(id_role): """get name of role, id given. """ try: return run_sql("""SELECT name FROM accROLE WHERE id = %s""" % (id_role, ))[0][0] except IndexError: return '' |
try: result = run_sql("""SELECT * FROM accROLE WHERE id = %s """ % (id_role, ))[0] | try: result = run_sql("""SELECT * FROM accROLE WHERE id = %s """, (id_role, ))[0] | def acc_getRoleDetails(id_role=0): """get all the fields for an action.""" details = [] try: result = run_sql("""SELECT * FROM accROLE WHERE id = %s """ % (id_role, ))[0] except IndexError: return details if result: for r in result: details.append(r) return details |
ORDER BY a.name """ % (id_role, )) | ORDER BY a.name """, (id_role, )) | def acc_getRoleActions(id_role): """get all actions connected to a role. """ return run_sql("""SELECT DISTINCT(a.id), a.name, a.description FROM accROLE_accACTION_accARGUMENT raa, accACTION a WHERE raa.id_accROLE = %s and raa.id_accACTION = a.id ORDER BY a.name """ % (id_role, )) |
ORDER BY u.email""" % (id_role, )) | ORDER BY u.email""", (id_role, )) | def acc_getRoleUsers(id_role): """get all users that have access to a role. """ return run_sql("""SELECT DISTINCT(u.id), u.email, u.settings FROM user_accROLE ur, user u WHERE ur.id_accROLE = %s AND u.id = ur.id_user ORDER BY u.email""" % (id_role, )) |
try: return run_sql("""SELECT DISTINCT id FROM accARGUMENT WHERE keyword = '%s' and value = '%s'""" % (keyword, value))[0][0] | try: return run_sql("""SELECT DISTINCT id FROM accARGUMENT WHERE keyword = %s and value = %s""", (keyword, value))[0][0] | def acc_getArgumentId(keyword, value): """get id of argument, keyword=value pair given. value = 'optional value' is replaced for id_accARGUMENT = -1.""" try: return run_sql("""SELECT DISTINCT id FROM accARGUMENT WHERE keyword = '%s' and value = '%s'""" % (keyword, value))[0][0] except IndexError: if value == 'optional... |
def acc_listUsers(): """list all users""" try: return run_sql("""SELECT id,email FROM user""") except IndexError: return [] | def acc_listUsers(): """list all users""" try: return run_sql("""SELECT id,email FROM user""") except IndexError: return [] | |
try: return run_sql("""SELECT email FROM user WHERE id = %s """ % (id_user, ))[0][0] | try: return run_sql("""SELECT email FROM user WHERE id = %s """, (id_user, ))[0][0] | def acc_getUserEmail(id_user=0): """get email of user, id given.""" try: return run_sql("""SELECT email FROM user WHERE id = %s """ % (id_user, ))[0][0] except IndexError: return '' |
try: return run_sql("""SELECT id FROM user WHERE email = '%s' """ % (email, ))[0][0] | try: return run_sql("""SELECT id FROM user WHERE email = %s """, (email, ))[0][0] | def acc_getUserId(email=''): """get id of user, email given.""" try: return run_sql("""SELECT id FROM user WHERE email = '%s' """ % (email, ))[0][0] except IndexError: return 0 |
query = """SELECT ur.id_accROLE | res = run_sql("""SELECT ur.id_accROLE | def acc_getUserRoles(id_user=0): """get all roles a user is connected to.""" query = """SELECT ur.id_accROLE FROM user_accROLE ur WHERE ur.id_user = %s ORDER BY ur.id_accROLE""" % (id_user, ) res = run_sql(query) return res |
ORDER BY ur.id_accROLE""" % (id_user, ) res = run_sql(query) | ORDER BY ur.id_accROLE""", (id_user, )) | def acc_getUserRoles(id_user=0): """get all roles a user is connected to.""" query = """SELECT ur.id_accROLE FROM user_accROLE ur WHERE ur.id_user = %s ORDER BY ur.id_accROLE""" % (id_user, ) res = run_sql(query) return res |
WHERE ur.id_user = %s """ % (id_user, )) | WHERE ur.id_user = %s """, (id_user, )) | def acc_findUserInfoIds(id_user=0): """find all authorization entries for all the roles a user is connected to.""" res1 = run_sql("""SELECT ur.id_user, raa.* FROM user_accROLE ur LEFT JOIN accROLE_accACTION_accARGUMENT raa ON ur.id_accROLE = raa.id_accROLE WHERE ur.id_user = %s """ % (id_user, )) res2 = [] for res in... |
raa.id_accARGUMENT = ar.id """ % (id_role, id_action)) | raa.id_accARGUMENT = ar.id """, (id_role, id_action)) | def acc_findPossibleActions(id_role, id_action): """Role based function to find all action combinations for a give role and action. id_role - id of role in the database id_action - id of the action in the database returns a list with all the combinations. first row is used for header.""" # query to find all entries... |
if run_sql("""SELECT * FROM accROLE_accACTION_accARGUMENT WHERE id_accROLE = %s AND id_accACTION = %s AND id_accARGUMENT = 0 AND argumentlistid = 0""" % (id_role, id_action)): | if run_sql("""SELECT * FROM accROLE_accACTION_accARGUMENT WHERE id_accROLE = %s AND id_accACTION = %s AND id_accARGUMENT = 0 AND argumentlistid = 0""", (id_role, id_action)): | def acc_findPossibleActions(id_role, id_action): """Role based function to find all action combinations for a give role and action. id_role - id of role in the database id_action - id of the action in the database returns a list with all the combinations. first row is used for header.""" # query to find all entries... |
roledetails = run_sql("""SELECT * FROM accROLE WHERE name = '%s' """ % (name_role, )) | roledetails = run_sql("""SELECT * FROM accROLE WHERE name = %s """, (name_role, )) | def acc_find_delegated_roles(id_role_admin=0): """find all the roles the admin role has delegation rights over. return tuple of all the roles. id_role_admin - id of the admin role """ id_action_delegate = acc_getActionId(name_action=DELEGATEADDUSERROLE) rolenames = run_sql("""SELECT DISTINCT(ar.value) FROM accROLE_a... |
def add_date(self, date=""): if not date: | def add_recIDs_by_date(self, dates=""): """Add recIDs modified between DATES[0] and DATES[1]. If DATES is not set, then add records modified since the last run of the ranking method. """ if not dates: | def add_date(self, date=""): # If date is not set, then retrieve it from the database. # Reindex all formats newer than the modification date if not date: write_message("Using the last update time for the rank method") query = """SELECT last_updated FROM rnkMETHOD WHERE name='%s' """ % options["current_run"] res = run_... |
date = ("0000-00-00",'') | dates = ("0000-00-00",'') | def add_date(self, date=""): # If date is not set, then retrieve it from the database. # Reindex all formats newer than the modification date if not date: write_message("Using the last update time for the rank method") query = """SELECT last_updated FROM rnkMETHOD WHERE name='%s' """ % options["current_run"] res = run_... |
date = (res[0][0],'') | dates = (res[0][0],'') | def add_date(self, date=""): # If date is not set, then retrieve it from the database. # Reindex all formats newer than the modification date if not date: write_message("Using the last update time for the rank method") query = """SELECT last_updated FROM rnkMETHOD WHERE name='%s' """ % options["current_run"] res = run_... |
'%s'""" % date[0] if date[1]: query += "and b.modification_date <= '%s'" % date[1] | '%s'""" % dates[0] if dates[1]: query += "and b.modification_date <= '%s'" % dates[1] | def add_date(self, date=""): # If date is not set, then retrieve it from the database. # Reindex all formats newer than the modification date if not date: write_message("Using the last update time for the rank method") query = """SELECT last_updated FROM rnkMETHOD WHERE name='%s' """ % options["current_run"] res = run_... |
wordTable.add_date("") | wordTable.add_recIDs_by_date("") | def word_index(row, run): """Run the indexing task. The row argument is the BibSched task queue row, containing if, arguments, etc. Return 1 in case of success and 0 in case of failure. """ ## import optional modules: try: import psyco psyco.bind(get_words_from_phrase) psyco.bind(WordTable.merge_with_old_recIDs) psyc... |
if format.startswith("hb"): | if format.startswith("hp"): for irec in range(irec_max,irec_min,-1): req.write(print_record(recIDs[irec], format, ot)) elif format.startswith("hb"): | def print_records(req, recIDs, jrec=1, rg=10, format='hb', ot='', decompress=zlib.decompress): """Prints list of records 'recIDs' formatted accoding to 'format' in groups of 'rg' starting from 'jrec'. Assumes that the input list 'recIDs' is sorted in reverse order, so it counts records from tail to head. A value of 'rg... |
elif format == "hd-ejournalsite": | elif cfg_cern_site and format == "hp": out += call_bibformat(recID, "HB_P") elif cfg_cern_site and format == "hd-ejournalsite": | def print_record(recID, format='hb', ot='', decompress=zlib.decompress): "Prints record 'recID' formatted accoding to 'format'." out = "" # sanity check: if not record_exists(recID): return out # print record opening tags, if needed: if format == "marcxml" or format == "oai_dc": out += " <record>\n" out += " <head... |
if cfg_use_aleph_sysnos: alephsysnos = get_fieldvalues(recID, "970__a") if len(alephsysnos)>0: alephsysno = alephsysnos[0] out += """<br><span class="moreinfo"><a class="moreinfo" href="%s/search.py?sysno=%s">Detailed record</a></span>""" \ % (weburl, alephsysno) | if format != "hp": if cfg_use_aleph_sysnos: alephsysnos = get_fieldvalues(recID, "970__a") if len(alephsysnos)>0: alephsysno = alephsysnos[0] out += """<br><span class="moreinfo"><a class="moreinfo" href="%s/search.py?sysno=%s">Detailed record</a></span>""" \ % (weburl, alephsysno) else: out += """<br><span class="more... | def print_record(recID, format='hb', ot='', decompress=zlib.decompress): "Prints record 'recID' formatted accoding to 'format'." out = "" # sanity check: if not record_exists(recID): return out # print record opening tags, if needed: if format == "marcxml" or format == "oai_dc": out += " <record>\n" out += " <head... |
else: out += """<br><span class="moreinfo"><a class="moreinfo" href="%s/search.py?recid=%s">Detailed record</a></span>""" \ % (weburl, recID) | def print_record(recID, format='hb', ot='', decompress=zlib.decompress): "Prints record 'recID' formatted accoding to 'format'." out = "" # sanity check: if not record_exists(recID): return out # print record opening tags, if needed: if format == "marcxml" or format == "oai_dc": out += " <record>\n" out += " <head... | |
opts, args = getopt.getopt(sys.argv[1:], "i:r:c:a:z:s:f:u:hv:Vn", | opts, args = getopt.getopt(sys.argv[1:], "ircazs:fu:hv:Vn", | def parse_command(): """Analyze the command line and retrieve arguments (xml file, mode, etc) into global options variable. Return 0 in case everything went well, 1 in case of errors, 2 in case only help or version number were asked for. """ # FIXME: add treatment of `time' try: opts, args = getopt.getopt(sys.argv[1:]... |
"insert=", "replace=", "correct=", "append=", "reference=", | "insert", "replace", "correct", "append", "reference", | def parse_command(): """Analyze the command line and retrieve arguments (xml file, mode, etc) into global options variable. Return 0 in case everything went well, 1 in case of errors, 2 in case only help or version number were asked for. """ # FIXME: add treatment of `time' try: opts, args = getopt.getopt(sys.argv[1:]... |
"format=", | "format", | def parse_command(): """Analyze the command line and retrieve arguments (xml file, mode, etc) into global options variable. Return 0 in case everything went well, 1 in case of errors, 2 in case only help or version number were asked for. """ # FIXME: add treatment of `time' try: opts, args = getopt.getopt(sys.argv[1:]... |
"verbose", | "verbose=", | def parse_command(): """Analyze the command line and retrieve arguments (xml file, mode, etc) into global options variable. Return 0 in case everything went well, 1 in case of errors, 2 in case only help or version number were asked for. """ # FIXME: add treatment of `time' try: opts, args = getopt.getopt(sys.argv[1:]... |
options['mode'] = 'insert' options['file_path'] = os.path.abspath(opt_value) | if options['mode'] == 'replace': options['mode'] = 'replace_or_insert' else: options['mode'] = 'insert' options['file_path'] = os.path.abspath(args[0]) | def parse_command(): """Analyze the command line and retrieve arguments (xml file, mode, etc) into global options variable. Return 0 in case everything went well, 1 in case of errors, 2 in case only help or version number were asked for. """ # FIXME: add treatment of `time' try: opts, args = getopt.getopt(sys.argv[1:]... |
if opt_value == '-i' or opt_value == '--insert': options['replace_insert'] = 1 options['mode'] = 'replace_insert' options['file_path'] = os.path.abspath(args[0]) | if options['mode'] == 'insert': options['mode'] = 'replace_or_insert' | def parse_command(): """Analyze the command line and retrieve arguments (xml file, mode, etc) into global options variable. Return 0 in case everything went well, 1 in case of errors, 2 in case only help or version number were asked for. """ # FIXME: add treatment of `time' try: opts, args = getopt.getopt(sys.argv[1:]... |
options['file_path'] = os.path.abspath(opt_value) | options['file_path'] = os.path.abspath(args[0]) | def parse_command(): """Analyze the command line and retrieve arguments (xml file, mode, etc) into global options variable. Return 0 in case everything went well, 1 in case of errors, 2 in case only help or version number were asked for. """ # FIXME: add treatment of `time' try: opts, args = getopt.getopt(sys.argv[1:]... |
try: if int(opt_value) > 0 and int(opt_value) < 999: options['mode'] = 'correct' options['tag'] = opt_value options['file_path'] = os.path.abspath(args[0]) except ValueError: if opt_value == 'FMT' or opt_value == 'FFT': options['mode'] = 'correct' options['tag'] = opt_value options['file_path'] = os.path.abspath(args[... | options['mode'] = 'correct' options['file_path'] = os.path.abspath(args[0]) | def parse_command(): """Analyze the command line and retrieve arguments (xml file, mode, etc) into global options variable. Return 0 in case everything went well, 1 in case of errors, 2 in case only help or version number were asked for. """ # FIXME: add treatment of `time' try: opts, args = getopt.getopt(sys.argv[1:]... |
try: if int(opt_value) > 0 and int(opt_value) < 999: options['mode'] = 'append' options['tag'] = opt_value options['file_path'] = os.path.abspath(args[0]) except ValueError: if opt_value == 'FMT' or opt_value == 'FFT': options['mode'] = 'append' options['tag'] = opt_value options['file_path'] = os.path.abspath(args[0]... | options['mode'] = 'append' options['file_path'] = os.path.abspath(args[0]) | def parse_command(): """Analyze the command line and retrieve arguments (xml file, mode, etc) into global options variable. Return 0 in case everything went well, 1 in case of errors, 2 in case only help or version number were asked for. """ # FIXME: add treatment of `time' try: opts, args = getopt.getopt(sys.argv[1:]... |
update_database_with_metadata(record, rec_id) | if options['mode'] == 'insert' or \ options['mode'] == 'replace' or \ options['mode'] == 'replace_or_insert' or \ options['mode'] == 'append' or \ options['mode'] == 'correct': update_database_with_metadata(record, rec_id) else: write_message(" -Stage NOT NEEDED in mode %s" % options['mode'], verbose=2) | def bibupload(record): """Main function: process a record and fit it in the tables bibfmt, bibrec, bibrec_bibxxx, bibxxx with proper record metadata. Return (error_code, recID) of the processed record. """ error = None # If there are special tags to proceed check if it exists in the record if options['tag'] is not Non... |
if options['mode'] != 'replace_insert': | if options['mode'] != 'replace_or_insert': | def retrieve_rec_id(record): """Retrieve the record Id from a record by using tag 001 or SYSNO or OAI ID tag.""" rec_id = None # 1st step: we look for the tag 001 tag_001 = extract_tag_from_record(record, '001') if tag_001 is not None: # We extract the record ID from the tag rec_id = tag_001[0][3] # if we are in inse... |
if options['mode'] == 'insert' or options['mode'] == 'replace' or options['mode'] == 'append': write_message(" insertion of the tag "+full_tag+" with the value "+value, verbose=9) (table_name, bibxxx_row_id) = insert_record_bibxxx(full_tag, value) if table_name is None or bibxxx_row_id is None: write_message(" Fa... | write_message(" insertion of the tag "+full_tag+" with the value "+value, verbose=9) (table_name, bibxxx_row_id) = insert_record_bibxxx(full_tag, value) if table_name is None or bibxxx_row_id is None: write_message(" Failed : during insert_record_bibxxx", verbose=1, stream=sys.stderr) res = insert_record_bibrec_... | def update_database_with_metadata(record, rec_id): """Update the database tables with the record and the record id given in parameter""" for tag in record.keys(): # check if tag is not a control field : tag not in CFG_BIBUPLOAD_CONTROLFIELD_TAGS and if tag not in CFG_BIBUPLOAD_SPECIAL_TAGS: # for each tag there is a li... |
"""" | """ | def tmpl_nice_number_via_locale(self, number, ln=cdslang): """" Return nicely printed number NUM in language LN using the locale. See also version tmpl_nice_number(). """ if number is None: return None # Temporarily switch the numeric locale to the requeted one, and format the number # In case the system has no locale ... |
return (1, rec_id) | return (1, int(rec_id)) | def bibupload(record): """Main function: process a record and fit it in the tables bibfmt, bibrec, bibrec_bibxxx, bibxxx with proper record metadata. Return (error_code, recID) of the processed record. """ error = None # If there are special tags to proceed check if it exists in the record if options['tag'] is not Non... |
return (0, rec_id) | return (0, int(rec_id)) | def bibupload(record): """Main function: process a record and fit it in the tables bibfmt, bibrec, bibrec_bibxxx, bibxxx with proper record metadata. Return (error_code, recID) of the processed record. """ error = None # If there are special tags to proceed check if it exists in the record if options['tag'] is not Non... |
options['mode'] == 'correct': | options['mode'] == 'correct' or \ options['mode'] == 'reference': | def bibupload(record): """Main function: process a record and fit it in the tables bibfmt, bibrec, bibrec_bibxxx, bibxxx with proper record metadata. Return (error_code, recID) of the processed record. """ error = None # If there are special tags to proceed check if it exists in the record if options['tag'] is not Non... |
navtrail = """<a class=navtrail href="%s/admin/index?ln=%s">%s</a>""" % (weburl, ln, _("Admin Area")) | navtrail = """<a class=navtrail href="%s/admin/index.%s.html">%s</a>""" % (weburl, ln, _("Admin Area")) | def index(req, ln=cdslang): """ Main BibFormat administration page. Displays a warning if we find out that etc/biformat dir is not writable by us (as most opeation of BibFormat must write in this directory). @param ln: language """ warnings = [] #FIXME Remove when removing Migration Kit from invenio.bibformat_migrat... |
urlargs = string.replace(req.args, "action=%s" % msg_search[ln],"action=%s" % msg_browse[ln]) | urlargs = string.replace(req.args, "action=%s" % msg_browse[ln], "action=%s" % msg_search[ln]) | def browse_in_bibwords(req, p, f, ln=cdslang): """Browse inside words indexes.""" if not p: return req.write("<p>Words nearest to <em>%s</em> " % p) if f: req.write(" inside <em>%s</em> " % f) req.write(" in any collection are:<br>") urlargs = string.replace(req.args, "action=%s" % msg_search[ln],"action=%s" % msg_brow... |
""" | """ if warnings != None and len(warnings) > 0: warnings = get_msgs_for_code_list(warnings, 'warning', ln) warnings = [x[1] for x in warnings] | def perform_request_index(ln=cdslang, warnings=None): """ Returns the main BibFormat admin page. This is the only page where the code needs to be cleaned when the migration kit will be removed. #TODO: remove when removing migration_kit @param ln language @param warnings a list of messages to display at top of the pa... |
methods[rank_method_code]["stemmer"] = Stemmer.Stemmer(languages[config.get(cfg_function, "stem_query_language")]) | try: methods[rank_method_code]["stemmer"] = Stemmer.Stemmer(languages[config.get(cfg_function, "stem_query_language")]) except Exception,e: pass | def create_rnkmethod_cache(): """Create cache with vital information for each rank method.""" global methods languages = {'fr': 'french', 'en': 'porter', 'no':'norwegian', 'se':'swedish', 'de': 'german', 'it':'italian', 'pt':'portugese'} bibrank_meths = run_sql("SELECT name from rnkMETHOD") methods = {} global voutput... |
out += """<strong><a href="\ <a href="\ | out += """<strong><a href=" <a href=" | def tmpl_print_results_overview(self, ln, weburl, results_final_nb_total, cpu_time, results_final_nb, colls, url_args): """Prints results overview box with links to particular collections below. |
Create an instance of the BFXParser class. Initialize with a transaltor. | Create an instance of the BFXParser class. Initialize with a translator. | def __init__(self, translator): ''' Create an instance of the BFXParser class. Initialize with a transaltor. The BFXparser makes queries to the translator for the values of certain names. For the communication it uses the following translator methods: - is_defined(name) - iterator(name) - get_value(name, [display_speci... |
In this case only the format code is 'executed'. Naturaly, in it, it would have references to other templates in the document. | In this case only the format code is 'executed'. Naturally, in it, it would have references to other templates in the document. | def load_template(self, template_name): ''' Load a BFX template file. A template file can have one of two forms: - it is a file with a single template. Root tag is 'template'. In an API call the single template element is 'executed'. - it is a 'style' file which contains exactly one format and zero or more templates. R... |
The iterator changes state of interenal variables and objects. | The iterator changes state of internal variables and objects. | def iterator(self, name): ''' An iterator over the values of a certain name. The iterator changes state of interenal variables and objects. When calling get_value in a loop, this will result each time in a different value. ''' if name == 'record': for self.recID in self.recIDs: self.record = get_record(self.recID) if s... |
Deside what the final output value is according to the display_type. | Decide what the final output value is according to the display_type. | def display_record(self, record, display_type='value'): ''' Deside what the final output value is according to the display_type. @param record the record structure to display; this is most probably just a single subfield @param display_type a string specifying the desired output; can be one of: value, tag, ind1, ind2, ... |
text="<INPUT name=\"%s\" size=\"%s\" value=\"%s\">" % (field['name'],field['size'],field['val']) | text="<INPUT name=\"%s\" size=\"%s\" value=\"%s\" maxlength=\"%s\">" % (field['name'],field['size'],field['val'],field['maxlength']) | def tmpl_submit_field(self, ln, field): """ Produces the HTML code for the specified field |
def send_email(fromaddr, toaddr, body): | def send_email(fromaddr, toaddr, body, attempt=0): | def send_email(fromaddr, toaddr, body): global DEBUGLEVEL try: server = smtplib.SMTP('localhost') if DEBUGLEVEL > 2: server.set_debuglevel(1) else: server.set_debuglevel(0) server.sendmail(fromaddr, toaddr, body) server.quit() except: print 'Error connecting to SMTP server, retrying in 10 seconds.' sleep(10) send_emai... |
print 'Error connecting to SMTP server, retrying in 10 seconds.' | if (DEBUGLEVEL > 1): print 'Error connecting to SMTP server, attempt %s retrying in 10 seconds.' % attempt | def send_email(fromaddr, toaddr, body): global DEBUGLEVEL try: server = smtplib.SMTP('localhost') if DEBUGLEVEL > 2: server.set_debuglevel(1) else: server.set_debuglevel(0) server.sendmail(fromaddr, toaddr, body) server.quit() except: print 'Error connecting to SMTP server, retrying in 10 seconds.' sleep(10) send_emai... |
send_email(fromaddr, toaddr, body) | send_email(fromaddr, toaddr, body, attempt+1) return | def send_email(fromaddr, toaddr, body): global DEBUGLEVEL try: server = smtplib.SMTP('localhost') if DEBUGLEVEL > 2: server.set_debuglevel(1) else: server.set_debuglevel(0) server.sendmail(fromaddr, toaddr, body) server.quit() except: print 'Error connecting to SMTP server, retrying in 10 seconds.' sleep(10) send_emai... |
catword = 'catalogue' | catword = 'collection' | def email_notify(alert, records, argstr): global FROMADDR global ALERTURL global DEBUGLEVEL global DEVELOPERADDR if len(records) == 0: return msg = "" if DEBUGLEVEL > 0: msg = "*** THIS MESSAGE WAS SENT IN DEBUG MODE, DON'T TAKE IT INTO ACCOUNT ***\n\n" msg += "Hello\n\n" msg += wrap("Below are the results of the e... |
msg += wrap('run time: %s ' % time) | msg += wrap('run time: %s ' % strftime("%a %d-%m-%Y %H:%M:%S")) | def email_notify(alert, records, argstr): global FROMADDR global ALERTURL global DEBUGLEVEL global DEVELOPERADDR if len(records) == 0: return msg = "" if DEBUGLEVEL > 0: msg = "*** THIS MESSAGE WAS SENT IN DEBUG MODE, DON'T TAKE IT INTO ACCOUNT ***\n\n" msg += "Hello\n\n" msg += wrap("Below are the results of the e... |
msg += "\n-- \nCERN Document Server Alert Service <%s>\nUnsubscribe at <%s>\nNeed human intervention? Contact <%s>" % (weburl, ALERTURL, supportemail) | msg += "\n-- \nCERN Document Server Alert Service <%s>\nUnsubscribe? See <%s>\nNeed human intervention? Contact <%s>" % (weburl, ALERTURL, supportemail) | def email_notify(alert, records, argstr): global FROMADDR global ALERTURL global DEBUGLEVEL global DEVELOPERADDR if len(records) == 0: return msg = "" if DEBUGLEVEL > 0: msg = "*** THIS MESSAGE WAS SENT IN DEBUG MODE, DON'T TAKE IT INTO ACCOUNT ***\n\n" msg += "Hello\n\n" msg += wrap("Below are the results of the e... |
_current_module = sys.modules.get('_apache') | _current_module = sys.modules.get('mod_python._apache') | def __init__(self, q): self.args = q self.method = "GET" return |
sys.modules['_apache'] = _FakeApache() | sys.modules['mod_python._apache'] = _FakeApache() from mod_python.util import FieldStorage | def __init__(self, q): self.args = q self.method = "GET" return |
sys.modules['_apache'] = _current_module | sys.modules['mod_python._apache'] = _current_module | def __init__(self, q): self.args = q self.method = "GET" return |
del sys.modules['_apache'] | del sys.modules['mod_python._apache'] from invenio import webinterface_handler from invenio.config import cdslang | def __init__(self, q): self.args = q self.method = "GET" return |
try: from mod_python.util import FieldStorage except ImportError: self.fail("WARNING: cannot import mod_python.util.FieldStorage; test not run.") | def _check(self, query, default, expected): try: from mod_python.util import FieldStorage except ImportError: self.fail("WARNING: cannot import mod_python.util.FieldStorage; test not run.") | |
except: pass | except: browser_s += ': ' + info_not_available host_s = page_s = client_s = info_not_available | def tmpl_error_box(self, ln, title, verbose, req, supportemail, errors): """Produces an error box. |
try: body = [output, extra] except NameError: body = [output] if callback: return perform_index(fldID, ln, "perform_showindexoverview", addadminbox(subtitle, body)) | body = [output] if callback: return perform_index(ln, "perform_showindexoverview", addadminbox(subtitle, body)) | def perform_showindexoverview(ln=cdslang, callback='', confirm=0): subtitle = """<a name="1"></a>1. Overview of indexes""" output = """<table cellpadding="3" border="1">""" output += """<tr><td><strong>%s</strong></td><td><strong>%s</strong></td><td><strong>%s</strong></td><td><strong>%s</strong></td><td><strong>%s</st... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_editindexes(ln=cdslang, callback='yes', content='', confirm=-1): """show a list of indexes that can be edited.""" subtitle = """<a name="2"></a>2. Edit index   <small>[<a title="See guide" href="%s/admin/bibindex/guide.html">?</a>]</small>""" % (weburl) fin_output = '' idx = get_idx() output =... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_editfields(ln=cdslang, callback='yes', content='', confirm=-1): """show a list of all logical fields that can be edited.""" subtitle = """<a name="5"></a>5. Edit logical field   <small>[<a title="See guide" href="%s/admin/bibindex/guide.html">?</a>]</small>""" % (weburl) fin_output = '' res =... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_addindex(ln=cdslang, idxNAME='', callback="yes", confirm=-1): """form to add a new index. idxNAME - the name of the new index""" output = "" subtitle = """<a name="3"></a>3. Add new index""" text = """ <span class="adminlabel">Index name</span> <input class="admin_w200" type="text" name="idxNAME" value="%s... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_modifyindextranslations(idxID, ln=cdslang, sel_type='', trans=[], confirm=-1, callback='yes'): """Modify the translations of a index sel_type - the nametype to modify trans - the translations in the same order as the languages from get_languages()""" output = '' subtitle = '' cdslangs = get_languages() if ... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_modifyfieldtranslations(fldID, ln=cdslang, sel_type='', trans=[], confirm=-1, callback='yes'): """Modify the translations of a field sel_type - the nametype to modify trans - the translations in the same order as the languages from get_languages()""" output = '' subtitle = '' cdslangs = get_languages() if ... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_showdetailsfieldtag(fldID, tagID, ln=cdslang, callback="yes", confirm=-1): """form to add a new field. fldNAME - the name of the new field code - the field code""" fld_dict = dict(get_def_name('', "field")) fldID = int(fldID) tagname = run_sql("SELECT name from tag where id=%s" % tagID)[0][0] output = "" ... |
try: body = [fin_output, extra] except NameError: body = [fin_output] | body = [fin_output] | def perform_showdetailsfield(fldID, ln=cdslang, callback="yes", confirm=-1): """form to add a new field. fldNAME - the name of the new field code - the field code""" fld_dict = dict(get_def_name('', "field")) col_dict = dict(get_def_name('', "collection")) fldID = int(fldID) col_fld = get_col_fld('', '', fldID) sort_t... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_addfield(ln=cdslang, fldNAME='', code='', callback="yes", confirm=-1): """form to add a new field. fldNAME - the name of the new field code - the field code""" output = "" subtitle = """<a name="6"></a>6. Add new logical field""" code = str.replace(code,' ', '') text = """ <span class="adminlabel">Field na... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_deletefield(fldID, ln=cdslang, callback='yes', confirm=0): """form to remove a field. fldID - the field id from table field. """ fld_dict = dict(get_def_name('', "field")) if not fld_dict.has_key(int(fldID)): return """<b><span class="info">Field does not exist</span></b>""" subtitle = """<a name="4"></a>... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_deleteindex(idxID, ln=cdslang, callback='yes', confirm=0): """form to delete an index. idxID - the index id from table idxINDEX. """ if idxID: subtitle = """<a name="4"></a>4. Delete the index.   <small>[<a title="See guide" href="%s/admin/bibindex/guide.html">?</a>]</small>""" % weburl output ... |
try: body = [output, extra] except NameError: body = [output] if callback: return perform_field(fldID, ln, "perform_showfieldoverview", addadminbox(subtitle, body)) | body = [output] if callback: return perform_field(ln, "perform_showfieldoverview", addadminbox(subtitle, body)) | def perform_showfieldoverview(ln=cdslang, callback='', confirm=0): subtitle = """<a name="4"></a>4. Logical fields overview""" output = """<table cellpadding="3" border="1">""" output += """<tr><td><strong>%s</strong></td><td><strong>%s</strong></td><td><strong>%s</strong></td></tr>""" % ("Field", "MARC Tags", "Transla... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_modifyindex(idxID, ln=cdslang, idxNAME='', idxDESC='', callback='yes', confirm=-1): """form to modify an index name. idxID - the index name to change. idxNAME - new name of index idxDESC - description of index content""" subtitle = "" output = "" if idxID not in [-1, "-1"]: subtitle = """<a name="2"></a... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_modifyfield(fldID, ln=cdslang, code='', callback='yes', confirm=-1): """form to modify a field. fldID - the field to change.""" subtitle = "" output = "" fld_dict = dict(get_def_name('', "field")) if fldID not in [-1, "-1"]: if confirm in [-1, "-1"]: res = get_fld(fldID) code = res[0][2] else: code = s... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_modifyindexfields(idxID, ln=cdslang, callback='yes', content='', confirm=-1): """Modify which logical fields to use in this index..""" output = '' subtitle = """<a name="3"></a>3. Modify index fields.   <small>[<a title="See guide" href="%s/admin/bibindex/guide.html">?</a>]</small>""" % weburl ... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_modifyfieldtags(fldID, ln=cdslang, callback='yes', content='', confirm=-1): """show the sort fields of this collection..""" output = '' fld_dict = dict(get_def_name('', "field")) fld_type = get_fld_nametypes() fldID = int(fldID) subtitle = """<a name="4"></a>3. Modify MARC tags for the logical field '%s'... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_addtag(fldID, ln=cdslang, value=['',-1], name='', callback="yes", confirm=-1): """form to add a new field. fldNAME - the name of the new field code - the field code""" output = "" subtitle = """<a name="4.1"></a>Add MARC tag to logical field""" text = """ Add new tag:<br> <span class="adminlabel">Tag value... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_modifytag(fldID, tagID, ln=cdslang, name='', value='', callback='yes', confirm=-1): """form to modify a field. fldID - the field to change.""" subtitle = "" output = "" fld_dict = dict(get_def_name('', "field")) fldID = int(fldID) tagID = int(tagID) tag = get_tags(tagID) if confirm in [-1, "-1"] and no... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_removefieldtag(fldID, tagID, ln=cdslang, callback='yes', confirm=0): """form to remove a tag from a field. fldID - the current field, remove the tag from this field. tagID - remove the tag with this id""" subtitle = """<a name="4.1"></a>Remove MARC tag from logical field""" output = "" fld_dict = dict(ge... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_addindexfield(idxID, ln=cdslang, fldID='', callback="yes", confirm=-1): """form to add a new field. fldNAME - the name of the new field code - the field code""" output = "" subtitle = """<a name="4.1"></a>Add logical field to index""" text = """ <span class="adminlabel">Field name</span> <select name="fldI... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_removeindexfield(idxID, fldID, ln=cdslang, callback='yes', confirm=0): """form to remove a field from an index. idxID - the current index, remove the field from this index. fldID - remove the field with this id""" subtitle = """<a name="3.1"></a>Remove field from index""" output = "" if fldID and idxID: ... |
try: body = [output, extra] except NameError: body = [output] | body = [output] | def perform_deletetag(fldID, ln=cdslang, tagID=-1, callback='yes', confirm=-1): """form to delete an MARC tag not in use. fldID - the collection id of the current collection. fmtID - the format id to delete.""" subtitle = """<a name="10.3"></a>Delete an unused MARC tag""" output = """ <dl> <dd>Deleting an MARC tag wi... |
def _clone_functionparamaters_foraction_fromdoctype_todoctype(errors, warnings, user_msg, fromdoctype, todoctype, action): | def _clone_functionparameters_foraction_fromdoctype_todoctype(errors, warnings, user_msg, fromdoctype, todoctype, action): | def _clone_functionparamaters_foraction_fromdoctype_todoctype(errors, warnings, user_msg, fromdoctype, todoctype, action): """Clone the parameters/values of a given action of one document type, to the same action on another document type. @param errors: a list of errors encountered while cloning parameters @param warni... |
all_submissions_clonefrom = get_submissiondetails_all_submissions_doctype(doctype=clonefrom) if len(all_submissions_clonefrom) > 0: | all_actnames_submissions_clonefrom = get_actname_all_submissions_doctype(doctype=clonefrom) if len(all_actnames_submissions_clonefrom) > 0: | def _add_doctype(errors, warnings, doctype, doctypename, doctypedescr, clonefrom): title = "" body = "" user_msg = [] numrows_doctype = get_number_doctypes_docid(docid=doctype) if numrows_doctype > 0: ## this document type already exists - do not add ## TODO : LOG ERROR user_msg.append("""A document type identified by ... |
for submission in all_submissions_clonefrom: (clonefrom_subname, clonefrom_docname, clonefrom_actname, clonefrom_displayed, clonefrom_nbpg, clonefrom_cd, clonefrom_md, clonefrom_buttonorder, clonefrom_statustext, clonefrom_level, clonefrom_score, clonefrom_stpage, clonefrom_endtxt) = submission error_code = delete_s... | for doc_submission_actname in all_actnames_submissions_clonefrom: action_name = doc_submission_actname[0] _clone_submission_fromdoctype_todoctype(errors=errors, warnings=errors, user_msg=user_msg, todoctype=doctype, action=action_name, clonefrom=clonefrom) | def _add_doctype(errors, warnings, doctype, doctypename, doctypedescr, clonefrom): title = "" body = "" user_msg = [] numrows_doctype = get_number_doctypes_docid(docid=doctype) if numrows_doctype > 0: ## this document type already exists - do not add ## TODO : LOG ERROR user_msg.append("""A document type identified by ... |
error_code = insert_submission_details_clonefrom_submission(addtodoctype=doctype, action=action, clonefromdoctype=clonefrom) if error_code == 0: user_msg.append("The '%s' Submission has been added to the '%s' Document Type. Cloned from Document Type '%s'." \ % (action, doctype, doctype)) else: user_msg.append("The Do... | numrows_submission_doctype = get_number_submissions_doctype_action(doctype=doctype, action=action) if numrows_submission_doctype > 0: user_msg.append("""The Submission "%s" already exists for Document Type "%s" - cannot add it again""" \ %(action, doctype)) | def _add_submission_to_doctype_clone(errors, warnings, doctype, action, clonefrom): user_msg = [] ## does action exist? ## does doctype already have action? numrows_action = get_number_actions_with_actid(actid=action) if numrows_action > 0: ## the action exists - clone submission: error_code = insert_submission_details... |
xxx = xxx.replace('<!DOCTYPEcollectionSYSTEM"file:///soft/cdsware-CDSCERNWIENERDEV/etc/bibedit/MARC21slim.dtd"><collection>', '<collectionxmlns="http://www.loc.gov/MARC21/slim">') self.assertEqual(xxx,yyy) | def test_for_sanity(self): """ bibrecord - checking for sanity """ |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.