rem
stringlengths
0
322k
add
stringlengths
0
2.05M
context
stringlengths
8
228k
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def modifyrestricted(req, colID, ln=cdslang, rest='', confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if not wsc.check_user(u...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def modifytranslations(req, colID, ln=cdslang, sel_type='', trans = [], confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if no...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def addcollectiontotree(req, colID, ln=cdslang, add_dad='', add_son='', rtype='', mtype='', callback='yes', confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Err...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def addcollection(req, colID, ln=cdslang, colNAME='', dbquery='', rest='', callback="yes", confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return err...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def modifyrankmethods(req, colID, ln=cdslang, func='', rnkID='', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if not wsc.ch...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def deletecollection(req, colID, ln=cdslang, confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if not wsc.check_user(uid): retu...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def editcollection(req, colID=1, ln=cdslang, mtype=''): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if not wsc.check_user(uid): return...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def addoutputformat(req, colID, ln=cdslang, code='', name='', callback='yes', confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) ...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def showoutputformats(req, colID, ln=cdslang, callback='yes', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if not wsc.check...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def addexistingoutputformat(req, colID, ln=cdslang, fmtID=-1, callback='yes', confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) ...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def deleteoutputformat(req, colID, ln=cdslang, fmtID=-1, callback='yes', confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if n...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def removeoutputformat(req, colID, ln=cdslang, fmtID='', callback='yes', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if no...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def removefield(req, colID, ln=cdslang, fldID='', fldvID='', fmeth='', callback='yes', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_pa...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def modifyoutputformat(req, colID, ln=cdslang, fmtID=-1, sel_type='', trans=[], confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def showsearchoptions(req, colID, ln=cdslang, callback='yes', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if not wsc.check...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def addexistingfield(req, colID, ln=cdslang, fldID=-1, fldvID=-1, fmeth='', callback='yes', confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return er...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def showsearchfields(req, colID, ln=cdslang, callback='yes', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if not wsc.check_...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def showsortoptions(req, colID, ln=cdslang, callback='yes', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if not wsc.check_u...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def modifyportalbox(req, colID, ln=cdslang, pbxID=-1, score='', position='', sel_ln='', title='', body='', callback='yes', confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) exc...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def removeportalbox(req, colID, ln=cdslang, pbxID='', sel_ln='', callback='yes', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def addexistingportalbox(req, colID, ln=cdslang, pbxID=-1, score=0, position='', sel_ln='', callback='yes', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Erro...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def deleteportalbox(req, colID, ln=cdslang, pbxID=-1, callback='yes', confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if not...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def showportalboxes(req, colID, ln=cdslang, callback='yes', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if not wsc.check...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def addportalbox(req, colID, ln=cdslang, title='', body='', callback='yes', confirm=-1): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) i...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def modifycollectiontree(req, colID, ln=cdslang, move_up='', move_down='', move_from='', move_to='', delete='', rtype='', callback='yes', confirm=0): navtrail_previous_links = wsc.getnavtrail() + """&gt; <a class=navtrail href="%s/admin/websearch/websearchadmin.py/">Edit Collection Tree</a> """ % (weburl) try: uid = g...
if not wsc.check_user(uid):
if not wsc.check_user(uid, 'cfgwebsearch'):
def index(req, colID=1, ln=cdslang, mtype='', content='', confirm=0): navtrail_previous_links = wsc.getnavtrail() try: uid = getUid(req) except MySQLdb.Error, e: return error_page(req) if not wsc.check_user(uid): return page(title="Edit Collection Tree", body=wsc.perform_index(colID=colID, ln=ln, mtype=mtype, content...
def perform_ask():
def perform_ask(referer=''):
def perform_ask(): text = """ <p>If you already have an account, please log in by choosing the <strong class=headline>login </strong> button below. <br>If you don't own an account yet, please enter the values of your preference and choose the <strong class=headline>register</strong> button. <form method="post" action=...
<input type="hidden" name="referer" value="%s">
def perform_ask(): text = """ <p>If you already have an account, please log in by choosing the <strong class=headline>login </strong> button below. <br>If you don't own an account yet, please enter the values of your preference and choose the <strong class=headline>register</strong> button. <form method="post" action=...
<p><strong>Note:</strong> It is not recommended to use valuable passwords as CERN AFS or NICE accounts with this service. Your email address will stay strictly confidential and will not be disclosed to any third party. It will be used to identify you in the CERN Document Server personal services. For example, you may s...
<p><strong>Note:</strong> Please do not use valuable passwords such as your Unix, AFS or NICE passwords with this service. Your email address will stay strictly confidential and will not be disclosed to any third party. It will be used to identify you for personal services of %s. For example, you may set up an automati...
def perform_ask(): text = """ <p>If you already have an account, please log in by choosing the <strong class=headline>login </strong> button below. <br>If you don't own an account yet, please enter the values of your preference and choose the <strong class=headline>register</strong> button. <form method="post" action=...
"""
""" % (cgi.escape(referer), cdsname)
def perform_ask(): text = """ <p>If you already have an account, please log in by choosing the <strong class=headline>login </strong> button below. <br>If you don't own an account yet, please enter the values of your preference and choose the <strong class=headline>register</strong> button. <form method="post" action=...
You are not longer recognized. If you wish you can login here <A href="./login">here</A>.
You are no longer recognized. If you wish you can <A href="./login">login here</A>.
def perform_logout(req): out ="" out+=""" You are not longer recognized. If you wish you can login here <A href="./login">here</A>. """ return out
ipp = "INET_ATON('%s');" % addressIp return run_sql("insert into rnkDOWNLOADS (date,recid,docid,userIp,noVersion,file_Format) values(NOW(),%s,%s,%s,%s,%s)", (self.recid,self.id,ipp,version,string.upper(format),))
return run_sql("INSERT INTO rnkDOWNLOADS (id_bibrec,id_bibdoc,file_version,file_format,id_user,client_host,download_time) VALUES (%s,%s,%s,%s,%s,INET_ATON(%s),NOW())", (self.recid,self.id,version,string.upper(format),userid,addressIp,))
def registerDownload(self,addressIp,version,format,userid=0): ipp = "INET_ATON('%s');" % addressIp return run_sql("insert into rnkDOWNLOADS (date,recid,docid,userIp,noVersion,file_Format) values(NOW(),%s,%s,%s,%s,%s)", (self.recid,self.id,ipp,version,string.upper(format),))
{'x_collection': string.join(colls, ','),
{'x_collection': '<em>' + string.join([get_coll_i18nname(coll, ln) for coll in colls], ', ') + '</em>',
def intersect_results_with_collrecs(req, hitset_in_any_collection, colls, ap=0, of="hb", verbose=0, ln=cdslang): """Return dict of hitsets given by intersection of hitset with the collection universes.""" _ = gettext_set_language(ln) # search stage 4: intersect with the collection universe: if verbose and of.startswit...
values = value.split("[\n\r]+")
values = re.split("[\n\r]+",value)
def Create_Modify_Interface(parameters,curdir,form): global sysno,rn t="" # variables declaration fieldname = parameters['fieldnameMBI'] # Path of file containing fields to modify if os.path.exists("%s/%s" % (curdir,fieldname)): fp = open( "%s/%s" % (curdir,fieldname), "r" ) fieldstext = fp.read() fp.close() else: rais...
text += "el = document.forms[0].elements['%s%s'];" % (field,multipletext) text += """ max = el.length;\n"""
text += "el = document.forms[0].elements['%s%s'];\n" % (field,multipletext) text += "max = el.length;\n"
def Create_Modify_Interface(parameters,curdir,form): global sysno,rn t="" # variables declaration fieldname = parameters['fieldnameMBI'] # Path of file containing fields to modify if os.path.exists("%s/%s" % (curdir,fieldname)): fp = open( "%s/%s" % (curdir,fieldname), "r" ) fieldstext = fp.read() fp.close() else: rais...
if len(res)>>0:
if len(res)>0:
def get_next_schedule(): """Returns the next scheduled oaiharvestrun tasks""" try: sql = "select runtime,status from schTASK where proc='oaiharvest' and runtime > now() ORDER by runtime limit 1" res = run_sql(sql) if len(res)>>0: return res[0] else: return ("", "") except StandardError, e: return ("","")
if int(grepOUT2) >> 0:
if int(grepOUT2) > 0:
def validate(oai_src_baseurl): """This function validates a baseURL by opening its URL and 'greping' for the <OAI-PMH> and <Identify> tags: 0 = okay 1 = baseURL non existing """ try: url = oai_src_baseurl + "?verb=Identify" urllib.urlretrieve(url, tmppath) # First check if we have xml oai-pmh output grepOUT1 = os.pope...
def tmpl_search_box(self, ln, weburl, as, cc, cc_intl, ot, sp, action, fieldslist, f1, f2, f3, m1, m2, m3, p1, p2, p3, op1, op2, rm, p, f, coll_selects, d1y, d2y, d1m, d2m, d1d, d2d, sort_formats, sf, so, ranks, sc, rg, formats, of):
def tmpl_search_box(self, ln, weburl, as, cc, cc_intl, ot, sp, action, fieldslist, f1, f2, f3, m1, m2, m3, p1, p2, p3, op1, op2, rm, p, f, coll_selects, d1y, d2y, d1m, d2m, d1d, d2d, sort_formats, sf, so, ranks, sc, rg, formats, of, pl):
def tmpl_search_box(self, ln, weburl, as, cc, cc_intl, ot, sp, action, fieldslist, f1, f2, f3, m1, m2, m3, p1, p2, p3, op1, op2, rm, p, f, coll_selects, d1y, d2y, d1m, d2m, d1d, d2d, sort_formats, sf, so, ranks, sc, rg, formats, of): """ Displays the *Nearest search terms* box
if action != _("Browse") and p1:
if action != _("Browse") and pl:
def tmpl_search_box(self, ln, weburl, as, cc, cc_intl, ot, sp, action, fieldslist, f1, f2, f3, m1, m2, m3, p1, p2, p3, op1, op2, rm, p, f, coll_selects, d1y, d2y, d1m, d2m, d1d, d2d, sort_formats, sf, so, ranks, sc, rg, formats, of): """ Displays the *Nearest search terms* box
Limit to:
%(limitto)s:
def tmpl_search_box(self, ln, weburl, as, cc, cc_intl, ot, sp, action, fieldslist, f1, f2, f3, m1, m2, m3, p1, p2, p3, op1, op2, rm, p, f, coll_selects, d1y, d2y, d1m, d2m, d1d, d2d, sort_formats, sf, so, ranks, sc, rg, formats, of): """ Displays the *Nearest search terms* box
<input type="text" name="pl" size="%(sizepattern)d" value="%(p1)s">
<input type="text" name="pl" size="%(sizepattern)d" value="%(pl)s">
def tmpl_search_box(self, ln, weburl, as, cc, cc_intl, ot, sp, action, fieldslist, f1, f2, f3, m1, m2, m3, p1, p2, p3, op1, op2, rm, p, f, coll_selects, d1y, d2y, d1m, d2m, d1d, d2d, sort_formats, sf, so, ranks, sc, rg, formats, of): """ Displays the *Nearest search terms* box
'p1' : cgi.escape(p1, 1),
'pl' : cgi.escape(pl, 1),
def tmpl_search_box(self, ln, weburl, as, cc, cc_intl, ot, sp, action, fieldslist, f1, f2, f3, m1, m2, m3, p1, p2, p3, op1, op2, rm, p, f, coll_selects, d1y, d2y, d1m, d2m, d1d, d2d, sort_formats, sf, so, ranks, sc, rg, formats, of): """ Displays the *Nearest search terms* box
saved_mode = options['mode']
def task_run(task_id): """Runs the task by fetching arguments from the BibSched task queue. This is what BibSched will be invoking via daemon call. Return 1 in case of success and 0 in case of failure. """ global options, stat options = task_get_options(task_id) # get options from BibSched task table ## check task i...
options['mode'] = saved_mode
def task_run(task_id): """Runs the task by fetching arguments from the BibSched task queue. This is what BibSched will be invoking via daemon call. Return 1 in case of success and 0 in case of failure. """ global options, stat options = task_get_options(task_id) # get options from BibSched task table ## check task i...
if options['mode'] == 'insert':
if options['mode'] == 'insert' or \ (options['mode'] == 'replace_or_insert' and rec_id is None): insert_mode_p = True
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...
elif options['mode'] != 'insert' and options['mode'] != 'format' and options['stage_to_start_from'] != 5:
elif options['mode'] != 'insert' and options['mode'] != 'format' and options['stage_to_start_from'] != 5: insert_mode_p = False
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'] == 'insert' or options['mode'] == 'append':
if insert_mode_p or options['mode'] == 'append':
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['stage_to_start_from'] <= 5 and options['mode'] != 'insert' and options['notimechange'] == 0:
if options['stage_to_start_from'] <= 5 and \ options['notimechange'] == 0 and \ not insert_mode_p:
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...
write_message(" -Retrieve current localtime: DONE", verbose=2)
write_message(" -Retrieved current localtime: DONE", 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'] == 'insert':
if insert_mode_p:
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'] != 'insert': if options['mode'] != 'replace_or_insert':
if options['mode'] != 'insert' and \ 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...
else: options['mode'] = '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...
digit = tag[0:2] bx = "bib%sx" % digit bibx = "bibrec_bib%sx" % digit
digits = tag[0:2] try: intdigits = int(digits) if intdigits < 0 or intdigits > 99: raise ValueError except ValueError: return [] bx = "bib%sx" % digits bibx = "bibrec_bib%sx" % digits
def get_fieldvalues(recID, tag): """Return list of field values for field TAG inside record RECID.""" out = [] if tag == "001___": # we have asked for recID that is not stored in bibXXx tables out.append(str(recID)) else: # we are going to look inside bibXXx tables digit = tag[0:2] bx = "bib%sx" % digit bibx = "bibrec_...
InvenioWebSubmitAdminInsertFailed - raised if it was not possible to insert the row for the field
InvenioWebSubmitAdminWarningInsertFailed - raised if it was not possible to insert the row for the field
def insert_field_onto_submissionpage(doctype, action, pagenum, fieldname, fieldtext, fieldlevel, fieldshortdesc, fieldcheck): """Insert a field onto a given submission page, in the last position. @param doctype: (string) the unique ID of a document type @param action: (string) the unique ID of an action @param pagenum:...
raise InvenioWebSubmitAdminInsertFailed(msg)
raise InvenioWebSubmitAdminWarningInsertFailed(msg)
def insert_field_onto_submissionpage(doctype, action, pagenum, fieldname, fieldtext, fieldlevel, fieldshortdesc, fieldcheck): """Insert a field onto a given submission page, in the last position. @param doctype: (string) the unique ID of a document type @param action: (string) the unique ID of an action @param pagenum:...
InvenioWebSubmitAdminTooManyRows - when multiple rows found for field InvenioWebSubmitAdminNoRowsFound - when no rows found for field
InvenioWebSubmitAdminWarningTooManyRows - when multiple rows found for field InvenioWebSubmitAdminWarningNoRowsFound - when no rows found for field
def update_details_of_a_field_on_a_submissionpage(doctype, action, pagenum, fieldposn, fieldtext, fieldlevel, fieldshortdesc, fieldcheck): """Update the details of one field, as found at a given location on a given submission page. @param doctype: (string) unique ID for a document type @param action: (string) unique ID...
raise InvenioWebSubmitAdminTooManyRows(msg)
raise InvenioWebSubmitAdminWarningTooManyRows(msg)
def update_details_of_a_field_on_a_submissionpage(doctype, action, pagenum, fieldposn, fieldtext, fieldlevel, fieldshortdesc, fieldcheck): """Update the details of one field, as found at a given location on a given submission page. @param doctype: (string) unique ID for a document type @param action: (string) unique ID...
raise InvenioWebSubmitAdminNoRowsFound(msg)
raise InvenioWebSubmitAdminWarningNoRowsFound(msg)
def update_details_of_a_field_on_a_submissionpage(doctype, action, pagenum, fieldposn, fieldtext, fieldlevel, fieldshortdesc, fieldcheck): """Update the details of one field, as found at a given location on a given submission page. @param doctype: (string) unique ID for a document type @param action: (string) unique ID...
y = sre_unicode_a.sub("a", y) y = sre_unicode_ae.sub("ae", y) y = sre_unicode_e.sub("e", y) y = sre_unicode_i.sub("i", y) y = sre_unicode_o.sub("o", y) y = sre_unicode_u.sub("u", y) y = sre_unicode_y.sub("y", y) y = sre_unicode_c.sub("c", y) y = sre_unicode_n.sub("n", y)
y = sre_unicode_lowercase_a.sub("a", y) y = sre_unicode_lowercase_ae.sub("ae", y) y = sre_unicode_lowercase_e.sub("e", y) y = sre_unicode_lowercase_i.sub("i", y) y = sre_unicode_lowercase_o.sub("o", y) y = sre_unicode_lowercase_u.sub("u", y) y = sre_unicode_lowercase_y.sub("y", y) y = sre_unicode_lowercase_c.sub("c", y...
def strip_accents(x): """Strip accents in the input phrase X (assumed in UTF-8) by replacing accented characters with their unaccented cousins (e.g. é by e). Return such a stripped X.""" # convert input into Unicode string: try: y = unicode(x, "utf-8") except: return x # something went wrong, probably the input wasn't ...
'body' : body,
'body' : email_quoted_txt2html(body),
def tmpl_get_comment_with_ranking(self, ln, nickname, date_creation, body, nb_votes_total, nb_votes_yes, star_score, title, report_link=None): """ private function @param ln: language @param nickname: nickname @param date_creation: date comment was written @param body: comment body @param nb_votes_total: total number o...
text="<TEXTAREA name=\"%s\" rows=\"%s\" cols=\"%s\">%s</TEXTAREA>" % (field['name'],field['rows'],field['cols'],field['val'])
text="<textarea name=\"%s\" rows=\"%s\" cols=\"%s\">%s</textarea>" \ % (field['name'], field['rows'], field['cols'], cgi.escape(str(field['val']), 1))
def tmpl_submit_field(self, ln, field): """ Produces the HTML code for the specified field
text="<INPUT TYPE=file name=\"%s\" size=\"%s\" maxlength=\"%s\">" % (field['name'],field['size'], field['maxlength']);
text = """<input type="file" name="%s" size="%s"%s>""" \ % (field['name'], field['size'], "%s" \ % ((field['maxlength'] in (0, None) and " ") or (""" maxlength="%s\"""" % field['maxlength'])) )
def tmpl_submit_field(self, ln, field): """ Produces the HTML code for the specified field
text="<INPUT name=\"%s\" size=\"%s\" value=\"%s\" maxlength=\"%s\">" % (field['name'],field['size'],field['val'],field['maxlength'])
text = """<input type="text" name="%s" size="%s" value="%s"%s>""" \ % (field['name'], field['size'], field['val'], "%s" \ % ((field['maxlength'] in (0, None) and " ") or (""" maxlength="%s\"""" % field['maxlength'])) )
def tmpl_submit_field(self, ln, field): """ Produces the HTML code for the specified field
'text' : text,
'text' : re.escape(str(text)),
def tmpl_page_interface_js(self, ln, upload, field, fieldhtml, txt, check, level, curdir, values, select, radio, curpage, nbpages, images, returnto): """ Produces the javascript for validation and value filling for a submit interface page
def test_createRecordIdTest(self):
def test_create_record_id(self):
def test_createRecordIdTest(self): """bibupload - try to create a new record ID in the database""" rec_id = create_new_record() self.assertNotEqual(-1,rec_id)
self.assertNotEqual(-1,rec_id) def test_NoRetrieveRecordId(self):
self.assertNotEqual(-1, rec_id) def test_no_retrieve_record_id(self):
def test_createRecordIdTest(self): """bibupload - try to create a new record ID in the database""" rec_id = create_new_record() self.assertNotEqual(-1,rec_id)
self.assertEqual(None,rec_id) def test_insertCompletXmlMarcTest(self):
self.assertEqual(None, rec_id) def test_insert_complete_xmlmarc(self):
def test_NoRetrieveRecordId(self): """bibupload - in insert mode the input file should not contain record ID""" #Initialise the global variable options['mode'] = 'insert' # We create create the record out of the xml marc rec = xml_marc_to_records(self.test) # We call the function which should retrieve the record id rec...
options['verbose'] = 0
def test_insertCompletXmlMarcTest(self): """bibupload - insert complete MARCXML file""" #Initialise the global variable options['mode'] = 'insert' #options['verbose'] = 0 # We create create the record out of the xml marc rec = xml_marc_to_records(self.test) # We call the main function with the record as a parameter err...
error = bibupload(rec[0]) self.assertEqual(0,error)
info = bibupload(rec[0]) inserted_xml = print_record(int(info[1]),'xm') self.assertEqual(1, compare_xmlbuffers(inserted_xml, self.test))
def test_insertCompletXmlMarcTest(self): """bibupload - insert complete MARCXML file""" #Initialise the global variable options['mode'] = 'insert' #options['verbose'] = 0 # We create create the record out of the xml marc rec = xml_marc_to_records(self.test) # We call the main function with the record as a parameter err...
def test_RetrieveRecordId(self): """bibupload - in insert mode the input file should contain record ID"""
def setUp(self): """Initialise the xml marc variable""" self.test_controfield001 = """<record> <controlfield tag ="001">002</controlfield> <datafield tag ="100" ind1="" ind2=""> <subfield code="a">Simko, T</subfield> <subfield code="u">CERN</subfield> </datafield> </record>""" self.test_append = """<record> <datafield ...
def test_insertCompletXmlMarcTest(self): """bibupload - insert complete MARCXML file""" #Initialise the global variable options['mode'] = 'insert' #options['verbose'] = 0 # We create create the record out of the xml marc rec = xml_marc_to_records(self.test) # We call the main function with the record as a parameter err...
test = """<record> <controlfield tag ="001">001</controlfield> <datafield tag ="100" ind1="" ind2=""> <subfield code="a">Simko, T</subfield> <subfield code="u">CERN</subfield> </datafield> </record>""" rec = xml_marc_to_records(test)
options['verbose'] = 0 rec = xml_marc_to_records(self.test_controfield001)
def test_RetrieveRecordId(self): """bibupload - in insert mode the input file should contain record ID""" #Initialise the global variable options['mode'] = 'append' #Initialise the xml marc variable test = """<record> <controlfield tag ="001">001</controlfield> <datafield tag ="100" ind1="" ind2=""> <subfield code="a">...
self.assertNotEqual(None,rec_id) def test_appendCompletXmlMarcTest(self):
self.assertEqual('002', rec_id) def test_update_modification_record_date(self): """bibupload - check the update of the modification date""" options['mode'] = 'append' options['verbose'] = 0 rec = xml_marc_to_records(self.test_controfield001) rec_id = retrieve_rec_id(rec[0]) now = time.localtime() update_bibrec_mo...
def test_RetrieveRecordId(self): """bibupload - in insert mode the input file should contain record ID""" #Initialise the global variable options['mode'] = 'append' #Initialise the xml marc variable test = """<record> <controlfield tag ="001">001</controlfield> <datafield tag ="100" ind1="" ind2=""> <subfield code="a">...
rec_id = create_new_record() test = """<collection> <record> <controlfield tag ="001">"""+str(rec_id)+ """</controlfield> <datafield tag ="100" ind1="" ind2=""> <subfield code="a">Simko, T</subfield> <subfield code="u">CERN</subfield> </datafield> </record> </collection>""" rec = xml_marc_to_records(test) error = bi...
xml_with_controlfield = self.test_controfield001.replace('<controlfield tag ="001">002</controlfield>', '<controlfield tag ="001">'+str(info[1])+'</controlfield>') rec = xml_marc_to_records(xml_with_controlfield) info = bibupload(rec[0]) append_xml = print_record(int(info[1]),'xm') self.assertEqual(1, compare_xmlbu...
def test_appendCompletXmlMarcTest(self): """bibupload - append complete MARCXML file""" #Initialise the global variable options['mode'] = 'append' # Create a new record rec_id = create_new_record() #Initialise the xml marc we want to append test = """<collection> <record> <controlfield tag ="001">"""+str(rec_id)+ """</...
AppendModeTest)
AppendModeTest, CorrectModeTest, ReplaceModeTest, ReferencesModeTest)
def test_appendCompletXmlMarcTest(self): """bibupload - append complete MARCXML file""" #Initialise the global variable options['mode'] = 'append' # Create a new record rec_id = create_new_record() #Initialise the xml marc we want to append test = """<collection> <record> <controlfield tag ="001">"""+str(rec_id)+ """</...
out += """<a class="navtrail" href="%(weburl)s?ln=%(ln)s">%(msg_home)s</a>""" % { 'weburl' : weburl, 'ln' : ln, 'msg_home' : _("Home")}
out += create_html_link(weburl, {'ln': ln}, _("Home"), {'class': 'navtrail'})
def tmpl_navtrailbox_body(self, ln, title, previous_links, separator, prolog, epilog): """Create navigation trail box body
<a class=header href="%(weburl)s/?ln=%(ln)s">%(msg_search)s</a>
<a class="header" href="%(weburl)s/?ln=%(ln)s">%(msg_search)s</a>
def tmpl_pageheader(self, req, ln=cdslang, headertitle="", description="", keywords="", userinfobox="", navtrailbox="", pageheaderadd="", uid=0, secure_page_p=0):
<a class=header href="%(weburl)s/submit?ln=%(ln)s">%(msg_submit)s</a>
<a class="header" href="%(weburl)s/submit?ln=%(ln)s">%(msg_submit)s</a>
def tmpl_pageheader(self, req, ln=cdslang, headertitle="", description="", keywords="", userinfobox="", navtrailbox="", pageheaderadd="", uid=0, secure_page_p=0):
<a class=header href="%(sweburl)s/youraccount/display?ln=%(ln)s">%(msg_personalize)s</a>
<a class="header" href="%(sweburl)s/youraccount/display?ln=%(ln)s">%(msg_personalize)s</a>
def tmpl_pageheader(self, req, ln=cdslang, headertitle="", description="", keywords="", userinfobox="", navtrailbox="", pageheaderadd="", uid=0, secure_page_p=0):
<a class=header href="%(weburl)s/help/index.%(ln)s.html">%(msg_help)s</a>
<a class="header" href="%(weburl)s/help/index.%(ln)s.html">%(msg_help)s</a>
def tmpl_pageheader(self, req, ln=cdslang, headertitle="", description="", keywords="", userinfobox="", navtrailbox="", pageheaderadd="", uid=0, secure_page_p=0):
<br>
<br />
def tmpl_pagefooter(self, req=None, ln=cdslang, lastupdated=None, pagefooteradd=""): """Creates a page footer
args = req.uri + make_canonical_urlargd(argd, {})
parts.append(create_html_link(req.uri, argd, lang_namelong, {'class': "langinfo"}))
def tmpl_language_selection_box(self, req, language=cdslang): """Take URLARGS and LANGUAGE and return textual language selection box for the given page.
args = "" parts.append(a_href(lang_namelong, href=args, _class="langinfo"))
parts.append(create_html_link('', {}, lang_namelong, {'class': "langinfo"}))
def tmpl_language_selection_box(self, req, language=cdslang): """Take URLARGS and LANGUAGE and return textual language selection box for the given page.
"<br>" + ' &nbsp;'.join(parts)
"<br />" + ' &nbsp;'.join(parts)
def tmpl_language_selection_box(self, req, language=cdslang): """Take URLARGS and LANGUAGE and return textual language selection box for the given page.
'month': 'monthly', 'year': 'yearly'}[frequency]
'week': 'weekly', 'month': 'monthly'}[frequency]
def tmpl_alert_email_body(self, name, url, records, pattern, catalogues, frequency):
return (None,0,errors)
print "Error: no suitable XML parsers found. Please read INSTALL file." sys.exit()
def create_record(xmltext,verbose = verbose, correct=correct): """ creates a record object and returns it uses pyRXP if installed else uses 4Suite domlette or xml.dom.minidom """ global parser (i,errors) = testImports(parser) if i==0: return (None,0,errors) try: if parser==2: ## the following is because of DTD valida...
return _("You seem to be a guest user. You have to %(x_url_open)slogin%(x_url_close)s first.") % ('<a href="../youraccount/login?ln=' + ln +'">', '<a/>')
return _("You seem to be a guest user. You have to %(x_url_open)slogin%(x_url_close)s first.") % \ {'x_url_open': '<a href="../youraccount/login?ln=' + ln + '">', 'x_url_close': '<a/>'}
def tmpl_account_adminactivities(self, ln, weburl, uid, guest, roles, activities): """ Displays the admin activities block for this user
{'x_nb_score': '</b><img src="' + weburl + '/img/' + avg_score_img + '" alt="' + avg_score + '" />', 'x_nb_reviews': total_nb_comments}
{'x_nb_score': '</b><img src="' + weburl + '/img/' + avg_score_img + '" alt="' + str(avg_score) + '" />', 'x_nb_reviews': str(total_nb_comments)}
def tmpl_get_comments(self, recID, ln, nb_per_page, page, nb_pages, display_order, display_since, cfg_webcomment_allow_reviews, comments, total_nb_comments, avg_score, warnings, border=0, reviews=0): """ Get table of all comments @param recID: record id @param ln: language @param nb_per_page: number of results per page...
<input type="text" size=30 name="elname" value="%(el_name)s" />""" % {'el_name' : cgi.escape(elname, 1)}
<input type="text" size="30" name="elname" value="%(el_name)s" />""" % {'el_name' : cgi.escape(elname, 1)}
def tmpl_display_addelementform(self, elname="", elmarccode="", eltype="", elsize="", elrows="", elcols="", elmaxlength="", elval="", elfidesc="", elmodifytext="", elcookie="", elcd="", elmd="", perform_act="elementadd", user_msg="", el_use_tuple="" ): """Display Web form used to add a new element to the database @para...
<td width="80%%"><input type="text" size=90 name="elmodifytext" value="%(el_modifytext)s" /></td>
<td width="80%%"><input type="text" size="90" name="elmodifytext" value="%(el_modifytext)s" /></td>
def tmpl_display_addelementform(self, elname="", elmarccode="", eltype="", elsize="", elrows="", elcols="", elmaxlength="", elval="", elfidesc="", elmodifytext="", elcookie="", elcd="", elmd="", perform_act="elementadd", user_msg="", el_use_tuple="" ): """Display Web form used to add a new element to the database @para...
<td width="80%%"><input type="text" size=15 name="elmarccode" value="%(el_marccode)s" /></td>
<td width="80%%"><input type="text" size="15" name="elmarccode" value="%(el_marccode)s" /></td>
def tmpl_display_addelementform(self, elname="", elmarccode="", eltype="", elsize="", elrows="", elcols="", elmaxlength="", elval="", elfidesc="", elmodifytext="", elcookie="", elcd="", elmd="", perform_act="elementadd", user_msg="", el_use_tuple="" ): """Display Web form used to add a new element to the database @para...
<td width="80%%"><input type="text" size=10 name="elsize" value="%(el_size)s" /></td>
<td width="80%%"><input type="text" size="10" name="elsize" value="%(el_size)s" /></td>
def tmpl_display_addelementform(self, elname="", elmarccode="", eltype="", elsize="", elrows="", elcols="", elmaxlength="", elval="", elfidesc="", elmodifytext="", elcookie="", elcd="", elmd="", perform_act="elementadd", user_msg="", el_use_tuple="" ): """Display Web form used to add a new element to the database @para...
<td width="80%%"><input type="text" size=6 name="elrows" value="%(el_rows)s" /></td>
<td width="80%%"><input type="text" size="6" name="elrows" value="%(el_rows)s" /></td>
def tmpl_display_addelementform(self, elname="", elmarccode="", eltype="", elsize="", elrows="", elcols="", elmaxlength="", elval="", elfidesc="", elmodifytext="", elcookie="", elcd="", elmd="", perform_act="elementadd", user_msg="", el_use_tuple="" ): """Display Web form used to add a new element to the database @para...
<td width="80%%"><input type="text" size=6 name="elcols" value="%(el_cols)s" /></td>
<td width="80%%"><input type="text" size="6" name="elcols" value="%(el_cols)s" /></td>
def tmpl_display_addelementform(self, elname="", elmarccode="", eltype="", elsize="", elrows="", elcols="", elmaxlength="", elval="", elfidesc="", elmodifytext="", elcookie="", elcd="", elmd="", perform_act="elementadd", user_msg="", el_use_tuple="" ): """Display Web form used to add a new element to the database @para...
<td width="80%%"><input type="text" size=6 name="elmaxlength" value="%(el_maxlength)s" /></td>
<td width="80%%"><input type="text" size="6" name="elmaxlength" value="%(el_maxlength)s" /></td>
def tmpl_display_addelementform(self, elname="", elmarccode="", eltype="", elsize="", elrows="", elcols="", elmaxlength="", elval="", elfidesc="", elmodifytext="", elcookie="", elcd="", elmd="", perform_act="elementadd", user_msg="", el_use_tuple="" ): """Display Web form used to add a new element to the database @para...
<td width="80%%"><input type="text" size=90 name="elval" value="%(el_val)s" /></td>
<td width="80%%"><input type="text" size="90" name="elval" value="%(el_val)s" /></td>
def tmpl_display_addelementform(self, elname="", elmarccode="", eltype="", elsize="", elrows="", elcols="", elmaxlength="", elval="", elfidesc="", elmodifytext="", elcookie="", elcd="", elmd="", perform_act="elementadd", user_msg="", el_use_tuple="" ): """Display Web form used to add a new element to the database @para...
<td width="80%%"><textarea cols=100 rows=30 name="elfidesc" wrap="nowarp">%(el_fidesc)s</textarea></td>
<td width="80%%"><textarea cols="100" rows="30" name="elfidesc" wrap="nowarp">%(el_fidesc)s</textarea></td>
def tmpl_display_addelementform(self, elname="", elmarccode="", eltype="", elsize="", elrows="", elcols="", elmaxlength="", elval="", elfidesc="", elmodifytext="", elcookie="", elcd="", elmd="", perform_act="elementadd", user_msg="", el_use_tuple="" ): """Display Web form used to add a new element to the database @para...
process_alert_queries_for_user(2530836)
process_alert_queries_for_user(2571422)
def process_alert_queries_for_user(uid): """Process the alerts for the given user id. All alerts are with reference date set as the current local time.""" alert_queries = get_alert_queries_for_user(uid) print alert_queries for aq in alert_queries: frequency = aq[2] q = run_query(aq, frequency) alerts = get_alerts(q,...
v = u''.join([ n.data for n in text_nodes ])
v = u''.join([ n.data for n in text_nodes ]).encode("utf-8")
def create_record_4suite(xmltext,verbose=verbose,correct=correct): """ creates a record object and returns it uses 4Suite domlette """ record = {} global err if correct: xmlt = xmltext (rec,e) = wash(xmlt,1) err.extend(e) return (rec,e) dom = NonvalidatingReader.parseString(xmltext,"urn:dummy") root = dom.childNode...
v = u''.join([ n.data for n in text_nodes ]) code = subfield.getAttributeNS(None,'code')
v = u''.join([ n.data for n in text_nodes ]).encode("utf-8") code = subfield.getAttributeNS(None,'code').encode("utf-8")
def create_record_4suite(xmltext,verbose=verbose,correct=correct): """ creates a record object and returns it uses 4Suite domlette """ record = {} global err if correct: xmlt = xmltext (rec,e) = wash(xmlt,1) err.extend(e) return (rec,e) dom = NonvalidatingReader.parseString(xmltext,"urn:dummy") root = dom.childNode...
ind1 = datafield.getAttributeNS(None,"ind1") ind2 = datafield.getAttributeNS(None,"ind2")
ind1 = datafield.getAttributeNS(None,"ind1").encode("utf-8") ind2 = datafield.getAttributeNS(None,"ind2").encode("utf-8")
def create_record_4suite(xmltext,verbose=verbose,correct=correct): """ creates a record object and returns it uses 4Suite domlette """ record = {} global err if correct: xmlt = xmltext (rec,e) = wash(xmlt,1) err.extend(e) return (rec,e) dom = NonvalidatingReader.parseString(xmltext,"urn:dummy") root = dom.childNode...