Package Pyblio :: Package Cite :: Package WP :: Module File
[hide private]
[frames] | no frames]

Source Code for Module Pyblio.Cite.WP.File

 1  # This file is part of pybliographer 
 2  #  
 3  # Copyright (C) 1998-2006 Frederic GOBRY 
 4  # Email : gobry@pybliographer.org 
 5  #           
 6  # This program is free software; you can redistribute it and/or 
 7  # modify it under the terms of the GNU General Public License 
 8  # as published by the Free Software Foundation; either version 2  
 9  # of the License, or (at your option) any later version. 
10  #    
11  # This program is distributed in the hope that it will be useful, 
12  # but WITHOUT ANY WARRANTY; without even the implied warranty of 
13  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
14  # GNU General Public License for more details.  
15  #  
16  # You should have received a copy of the GNU General Public License 
17  # along with this program; if not, write to the Free Software 
18  # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. 
19   
20  """ 
21  A convenience object to write citations to a plain file. 
22  """ 
23   
24  import codecs 
25   
26  from Pyblio.Format.HTML import Generator 
27   
28 -class File(object):
29 - def __init__(self, fd, generator=Generator):
30 self.fd = fd 31 self.gen = generator 32 33 self.cited = [] 34 return
35
36 - def update_biblio(self):
37 return self.gen(self.fd)
38
39 - def cite(self, keys, db):
40 self.cited += keys
41
42 - def fetch(self):
43 return self.cited
44
45 - def update_keys(self, keymap):
46 for i, (uid, name, extra) in enumerate(self.cited): 47 if uid in keymap: 48 self.cited[i] = (uid, keymap[uid], extra) 49 return self.cited
50 51 # The remaining operations are NOPs
52 - def connect(self):
53 return
54
55 - def is_connected(self):
56 return True
57
58 - def disconnect(self):
59 return
60