[referencer] A question about document types and document.get_field()
Mads Chr. Olesen
mads at mchro.dk
Tue Dec 20 04:43:12 EST 2011
man, 19 12 2011 kl. 18:03 -0500, skrev Christopher Belanger:
> So I've been working on a plugin to export plaintext citations from
> Referencer to the clipboard. It's pretty simple, but if I finish it
> I'll gladly share it.
Please do :-)
I assume you're writing the plugin in Python?
> However, I'm having problems with document.get_field(). In order to
> get
> the bibliographic information, the plugin needs to get a bunch of
> fields. The problem is that if it tries to get a field that doesn't
> exist, rather than just returning a null value for that field, it
> throws
> an exception and the plugin doesn't return anything at all.
I'm not intimately familiar with this part, but in Python you can catch
exceptions as in:
try:
title = doc.get_field("title")
except:
title = ""
--
Mads Chr. Olesen <mads at mchro.dk>
More information about the referencer
mailing list