Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F90407680
getfile.py
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
Fri, Nov 1, 10:04
Size
4 KB
Mime Type
text/x-c
Expires
Sun, Nov 3, 10:04 (2 d)
Engine
blob
Format
Raw Data
Handle
22070997
Attached To
R3600 invenio-infoscience
getfile.py
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"
pylibdir
=
"<LIBDIR>/python"
<
protect
>
## $Id$
## DO NOT EDIT THIS FILE! IT WAS AUTOMATICALLY GENERATED FROM CDSware WML SOURCES.
## import interesting modules:
import
string
import
os
import
sys
import
time
import
types
import
re
sys
.
path
.
append
(
'
%s
'
%
pylibdir
)
from
cdsware.config
import
cdsname
,
cdslang
from
cdsware.access_control_engine
import
acc_authorize_action
from
cdsware.access_control_admin
import
acc_isRole
from
cdsware.webpage
import
page
,
create_error_box
from
cdsware.webuser
import
getUid
,
get_email
,
page_not_authorized
from
cdsware.messages
import
*
from
mod_python
import
apache
from
cdsware.websubmit_config
import
*
from
cdsware.file
import
*
from
cdsware.access_control_config
import
CFG_ACCESS_CONTROL_LEVEL_SITE
def
index
(
req
,
c
=
cdsname
,
ln
=
cdslang
,
recid
=
""
,
docid
=
""
,
version
=
""
,
name
=
""
,
format
=
""
):
# get user ID:
try
:
uid
=
getUid
(
req
)
if
uid
==
-
1
or
CFG_ACCESS_CONTROL_LEVEL_SITE
>=
1
:
return
page_not_authorized
(
req
,
"../getfile.py/index"
)
uid_email
=
get_email
(
uid
)
except
MySQLdb
.
Error
,
e
:
return
errorMsg
(
e
.
value
,
req
)
docfiles
=
[]
t
=
""
filelist
=
""
# if a precise file is requested, we stream it
if
name
!=
""
:
if
docid
==
""
:
return
errorMsg
(
"Parameter docid missing"
,
req
)
else
:
docfile
=
BibDoc
(
bibdocid
=
docid
)
.
getFile
(
name
,
format
,
version
)
if
docfile
==
None
:
return
warningMsg
(
"can't find file..."
,
req
)
else
:
return
docfile
.
stream
(
req
)
# all files attached to a record
elif
recid
!=
""
:
bibarchive
=
BibRecDocs
(
recid
)
filelist
=
bibarchive
.
display
(
docid
,
version
)
# a precise filename
elif
docid
!=
""
:
bibdoc
=
BibDoc
(
bibdocid
=
docid
)
recid
=
bibdoc
.
getRecid
()
filelist
=
bibdoc
.
display
(
version
)
title
=
"record #<a href=
\"
search.py?recid=
%s
\"
>
%s
</a>"
%
(
recid
,
recid
)
if
docid
!=
""
:
title
+=
" document #
%s
"
%
docid
if
version
!=
""
:
title
+=
" version #
%s
"
%
version
t
=
"""<center><table class="searchbox" summary="" width="500"><tr><th class="portalboxheader">Access to Fulltext <font size=-2>[%s]</font></th></tr><tr><td class="portalboxbody"><!--start file list-->\n"""
%
title
t
+=
filelist
t
+=
"""<!--end file list--></td></tr></table></center>\n"""
p_navtrail
=
"Access to Fulltext"
return
page
(
title
=
""
,
body
=
t
,
navtrail
=
p_navtrail
,
description
=
""
,
keywords
=
"keywords"
,
uid
=
uid
,
language
=
ln
,
urlargs
=
req
.
args
)
def
errorMsg
(
title
,
req
,
c
=
cdsname
,
ln
=
cdslang
):
return
page
(
title
=
"error"
,
body
=
create_error_box
(
req
,
title
=
title
,
verbose
=
0
,
ln
=
ln
),
description
=
"
%s
- Internal Error"
%
c
,
keywords
=
"
%s
, CDSware, Internal Error"
%
c
,
language
=
ln
,
urlargs
=
req
.
args
)
def
warningMsg
(
title
,
req
,
c
=
cdsname
,
ln
=
cdslang
):
return
page
(
title
=
"warning"
,
body
=
title
,
description
=
"
%s
- Internal Error"
%
c
,
keywords
=
"
%s
, CDSware, Internal Error"
%
c
,
language
=
ln
,
urlargs
=
req
.
args
)
</
protect
>
Event Timeline
Log In to Comment