Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F75825023
Make_Record.py.wml
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Aug 4, 12:45
Size
2 KB
Mime Type
text/x-c
Expires
Tue, Aug 6, 12:45 (2 d)
Engine
blob
Format
Raw Data
Handle
19530710
Attached To
R3600 invenio-infoscience
Make_Record.py.wml
View Options
## $Id$
## This file is part of the CERN Document Server Software (CDSware).
## Copyright (C) 2002 CERN.
##
## The CDSware is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later version.
##
## The CDSware is distributed in the hope that it will be useful, but
## WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
## General Public License for more details.
##
## You should have received a copy of the GNU General Public License
## along with CDSware; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
## read config variables:
#include "config.wml"
#include "configbis.wml"
<protect>
## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.
## Description: function Make_Weblib_Record
## This function creates the bibliographic record
## using bibConvert and the configuration files passed as
## parameters
## Author: T.Baron
##
## PARAMETERS: sourceSubmit: source description file
## mysqlInsert: template description file
def Make_Record(parameters,curdir,form):
# Get rid of "invisible" white spaces
source = parameters['sourceTemplate'].replace(" ","")
create = parameters['createTemplate'].replace(" ","")
# We use bibconvert to create the xml record
call_uploader_txt = "%s -l1 -d'%s' -Cs'%s/%s' -Ct'%s/%s' > %s/recmysql" % (bibconvert,curdir,bibconvertconf,source,bibconvertconf,create,curdir)
os.system(call_uploader_txt)
# Then we have to format this record (turn & into & and < into <
# After all we know nothing about the text entered by the users at submission time
if os.path.exists("%s/recmysql" % curdir):
fp = open("%s/recmysql" % curdir,"r")
rectext = fp.read()
fp.close()
else:
raise functionError("Cannot create database record")
# First of all the &
rectext = rectext.replace("&","&")
rectext = rectext.replace("&","&")
# Then the < - More difficult!
rectext = rectext.replace("<","<")
rectext = rectext.replace("<record","<record")
rectext = rectext.replace("</record","</record")
rectext = rectext.replace("<datafield","<datafield")
rectext = rectext.replace("</datafield","</datafield")
rectext = rectext.replace("<controlfield","<controlfield")
rectext = rectext.replace("</controlfield","</controlfield")
rectext = rectext.replace("<subfield","<subfield")
rectext = rectext.replace("</subfield","</subfield")
# Save the record back
fp = open("%s/recmysql" % curdir,"w+")
fp.write(rectext)
fp.close()
return ""
</protect>
Event Timeline
Log In to Comment