Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F106925473
bibedit_cachetool.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
Wed, Apr 2, 14:43
Size
1 KB
Mime Type
text/x-python
Expires
Fri, Apr 4, 14:43 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
25283542
Attached To
R3600 invenio-infoscience
bibedit_cachetool.py
View Options
## -*- coding: utf-8 -*-
##
## This file is part of CDS Invenio.
## Copyright (C) 2002, 2003, 2004, 2005, 2006, 2007, 2008 CERN.
##
## CDS Invenio 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.
##
## CDS Invenio 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 CDS Invenio; if not, write to the Free Software Foundation, Inc.,
## 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA.
"""
BibEdit Cache tool
Usage: bibeditcache record_id user_id [options]
A tool reading bibedit cache files and displaying their content
Options:
--list-undo-handlers Prints all the undo handlers stored in the cache file
--list-redo-handlers Prints all the undo handlers stored in the cache file
"""
import
sys
from
invenio.bibedit_utils
import
get_cache_file_contents
from
pprint
import
pprint
def
usage
():
""" Print the usafe information"""
print
__doc__
def
print_ur_list
(
ur_list
):
"""Prints nicely formated undo/redo list"""
pprint
(
ur_list
,
indent
=
0
,
width
=
50
)
def
main
():
""" The main function providing the functionalityu of the BibEdit cache tool
"""
if
len
(
sys
.
argv
)
<
3
:
usage
()
exit
(
1
)
recid
=
sys
.
argv
[
1
]
uid
=
sys
.
argv
[
2
]
cache_content
=
get_cache_file_contents
(
recid
,
uid
)
if
len
(
sys
.
argv
)
==
3
:
print
str
(
cache_content
)
if
'--list-undo-handlers'
in
sys
.
argv
:
print
"Undo handlers:"
print_ur_list
(
cache_content
[
5
])
if
'--list-redo-handlers'
in
sys
.
argv
:
print
"Undo handlers:"
print_ur_list
(
cache_content
[
6
])
Event Timeline
Log In to Comment