rem stringlengths 0 322k | add stringlengths 0 2.05M | context stringlengths 8 228k |
|---|---|---|
<table border="0" cellspacing="1" cellpadding="1">""" % (msg_dowloads_history[ln], user_analysis_text) | <table border="0" cellspacing="1" cellpadding="1">""" % (msg_downloads_history[ln], user_analysis_text) | def create_download_history_graph_and_box(id_bibrec, ln=cdslang): """Create graph with citation history for record ID_BIBREC (into a temporary file) and return HTML box refering to that image. Called by Detailed record pages. Notes: if id_bibrec=0 : its an oustide-stored document and it has no id_bibdoc --> only one li... |
<dd>spesialized area to set up the delegation rights used in the areas above. <br> | <dd>specialized area to set up the delegation rights used in the areas above. <br> | def perform_delegate_startarea(req): """start area for lower level delegation of rights.""" subtitle = 'select what to do' output = '' if is_adminuser(req)[0] == 0: output += """ <p> You are also allowed to be in the <a href="../webaccessadmin.py">Main Admin Area</a> which gives you<br> the access to the full functi... |
output_format = "%02d " + month + " %04Y, %02H:%02M" | output_format = "%d " + month + " %Y, %H:%M" | def convert_datetext_to_dategui(datetext, ln=cdslang): """ Convert: '2005-11-16 15:11:57' => '16 nov 2005, 15:11' Month is internationalized """ try: datestruct = convert_datetext_to_datestruct(datetext) if datestruct == datestruct_default: raise ValueError month = get_i18n_month_name(datestruct[1], ln=ln) output_forma... |
output_format = "%02d " + month + " %04Y, %02H:%02M" | output_format = "%d " + month + " %Y, %H:%M" | def convert_datestruct_to_dategui(datestruct, ln=cdslang): """ Convert: (2005, 11, 16, 15, 11, 44, 2, 320, 0) => '16 nov 2005, 15:11' Month is internationalized """ try: if datestruct[0] and datestruct[1] and datestruct[2]: month = get_i18n_month_name(datestruct[1], ln=ln) output_format = "%02d " + month + " %04Y, %02H... |
out += """You have defined <B>%s</B> baskets.<BR>""" % len(query_result) | out += """You own <B>%s</B> baskets.<BR>""" % len(query_result) | def perform_display(uid, action="", delete_alerts="", confirm_action="", id_basket=0, bname="", newname="", newbname="", mark=[], to_basket="", copy_move="", idup="", ordup="", iddown="", orddown=""): # set variables out = "" basket_name = "" public_basket="no" permission = [] id_user = isGuestUser(uid) bname = get_ba... |
out += """<p>You don't have any baskets defined yet.""" | out += """<p>You don't own baskets defined yet.""" | def perform_request_add(uid=-1, recid=[], bid=[], bname=[]): """Add records recid to baskets bid for user uid. If bid isn't set, it'll ask user into which baskets to add them. If bname is set, it'll create new basket with this name, and add records there rather than to bid.""" out = "" recIDs = recid bskIDs = bid # san... |
out += """<span class="info">sorry, you are not the owner of the basket.</span>""" | out += """<span class="info">sorry, you are not the owner of this basket.</span>""" | def perform_request_add(uid=-1, recid=[], bid=[], bname=[]): """Add records recid to baskets bid for user uid. If bid isn't set, it'll ask user into which baskets to add them. If bname is set, it'll create new basket with this name, and add records there rather than to bid.""" out = "" recIDs = recid bskIDs = bid # san... |
At the moment we just check whether it contains ampersand and | At the moment we just check whether it contains '@' and | def checkemail(email): """Check whether the EMAIL address supplied by the user is valid. At the moment we just check whether it contains ampersand and whether it doesn't contain blanks. checkemail(email) -> boolean """ if (string.find(email, "@") <= 0) or (string.find(email, " ") > 0): return 0 return 1 |
if options["verbose"] >=9: write_message("Getting records from collections enabled for rank method.") res = run_sql("SELECT collection.name FROM collection,collection_rnkMETHOD,rnkMETHOD WHERE collection.id=id_collection and id_rnkMETHOD=rnkMETHOD.id and rnkMETHOD.name='%s'" % key) l_of_colls = [] for coll in res: l_o... | def get_valid_range(key): """Returns which records are valid for this rank method, according to which collections it is enabled for.""" if options["verbose"] >=9: write_message("Getting records from collections enabled for rank method.") res = run_sql("SELECT collection.name FROM collection,collection_rnkMETHOD,rnkMET... | |
recIDs = perform_request_search(c="") | def get_valid_range(key): """Returns which records are valid for this rank method, according to which collections it is enabled for.""" if options["verbose"] >=9: write_message("Getting records from collections enabled for rank method.") res = run_sql("SELECT collection.name FROM collection,collection_rnkMETHOD,rnkMET... | |
valid = HitSet() valid.addlist(recIDs) | valid = HitSet(Numeric.ones(cfg_max_recID+1, Numeric.Int0)) | def get_valid_range(key): """Returns which records are valid for this rank method, according to which collections it is enabled for.""" if options["verbose"] >=9: write_message("Getting records from collections enabled for rank method.") res = run_sql("SELECT collection.name FROM collection,collection_rnkMETHOD,rnkMET... |
filename_to_watch_for = sre.sub(r'^\.\/', '', filename) | filename_to_watch_for = sre.sub(r'^[\.\/]+', '', filename) | def get_nb_pychecker_warnings(filename): """Run pychecker for FILENAME and return the number of warnings. Do not return warnings from imported files, only warnings found inside FILENAME. """ nb_warnings_found = 0 filename_to_watch_for = sre.sub(r'^\.\/', '', filename) # pychecker strips leading ./ (dummy, pipe, dummy) ... |
<th class="adminheaderleft">Output Formats that use %(name)s</th> | <th class="adminheaderleft">Format Templates that use %(name)s</th> | def tmpl_admin_output_format_show_dependencies(self, ln, name, code, format_templates): """ Shows the dependencies of the given format. |
out += "<strong>%s %d</strong>" % (msg_record[ln], recID) | out += "<strong>%s %d</strong>" % (get_field_i18nname("record ID", ln), recID) | def print_record(recID, format='hb', ot='', ln=cdslang, decompress=zlib.decompress): "Prints record 'recID' formatted accoding to 'format'." out = "" # sanity check: record_exist_p = record_exists(recID) if record_exist_p == 0: # doesn't exist return out # print record opening tags, if needed: if format == "marcxml" ... |
colls_to_search.extend(results_final.keys()) | def perform_request_search(req=None, cc=cdsname, c=None, p="", f="", rg="10", sf="", so="d", sp="", of="id", ot="", as="0", p1="", f1="", m1="", op1="", p2="", f2="", m2="", op2="", p3="", f3="", m3="", sc="0", jrec="0", recid="-1", recidb="-1", sysno="", id="-1", idb="-1", sysnb="", action="SEARCH", d1y="", d1m="", d1... | |
if not auth_code: | if (auth_code != 'false'): | def index(req, ln=cdslang): """ Menu of admin options @param ln: language """ ln = wash_language(ln) _ = gettext_set_language(ln) navtrail_previous_links = getnavtrail() navtrail_previous_links +=' > <a class="navtrail" href="%s/admin/webcomment/webcommentadmin.py/">' % weburl navtrail_previous_links += _("Comment M... |
if not auth_code: | if (auth_code != 'false'): | def delete(req, ln=cdslang, comid=""): """ Delete a comment by giving its comment id @param ln: language @param comid: comment id """ ln = wash_language(ln) _ = gettext_set_language(ln) navtrail_previous_links = getnavtrail() navtrail_previous_links += ' > <a class="navtrail" href="%s/admin/webcomment/webcommentadmi... |
(auth_code, auth_msg) = check_user(auid,'cfgwebcomment') if not auth_code: if reviews==0: raise ValueError | (auth_code, auth_msg) = check_user(auid, 'cfgwebcomment') if (auth_code != 'false'): | def comments(req, ln=cdslang, uid="", comid="", reviews=0): """ View reported comments, filter by either user or a specific comment (only one given at a time) @param ln: language @param uid: user id @param comid: comment id @param reviews: boolean enabled for reviews, disabled for comments """ ln = wash_language(ln) _ ... |
if not auth_code: | if (auth_code != 'false'): | def users(req, ln=cdslang): """ View a list of all the users that have been reported, sorted by most reported @param ln: language """ ln = wash_language(ln) _ = gettext_set_language(ln) navtrail_previous_links = getnavtrail() navtrail_previous_links += ' > <a class="navtrail" href="%s/admin/webcomment/webcommentadmi... |
def modifyfield(req, colID, fldID, fldvID='', ln=cdslang, callback='yes', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """> <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Collection Management</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if ... | def removefield(req, colID, ln=cdslang, fldID='', fldvID='', fmeth='', callback='yes', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """> <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Collection Management</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_p... | |
'x_l_c': '</a>'} | 'x_url_close': '</a>'} | def tmpl_account_page(self, ln, weburl, accBody, baskets, alerts, searches, messages, groups, administrative): """ Displays the your account page |
out += "<p>" + (_("You seem to be %(x_role)s.") % ('<em>' + string.join(roles, ", ") + "</em> ")) + '</p>' | out += "<p>" + _("You seem to be %(x_role)s.") % {'x_role': ('<em>' + string.join(roles, ", ") + "</em> ")} + '</p>' | def tmpl_account_adminactivities(self, ln, weburl, uid, guest, roles, activities): """ Displays the admin activities block for this user |
g = Gnuplot.Gnuplot(debug=1) g.clear() | g = Gnuplot.Gnuplot() | def create_temporary_image(recid, kind_of_graphe, data_file, x_label, y_label, origin_tuple, y_max, docid_list, graphe_titles, intervals): """From a temporary file, draw a gnuplot graph The arguments are as follows: recid - reccord ID kind_of_graph - takes one of these values : "citation" ,"download_history",... |
g('set terminal png small') g('set output "%s/img/%s"' % (webdir, graphe_name)) | def create_temporary_image(recid, kind_of_graphe, data_file, x_label, y_label, origin_tuple, y_max, docid_list, graphe_titles, intervals): """From a temporary file, draw a gnuplot graph The arguments are as follows: recid - reccord ID kind_of_graph - takes one of these values : "citation" ,"download_history",... | |
g('set output "%s/img/%s"' % (webdir, graphe_name)) g('set terminal png small') | def create_temporary_image(recid, kind_of_graphe, data_file, x_label, y_label, origin_tuple, y_max, docid_list, graphe_titles, intervals): """From a temporary file, draw a gnuplot graph The arguments are as follows: recid - reccord ID kind_of_graph - takes one of these values : "citation" ,"download_history",... | |
out = out + oai_error("badArgument","Malformed request") | out = out + oai_error("badVerb","Illegal OAI verb") | def check_args(arguments): "Check OAI arguments" out = "" |
p1 = re.sub(r'(\w)[^a-zA-Z0-9](\w)', "\\1 \\2", p1) p2 = re.sub(r'(\w)[^a-zA-Z0-9](\w)', "\\1 \\2", p2) p3 = re.sub(r'(\w)[^a-zA-Z0-9](\w)', "\\1 \\2", p3) | if p1.startswith('"') and p1.endswith('"'): p1 = re.sub(r'(\w)[^a-zA-Z0-9](\w)', "\\1_\\2", p1) else: p1 = re.sub(r'(\w)[^a-zA-Z0-9](\w)', "\\1 \\2", p1) if p1.startswith('"') and p1.endswith('"'): p2 = re.sub(r'(\w)[^a-zA-Z0-9](\w)', "\\1_\\2", p2) else: p2 = re.sub(r'(\w)[^a-zA-Z0-9](\w)', "\\1 \\2", p2) if p3.starts... | def perform_request_search(req=None, cc=cdsname, c=None, p="", f="", rg="10", sf="", so="d", sp="", of="hb", ot="", as="0", p1="", f1="", m1="", op1="", p2="", f2="", m2="", op2="", p3="", f3="", m3="", sc="0", jrec="0", id="-1", idb="-1", sysnb="", search="SEARCH", d1y="", d1m="", d1d="", d2y="", d2m="", d2d=""): """P... |
p = re.sub(r'(\w)[^a-zA-Z0-9](\w)', "\\1 \\2", p) | if p.startswith('"') and p.endswith('"'): p = re.sub(r'(\w)[^a-zA-Z0-9](\w)', "\\1_\\2", p) else: p = re.sub(r'(\w)[^a-zA-Z0-9](\w)', "\\1 \\2", p) | def perform_request_search(req=None, cc=cdsname, c=None, p="", f="", rg="10", sf="", so="d", sp="", of="hb", ot="", as="0", p1="", f1="", m1="", op1="", p2="", f2="", m2="", op2="", p3="", f3="", m3="", sc="0", jrec="0", id="-1", idb="-1", sysnb="", search="SEARCH", d1y="", d1m="", d1d="", d2y="", d2m="", d2d=""): """P... |
query1 = """SELECT email, nickname, | query1 = """SELECT nickname, email, | def query_get_user_contact_info(uid): """ Get the user contact information @return tuple (nickname, email, last_login), if none found return () Note: for the moment, if no nickname, will return email address up to the '@' """ query1 = """SELECT email, nickname, DATE_FORMAT(last_login, '%%Y-%%m-%%d %%H:%%i:%%s') FROM us... |
if user_contact_info[1]: nickname = user_contact_info[1] | if user_contact_info[0]: nickname = user_contact_info[0] | def perform_request_add_comment_or_remark(recID=0, uid=-1, action='DISPLAY', ln=cdslang, msg=None, score=None, note=None, priority=None, reviews=0, comID=-1, client_ip_address=None): """ Add a comment/review or remark @param recID: record id @param uid: user id @param action: 'DISPLAY' to display add form 'SUBMIT' to ... |
print 'Error connecting to SMTP server, attempt %s retrying in 10 seconds.' % attempt sleep(10) | print 'Error connecting to SMTP server, attempt %s retrying in 5 minutes.' % attempt sleep(300) | def send_email(fromaddr, toaddr, body, attempt=0): global DEBUGLEVEL if attempt > 2: log('error sending email to %s: SMTP error; gave up after 3 attempts' % toaddr) return try: server = smtplib.SMTP('localhost') if DEBUGLEVEL > 2: server.set_debuglevel(1) else: server.set_debuglevel(0) server.sendmail(fromaddr, toad... |
msg += wrap('pattern: %s' % pattern) | if pattern: msg += wrap('pattern: %s' % pattern) | 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... |
log('query %08s produced %08s records' % (query[0], len(recs))) | n = len(recs) if n: log('query %08s produced %08s records' % (query[0], len(recs))) | def run_query(query, frequency): """Return a dictionary containing the information of the performed query. The information contains the id of the query, the arguments as a string, and the list of found records.""" time = localtime() # Override time here for testing purposes (beware of localtime offset): #time = (2002... |
out += perform_list_alerts(uid) | out += perform_list_alerts(uid, ln=ln) | def perform_remove_alert(alert_name, id_user, id_query, id_basket, uid, ln=cdslang): """perform_remove_alert: remove an alert from the database input: identifier of the user; identifier of the query; identifier of the basket output: confirmation message + the list of alerts Web page""" # set variables out = "" # remo... |
out += _("The alert %s has been successfully updated.") % "<b>" + alert_name + "</b>" out += "<br /><br />\n" + perform_list_alerts(uid) | out += _("The alert %s has been successfully updated.") % ("<b>" + alert_name + "</b>") out += "<br /><br />\n" + perform_list_alerts(uid, ln=ln) | def perform_update_alert(alert_name, frequency, notification, id_basket, id_query, old_id_basket,uid, ln = cdslang): """update alert settings into the database input: the name of the new alert; alert frequency: 'month', 'week' or 'day'; setting for e-mail notification: 'y' for yes, 'n' for no; new basket identifier: '... |
text=eval(arr3[9]) | co = compile(arr3[9].replace("\r\n","\n"),"<string>","exec") exec(co) | def interface(req,c=cdsname,ln=cdslang, doctype="", act="", startPg=1, indir="", access="",mainmenu="",fromdir="",file="",nextPg="",nbPg="",curpage=1): ln = wash_language(ln) sys.stdout = req # get user ID: try: uid = getUid(req) uid_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) # variabl... |
formfields = text.split(">") for formfield in formfields: match = re.search("name=([^ <>]+)",formfield,re.IGNORECASE) if match != None: names = match.groups() for value in names: if value != "": value = re.compile("[\"']+").sub("",value) select.append(0) radio.append(0) upload.append(0) field.append(value) level.append... | select.append(0) radio.append(0) upload.append(0) field.append(value) level.append(arr[5]) txt.append(arr[6]) level.append(arr[5]) fullDesc.append(arr[4]) txt.append(arr[6]) check.append(arr[7]) fieldhtml.append(text) nbFields = nbFields+1 | def interface(req,c=cdsname,ln=cdslang, doctype="", act="", startPg=1, indir="", access="",mainmenu="",fromdir="",file="",nextPg="",nbPg="",curpage=1): ln = wash_language(ln) sys.stdout = req # get user ID: try: uid = getUid(req) uid_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) # variabl... |
</form>""" | </form> <br> <br>""" | def endaction(req,c=cdsname,ln=cdslang, doctype="", act="", startPg=1, indir="", access="",mainmenu="",fromdir="",file="",nextPg="",nbPg="",curpage=1,step=1,mode="U"): global rn,sysno,dismode,curdir,uid,uid_email,lats_step,action_score dismode = mode ln = wash_language(ln) sys.stdout = req t="" # get user ID: try: uid ... |
elif not ("001" <= tag <=upper_bound): | elif not (("001" <= tag <= upper_bound) or \ tag in ('FMT', 'FFT')): | def wash(xmltext, parser=2): """ Check the structure of the xmltext. Returns a record structure and a list of errors. parser = 1 - 4_suite parser = 2 - pyRXP parser = 0 - minidom """ errors = [] i, e1 = tagclose('datafield', xmltext) j, e2 = tagclose('controlfield', xmltext) k, e3 = tagclose('subfield', xmltext) w, e4... |
get_textual_query_info_from_urlargs(row[1]),row[5],row[2],row[3],row[4],row[3],row[5],row[6],row[7],row[4],row[1]) | get_textual_query_info_from_urlargs(row[1]),row[5],row[2],row[3],row[4],row[3],row[5],row[6],row[7],row[4],weburl,row[1]) | def perform_list_alerts (uid): # set variables out = "" id_user = uid # XXX # link to the "add new alert" form out += """<P>Set a new alert from <A href="display">your searches</A>, """\ """the <A href="display?p='y'">most popular searches</A> or the input form.</P>""" # query the database SQL_query = "SELECT q.id, q.... |
level.append(arr[5]) | def interface(req,c=cdsname,ln=cdslang, doctype="", act="", startPg=1, indir="", access="",mainmenu="",fromdir="",file="",nextPg="",nbPg="",curpage=1): ln = wash_language(ln) sys.stdout = req # get user ID: try: uid = getUid(req) uid_email = get_email(uid) except MySQLdb.Error, e: return errorMsg(e.value,req) # variabl... | |
"<a href=\"%s/?cc=%s&as=%d&ln=%s\">%s</a></big></strong></td>\n" % \ | "<a href=\"%s/?c=%s&as=%d&ln=%s\">%s</a></big></strong></td>\n" % \ | def print_search_info(p, f, sf, so, sp, of, ot, collection=cdsname, nb_found=-1, jrec=1, rg=10, as=0, ln=cdslang, p1="", p2="", p3="", f1="", f2="", f3="", m1="", m2="", m3="", op1="", op2="", sc=1, pl_in_url="", d1y=0, d1m=0, d1d=0, d2y=0, d2m=0, d2d=0, cpu_time=-1, middle_only=0): """Prints stripe with the informatio... |
return (None, "Warning", "An error has occured") | return (None, "Warning, An error has occured (1)", "") | def find_similar(rank_method_code, recID, hitset, rank_limit_relevance=10,verbose=0): """Finding terms to use for calculating similarity. Terms are taken from the recid given, returns a list of recids's and relevance, [[23,34], [344,24], [1,01]] recID - record to use for find similar rank_limit_relevance - find all sim... |
return (None, "Warning", "An error has occured") | return (None, "Warning, An error has occured (2)", "") | def find_similar(rank_method_code, recID, hitset, rank_limit_relevance=10,verbose=0): """Finding terms to use for calculating similarity. Terms are taken from the recid given, returns a list of recids's and relevance, [[23,34], [344,24], [1,01]] recID - record to use for find similar rank_limit_relevance - find all sim... |
return (None, "Warning", "An error has occured") | return (None, "Warning, An error has occured (3)", "") | def find_similar(rank_method_code, recID, hitset, rank_limit_relevance=10,verbose=0): """Finding terms to use for calculating similarity. Terms are taken from the recid given, returns a list of recids's and relevance, [[23,34], [344,24], [1,01]] recID - record to use for find similar rank_limit_relevance - find all sim... |
return (None, "Warning", "An error has occured") | return (None, "Warning, An error has occured (4)", "") | def find_similar(rank_method_code, recID, hitset, rank_limit_relevance=10,verbose=0): """Finding terms to use for calculating similarity. Terms are taken from the recid given, returns a list of recids's and relevance, [[23,34], [344,24], [1,01]] recID - record to use for find similar rank_limit_relevance - find all sim... |
return (None, "Warning", "An error has occured") | return (None, "Warning, An error has occured (5)", "") | def rank_by_method(rank_method_code, lwords, hitset, rank_limit_relevance,verbose=0): """input: list of words, ['ellis', 'muon'] optional list of recIDs output: sorted list of recIDs based on rank method given, e.g. [[23,34], [344,24], [1,01]] if not possible, then return empty list""" rnkdict = run_sql("SELECT releva... |
return (None, "Warning", "An error has occured") | return (None, "Warning, An error has occured (6)", "") | def word_frequency(rank_method_code, lwords, hitset, rank_limit_relevance,verbose=0): """input: list of words, ['ellis', 'muon'] optional list of recIDs output: sorted list of recIDs by summary word frequencies, e.g. [[23,34], [344,24], [1,01]] if not possible (e.g. all stopwords), then return empty list""" startCreat... |
if options["recid_range"]: if options["cmd"] == "del": del_recids(cfg_short, options["recid_range"]) elif options["cmd"] == "add": func_object = globals().get(cfg_function) func_object(rank_method_code, cfg_name, config) elif options["cmd"] == "stat": rank_method_code_statistics(rank_method_code) elif options["cmd"] ==... | if options["cmd"] == "del": del_recids(cfg_short, options["recid_range"]) elif options["cmd"] == "add": func_object = globals().get(cfg_function) func_object(rank_method_code, cfg_name, config) elif options["cmd"] == "stat": rank_method_code_statistics(rank_method_code) elif options["cmd"] == "check": check_method(rank... | def bibrank_engine(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. """ try: import psyco psyco.bind(single_tag_rank) psyco.bind(single_tag_rank_method_exec) psyco.bind(serialize_via_numeric_array)... |
tempdoc[key3] = ("", tempdoc[key3][1] + float(impacc[key])) | tempdoc[key3] = ("", int(tempdoc[key3][1] + float(impacc[key]))) | def accessimpact_exec(rank_method_code, name, config): """Generating rankset based on number of downloads per document""" startCreate = time.time() options["dbhost"] = config.get("accessimpact", "dbhost") options["dbname"] = config.get("accessimpact", "dbname") options["dbuser"] = config.get("accessimpact", "dbuser") ... |
tempdoc[key3] = ("", float(impacc[key])) | tempdoc[key3] = ("", int(impacc[key])) | def accessimpact_exec(rank_method_code, name, config): """Generating rankset based on number of downloads per document""" startCreate = time.time() options["dbhost"] = config.get("accessimpact", "dbhost") options["dbname"] = config.get("accessimpact", "dbname") options["dbuser"] = config.get("accessimpact", "dbuser") ... |
if nb_found > rg: | if jrec+rg-1 < nb_found: | def print_search_info(p, f, sf, so, sp, of, ot, collection=cdsname, nb_found=-1, jrec=1, rg=10, as=0, ln=cdslang, p1="", p2="", p3="", f1="", f2="", f3="", m1="", m2="", m3="", op1="", op2="", d1y=0, d1m=0, d1d=0, d2y=0, d2m=0, d2d=0, cpu_time=-1, middle_only=0): """Prints stripe with the information on 'collection' an... |
query_result = run_sql("SELECT br.id_record,br.nb_order, fmt.value "\ "FROM basket_record br, bibfmt fmt "\ "WHERE br.id_basket=%s AND br.id_record=fmt.id_bibrec AND fmt.format='hb'"\ | query_result = run_sql("SELECT br.id_record,br.nb_order "\ "FROM basket_record br "\ "WHERE br.id_basket=%s "\ | def display_basket_content(uid, id_basket, basket_name): out = "" out_tmp="" # search for basket's items if (id_basket != '0') and (id_basket != 0): query_result = run_sql("SELECT br.id_record,br.nb_order, fmt.value "\ "FROM basket_record br, bibfmt fmt "\ "WHERE br.id_basket=%s AND br.id_record=fmt.id_bibrec AND fmt... |
preabstract = row[2] | preabstract = print_record(row[0], "hb") | def display_basket_content(uid, id_basket, basket_name): out = "" out_tmp="" # search for basket's items if (id_basket != '0') and (id_basket != 0): query_result = run_sql("SELECT br.id_record,br.nb_order, fmt.value "\ "FROM basket_record br, bibfmt fmt "\ "WHERE br.id_basket=%s AND br.id_record=fmt.id_bibrec AND fmt... |
% (imagesurl,zlib.decompress(preabstract)) | % (imagesurl,preabstract) | def display_basket_content(uid, id_basket, basket_name): out = "" out_tmp="" # search for basket's items if (id_basket != '0') and (id_basket != 0): query_result = run_sql("SELECT br.id_record,br.nb_order, fmt.value "\ "FROM basket_record br, bibfmt fmt "\ "WHERE br.id_basket=%s AND br.id_record=fmt.id_bibrec AND fmt... |
query_result = run_sql("SELECT br.id_record,br.nb_order, fmt.value "\ "FROM basket_record br, bibfmt fmt "\ "WHERE br.id_basket=%s AND br.id_record=fmt.id_bibrec AND fmt.format='hb'"\ | query_result = run_sql("SELECT br.id_record,br.nb_order "\ "FROM basket_record br "\ "WHERE br.id_basket=%s "\ | def perform_display_public(uid, id_basket, basket_name, action, to_basket, mark, newname): out = "" if action=="EXECUTE": # perform actions if newname != "": # create a new basket to_basket = perform_create_basket(uid, newname) out += """The <I>private</I> basket <B>%s</B> has been created.<BR>\n""" % newname # copy th... |
preabstract = row[2] | preabstract = print_record(row[0], "hb") | def perform_display_public(uid, id_basket, basket_name, action, to_basket, mark, newname): out = "" if action=="EXECUTE": # perform actions if newname != "": # create a new basket to_basket = perform_create_basket(uid, newname) out += """The <I>private</I> basket <B>%s</B> has been created.<BR>\n""" % newname # copy th... |
def account_list_alerts(uid, action="", id_alert=0, id_basket=0,newname=""): out = "" | def account_list_alerts(uid, action="", id_alert=0, id_basket=0,old_id_basket=0,newname=""): i=0 out = "" options = "" | def account_list_alerts(uid, action="", id_alert=0, id_basket=0,newname=""): # set variables out = "" id_user = uid # XXX SQL_query = "SELECT distinct a.alert_name FROM query q, user_query_basket a, basket b "\ "WHERE a.id_user='%s' "\ "AND a.id_query=q.id "\ "ORDER BY a.alert_name ASC " % id_user query_result = run_... |
SQL_query = "SELECT distinct a.alert_name FROM query q, user_query_basket a, basket b "\ "WHERE a.id_user='%s' "\ "AND a.id_query=q.id "\ "ORDER BY a.alert_name ASC " % id_user | list=[] SQL_query = """ SELECT q.id, q.urlargs, a.id_user, a.id_query, a.id_basket, a.alert_name, a.frequency, a.notification, DATE_FORMAT(a.date_creation,'%%d %%b %%Y'), DATE_FORMAT(a.date_lastrun,'%%d %%b %%Y'), a.id_basket FROM query q, user_query_basket a WHERE a.id_user='%s' AND a.id_query=q.id ORDER BY a.alert_na... | def account_list_alerts(uid, action="", id_alert=0, id_basket=0,newname=""): # set variables out = "" id_user = uid # XXX SQL_query = "SELECT distinct a.alert_name FROM query q, user_query_basket a, basket b "\ "WHERE a.id_user='%s' "\ "AND a.id_query=q.id "\ "ORDER BY a.alert_name ASC " % id_user query_result = run_... |
out += """<FORM name="displayalert" action="../youralerts.py/list" method="post">""" | if len(query_result) > 0: for row in query_result : i+=1 list += ["""<A href="../youralerts.py/modify?idq=%d&name=%s&freq=%s¬if=%s&idb=%d&old_idb=%d">%s</A> """%(row[0],row[5],row[6],row[7],id_basket,old_id_basket,row[5])] options += """<OPTION value=%d>%s</OPTION>""" % (i,row[5]) | def account_list_alerts(uid, action="", id_alert=0, id_basket=0,newname=""): # set variables out = "" id_user = uid # XXX SQL_query = "SELECT distinct a.alert_name FROM query q, user_query_basket a, basket b "\ "WHERE a.id_user='%s' "\ "AND a.id_query=q.id "\ "ORDER BY a.alert_name ASC " % id_user query_result = run_... |
out += """<SELECT name="id_alert"><OPTION value="0">- alert name -</OPTION>""" for row in query_result : if len(query_result)>0: alert_selected = " selected" alert_name = row[0] else: alert_selected = "" out += """<OPTION>%s</OPTION>""" % (row[0]) out += """</SELECT>\n""" out += """ <CODE class="blocknote">"""\ ""... | for l in range(0,i): out +="" out+=list[l] | def account_list_alerts(uid, action="", id_alert=0, id_basket=0,newname=""): # set variables out = "" id_user = uid # XXX SQL_query = "SELECT distinct a.alert_name FROM query q, user_query_basket a, basket b "\ "WHERE a.id_user='%s' "\ "AND a.id_query=q.id "\ "ORDER BY a.alert_name ASC " % id_user query_result = run_... |
content_type = get_output_format_content_type(of) | def page_start(req, of, cc, as, ln, uid, title_message=None, description='', keywords=''): "Start page according to given output format." _ = gettext_set_language(ln) if not title_message: title_message = _("Search Results") if not req: return # we were called from CLI #req.content_type = get_output_format_content_... | |
elif req.content_type == 'text/html': | elif content_type == 'text/html': | def page_start(req, of, cc, as, ln, uid, title_message=None, description='', keywords=''): "Start page according to given output format." _ = gettext_set_language(ln) if not title_message: title_message = _("Search Results") if not req: return # we were called from CLI #req.content_type = get_output_format_content_... |
req.content_type = "text/html" | def page_start(req, of, cc, as, ln, uid, title_message=None, description='', keywords=''): "Start page according to given output format." _ = gettext_set_language(ln) if not title_message: title_message = _("Search Results") if not req: return # we were called from CLI #req.content_type = get_output_format_content_... | |
return unittest.TestSuite((unittest.makeSuite(SanityTest,'test'), unittest.makeSuite(SuccessTest,'test'), unittest.makeSuite(BadInputTreatmentTest,'test'), unittest.makeSuite(GettingFieldValuesTest,'test'), unittest.makeSuite(AddFieldTest,'test'), unittest.makeSuite(DeleteFieldTest,'test'), unittest.makeSuite(AccentedU... | return unittest.TestSuite((unittest.makeSuite(SanityTest, 'test'), unittest.makeSuite(SuccessTest, 'test'), unittest.makeSuite(BadInputTreatmentTest, 'test'), unittest.makeSuite(GettingFieldValuesTest, 'test'), unittest.makeSuite(GettingFieldValuesViaWildcardsTest, 'test'), unittest.makeSuite(AddFieldTest, 'test'), uni... | def create_test_suite(): """Return test suite for the bibrecord module""" return unittest.TestSuite((unittest.makeSuite(SanityTest,'test'), unittest.makeSuite(SuccessTest,'test'), unittest.makeSuite(BadInputTreatmentTest,'test'), unittest.makeSuite(GettingFieldValuesTest,'test'), unittest.makeSuite(AddFieldTest,'test')... |
SQL_queryguest = "insert into user (email) values ('')" query_result = run_sql(SQL_queryguest) | query_result = run_sql("insert into user (email) values ('')") | def create_GuestUser(): """Create a guest user , insert into user null values in all fields create_GuestUser() -> GuestUserID """ SQL_queryguest = "insert into user (email) values ('')" query_result = run_sql(SQL_queryguest) return query_result |
SQL_queryguest = "select email from user where id='%s' "%(uid) query_result = run_sql(SQL_queryguest)[0][0] | query_result = run_sql("select email from user where id=%s", (uid,))[0][0] | def isGuestUser(uid): """It Checks if the userId corresponds to a guestUser or not isGuestUser(uid) -> boolean """ if uid==-1: return 1 SQL_queryguest = "select email from user where id='%s' "%(uid) query_result = run_sql(SQL_queryguest)[0][0] if query_result == '': return 1 return 0 |
SQL_queryRe = "select email,password from user where email='%s'"%user query_result = run_sql(SQL_queryRe) | query_result = run_sql("select email,password from user where email=%s", (user,)) | def checkRegister(user,passw): """It checks if the user is register with the correct password checkRegister(user,passw) -> boolean """ SQL_queryRe = "select email,password from user where email='%s'"%user query_result = run_sql(SQL_queryRe) if len(query_result)> 0 : return 0 return 1 |
SQL_Data = "select email, password from user where id=%s"%uid query_result = run_sql(SQL_Data) | query_result = run_sql("select email, password from user where id=%s", (uid,)) | def getDataUid(request,uid): """It takes the email and password from a given userId, from the MySQL database, if don't exist it just returns guest values for email and password getDataUid(request,uid) -> [email,password] """ email = 'guest' password = 'none' SQL_Data = "select email, password from user where id=%s"... |
SQL_queryregister = "insert into user (email, password) values ('%s','%s') "%(user,passw) query_result = run_sql(SQL_queryregister) | query_result = run_sql("insert into user (email, password) values (%s,%s)", (user,passw)) | def registerUser(request,user,passw): """It registers the user, inserting into the user table of MySQL database, the email and the pasword of the user. It returns true if the insertion is done registerUser(request,user,passw) -> boolean """ if checkRegister(user,passw) and checkemail(user): SQL_queryregister = "insert... |
SQL_update ="update user set email ='%s',password='%s' where id = %s "%(email,password,uid) query_result = run_sql(SQL_update) | query_result = run_sql("update user set email=%s,password=%s where id=%s", (email,password,uid)) | def updateDataUser(req,uid,email,password): """It updates the data from the user. It is used when a user set his email and password """ if email =='guest': return 0 SQL_update ="update user set email ='%s',password='%s' where id = %s "%(email,password,uid) query_result = run_sql(SQL_update) |
SQL_query = "SELECT id from user where email ='%s' and password='%s'" %(p_email,p_pw) query_result = run_sql(SQL_query) | query_result = run_sql("SELECT id from user where email=%s and password=%s", (p_email,p_pw)) | def loginUser(p_email,p_pw): """It is a first simple version for the authentication of user. It returns the id of the user, for checking afterwards if the login is correct """ SQL_query = "SELECT id from user where email ='%s' and password='%s'" %(p_email,p_pw) query_result = run_sql(SQL_query) return query_result |
SQL_query= "select email from user where email ='%s'"%p_email query_result = yourgoodies.run_sql(SQL_query) | query_result = run_sql("select email from user where email=%s", (p_email,)) | def userNotExist(p_email,p_pw): """Check if the user exits or not in the system """ SQL_query= "select email from user where email ='%s'"%p_email query_result = yourgoodies.run_sql(SQL_query) if len(query_result)>0 and query_result[0]!='': return 0 return 1 |
SQL_select = "select id from user where email = '%s' and password='%s'"%(p_email,p_pw) query_ID = int(run_sql(SQL_select)[0][0]) | query_ID = int(run_sql("select id from user where email=%s and password=%s", (p_email,p_pw))[0][0]) | def update_Uid(req,p_email,p_pw,uid): """It updates the userId of the session. It is used when a guest user is logged in succesfully in the system with a given email and password """ ## clean the guest user line which id = uid, previously inserted as guest user SQL_select = "select id from user where email = '%s' and p... |
filename = "%s/RTdata/%s" % (logdir, arg['resumptionToken']) | filename = "%s/%s" % (logdir, arg['resumptionToken']) | def OAIListRecords(args): "Generates response to OAIListRecords verb." |
out = out + oai_error("noRecordsMatch","no records correspond to the request") | out = out + oai_error("noRecordsMatch","no_ records correspond to the request") | def OAIListRecords(args): "Generates response to OAIListRecords verb." |
filename = "%s/RTdata/%s" % (logdir, arg['resumptionToken']) | filename = "%s/%s" % (logdir, arg['resumptionToken']) | def OAIListIdentifiers(args): "Prints OAI response to the ListIdentifiers verb." |
out = "%s <setSpec>%s</setSpec>\n" % (out, arg['set']) | out = "%s <setSpec>%s</setSpec>\n" % (out, set) | def OAIListIdentifiers(args): "Prints OAI response to the ListIdentifiers verb." |
filename = "%s/RTdata/%s" % (logdir, resumptionToken) | filename = "%s/%s" % (logdir, resumptionToken) | def OAICacheIn(resumptionToken, sysnos): "Stores or adds sysnos in cache. Input is a string of sysnos separated by commas." filename = "%s/RTdata/%s" % (logdir, resumptionToken) fil = open(filename,"w") cPickle.dump(sysnos,fil) fil.close() return 1 |
filename = "%s/RTdata/%s" % (logdir, resumptionToken) | filename = "%s/%s" % (logdir, resumptionToken) | def OAICacheOut(resumptionToken): "Restores string of comma-separated system numbers from cache." sysnos = [] filename = "%s/RTdata/%s" % (logdir, resumptionToken) if OAICacheStatus(resumptionToken): fil = open(filename,"r") sysnos = cPickle.load(fil) fil.close() else: return 0 return sysnos |
directory = "%s/RTdata" % logdir | directory = "%s" % logdir | def OAICacheClean(): "Removes cached resumptionTokens older than specified" |
filename = "%s/RTdata/%s" % (logdir, resumptionToken) | filename = "%s/%s" % (logdir, resumptionToken) | def OAICacheStatus(resumptionToken): "Checks cache status. Returns 0 for empty, 1 for full." filename = "%s/RTdata/%s" % (logdir, resumptionToken) if os.path.exists(filename): if os.path.getsize(filename) > 0: return 1 else: return 0 else: return 0 |
citation_dic = loads(decompress(compressed_citation_weight_dic[0][0])) for id in citing_recids: tmp = [id, citation_dic[id]] result.append(tmp) | if compressed_citation_weight_dic and compressed_citation_weight_dic[0]: citation_dic = loads(decompress(compressed_citation_weight_dic[0][0])) for id in citing_recids: tmp = [id, citation_dic[id]] result.append(tmp) | def get_citing_recidrelevance(rank_method_code, citing_recids): """return a tuple of list ([recid,citation_weight],...) for all the record in citing_recids list """ result = [] query = "select relevance_data from rnkMETHODDATA, rnkMETHOD WHERE rnkMETHOD.id = rnkMETHODDATA.id_rnkMETHOD and rnkMETHOD.name = '%s'"% rank_m... |
citation_dic = loads(decompress(compressed_citation_dic[0][0])) | citation_dic = None if compressed_citation_dic and compressed_citation_dic[0]: citation_dic = loads(decompress(compressed_citation_dic[0][0])) | def init_cited_by_dictionary(): """return citation list dictionary from rnkCITATIONDATA """ query = "select citation_data from rnkCITATIONDATA" compressed_citation_dic = run_sql(query) citation_dic = loads(decompress(compressed_citation_dic[0][0])) return citation_dic |
ref_dic = loads(decompress(compressed_ref_dic[0][0])) | ref_dic = None if compressed_ref_dic and compressed_ref_dic[0]: ref_dic = loads(decompress(compressed_ref_dic[0][0])) | def init_reference_list_dictionary(): """return reference list dictionary from rnkCITATIONDATA """ query = "select citation_data_reversed from rnkCITATIONDATA" compressed_ref_dic = run_sql(query) ref_dic = loads(decompress(compressed_ref_dic[0][0])) return ref_dic |
<table border="0" cellspacing="1" cellpadding="1">""" % (msg_downloads_history[ln], user_analysis_text) | <table border="0" cellspacing="1" cellpadding="1">""" % (msg_downloads_history[ln], users_analysis_text) | def create_download_history_graph_and_box(id_bibrec, ln=cdslang): """Create graph with citation history for record ID_BIBREC (into a temporary file) and return HTML box refering to that image. Called by Detailed record pages. Notes: if id_bibrec=0 : its an oustide-stored document and it has no id_bibdoc --> only one li... |
SQL_query = "SELECT q.id, q.urlargs, a.id_user, a.id_query, a.id_basket, "\ "a.alert_name, a.frequency, a.notification, "\ "DATE_FORMAT(a.date_creation,'%%d %%b %%Y'), DATE_FORMAT(a.date_lastrun,'%%d %%b %%Y'), "\ "b.id, b.name "\ "FROM query q, user_query_basket a, basket b "\ "WHERE a.id_user='%s' "\ "AND a.id_query=... | SQL_query = """ SELECT q.id, q.urlargs, a.id_user, a.id_query, a.id_basket, a.alert_name, a.frequency, a.notification, DATE_FORMAT(a.date_creation,'%%d %%b %%Y'), DATE_FORMAT(a.date_lastrun,'%%d %%b %%Y'), a.id_basket FROM query q, user_query_basket a WHERE a.id_user='%s' AND a.id_query=q.id ORDER BY a.alert_name ASC "... | def perform_list_alerts (uid): # set variables out = "" id_user = uid # XXX # link to the "add new alert" form out += """<P>Set a new alert from <A href="display">your searches</A>, """\ """the <A href="display?p='y'">most popular searches</A> or the input form.</P>""" # query the database SQL_query = "SELECT q.id, q.... |
if row[11] =="": | if int(row[10])==0: | def perform_list_alerts (uid): # set variables out = "" id_user = uid # XXX # link to the "add new alert" form out += """<P>Set a new alert from <A href="display">your searches</A>, """\ """the <A href="display?p='y'">most popular searches</A> or the input form.</P>""" # query the database SQL_query = "SELECT q.id, q.... |
basket_name=row[11] | sql = "select name from basket where id=%s"%row[10] query_result = run_sql(sql) basket_name=query_result[0][0] | def perform_list_alerts (uid): # set variables out = "" id_user = uid # XXX # link to the "add new alert" form out += """<P>Set a new alert from <A href="display">your searches</A>, """\ """the <A href="display?p='y'">most popular searches</A> or the input form.</P>""" # query the database SQL_query = "SELECT q.id, q.... |
i = len(reclist) - 31 | i = len(reclist) - 30 | def find_similar(rank_method_code, recID, lrecIDs, rank_limit_relevance=10,verbose=0): """Finding terms to use for calculating similarity. Terms are taken from the recid given, returns a list of recids's and relevance, [[23,34], [344,24], [1,01]] recID - record to use for find similar rank_limit_relevance - find all si... |
return reclist[i + 1:len(reclist)] | return (reclist[i:len(reclist)], "(", "%)") | def find_similar(rank_method_code, recID, lrecIDs, rank_limit_relevance=10,verbose=0): """Finding terms to use for calculating similarity. Terms are taken from the recid given, returns a list of recids's and relevance, [[23,34], [344,24], [1,01]] recID - record to use for find similar rank_limit_relevance - find all si... |
out += "%(sys)s" % { 'sys' : line[0][1] } | out += "%(sys)s\n" % { 'sys' : line[0][1] } | def print_field(field_lines, alephmarc=0): """Create the lines of a record relating to a given field, and return these lines as a string. @param field_lines: A list of lists, whereby each item in the top-level list is an instance of a field (e.g. a "datafield" or "controlfield"). @param alephmarc: an integer flag to te... |
sys.stderr.write("""Error: Unable to create a ALEPH MARC to manipulate a record for which SYS is unknown! """\ | sys.stderr.write("""Error: Unable to create ALEPH MARC to manipulate a record for which SYS is unknown! """\ | def recxml2recmarc(xmltext, options): """The function that processes creating the records from an XML string, and prints these records to the standard output stream. @param xmltext: An XML MARC record in string form. @param options: Various options about the record to be created, as passed from the command line. @retur... |
def add_date(self, date): if not date: | def add_recIDs_by_date(self, dates): """Add records that were modified between DATES[0] and DATES[1]. If DATES is not set, then add records that were modified since the last update of the index. """ 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: id = self.tablename[-3:-1] query = """SELECT last_updated FROM idxINDEX WHERE id='%s' """ % id res = run_sql(query) if not res: return if not res[0][0]: date = "0000-00... |
date = "0000-00-00" | dates = ("0000-00-00", None) | 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: id = self.tablename[-3:-1] query = """SELECT last_updated FROM idxINDEX WHERE id='%s' """ % id res = run_sql(query) if not res: return if not res[0][0]: date = "0000-00... |
date = res[0][0] query = """SELECT b.id FROM bibrec AS b WHERE b.modification_date >= '%s' ORDER BY b.id ASC""" % date res = run_sql(query) | dates = (res[0][0], None) if dates[1] is None: res = run_sql("""SELECT b.id FROM bibrec AS b WHERE b.modification_date >= %s ORDER BY b.id ASC""", (dates[0],)) elif dates[0] is None: res = run_sql("""SELECT b.id FROM bibrec AS b WHERE b.modification_date <= %s ORDER BY b.id ASC""", (dates[1],)) else: res = run_sql("""S... | 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: id = self.tablename[-3:-1] query = """SELECT last_updated FROM idxINDEX WHERE id='%s' """ % id res = run_sql(query) if not res: return if not res[0][0]: date = "0000-00... |
wordTable.add_date(options["modified"]) | wordTable.add_recIDs_by_date(options["modified"]) | def task_run(row): """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. """ global options, task_id, wordTables, stemmer, stopwords # read from SQL row: task_id = row[0] task_proc = row[1] options = loads(row[6... |
month = get_i18n_month_name(datestruct[1], ln=ln) output_format = "%02d " + month + " %04Y, %02H:%02M" return strftime(output_format, datestruct) | if datestruct[0] and datestruct[1] and datestruct[2]: month = get_i18n_month_name(datestruct[1], ln=ln) output_format = "%02d " + month + " %04Y, %02H:%02M" return strftime(output_format, datestruct) else: raise ValueError | def convert_datestruct_to_dategui(datestruct, ln=cdslang): """ Convert: (2005, 11, 16, 15, 11, 44, 2, 320, 0) => '16 nov 2005, 15:11' Month is internationalized """ try: month = get_i18n_month_name(datestruct[1], ln=ln) output_format = "%02d " + month + " %04Y, %02H:%02M" return strftime(output_format, datestruct) exce... |
elements = self.buffer.split("<p class=g>") | elements = self.buffer.split("<div class=g>") | def parse(self): """Parse buffer to extract records.""" elements = self.buffer.split("<p class=g>") if len(elements) <= 1: return |
elements = self.buffer.split('<table><tr><td class="covertd">') | elements = self.buffer.split('<table class=rsi><tr><td class="covertd">') | def parse(self): """Parse buffer to extract records.""" elements = self.buffer.split('<table><tr><td class="covertd">') if len(elements) <= 1: return |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.