ads-plugin saves pages as extra field instead of pages

Bug #1099754 reported by jesse andries
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Referencer
Fix Released
Medium
Mads Chr. Olesen

Bug Description

The ads plugin retrieves pages correctly but saves this information under a wrong field called "page" instead of "pages", which then subsequently shows up in the extra field section instead of the standard "pages" field.

The solution is just to replace "page" with "pages" in the plugin code.

In solving this problem I have also added code for saving issue, year, Month, and Adsurl fields. Month and Adsurl are extra fields not available by default.

I'd be happy to commit by bazar, but unsure if this is expected/allowed.

Alternatively you can use the attached patch.

Thanks for keeping this project running, it has served me well already for a number of years.

cheers

Related branches

Revision history for this message
jesse andries (jesse-andries) wrote :
Revision history for this message
Mads Chr. Olesen (shiyee) wrote :

Thanks for your patch, I committed it to to trunk: http://bazaar.launchpad.net/~referencer-devs/referencer/trunk/revision/913

I changed the month field to "month" with lowercase "m", I believe this is the standard bibtex field.

Changed in referencer:
status: New → Fix Committed
importance: Undecided → Medium
assignee: nobody → Mads Chr. Olesen (shiyee)
Revision history for this message
jesse andries (jesse-andries) wrote :

It doesn't seem to make a difference whether a field starts with lower or upper case, it is always created as upper case even if it's called as lower case in fields.append . Don't know if that is intentional or not. This is contrast to when you create an extra field by hand in the gui, in that case the field name is created case sensitive. That seems rather inconsistent.

Anyway, I just noticed you may also want to delete line 93 in ads.py which is a todo-comment on adding the year and month fields.

Revision history for this message
jesse andries (jesse-andries) wrote :

Sorry about my previous comment on the upper/lower case issue. I must have been confused and made a mistake: It does create upper/lower case field names accordingly.

Revision history for this message
Mads Chr. Olesen (shiyee) wrote :

I removed the comment. If you want to do more work on the ads plugin I could give you access to commit directly to trunk?

Revision history for this message
jesse andries (jesse-andries) wrote : Re: [Bug 1099754] Re: ads-plugin saves pages as extra field instead of pages

On 20-01-13 03:04, Mads Chr. Olesen wrote:
> I removed the comment. If you want to do more work on the ads plugin I
> could give you access to commit directly to trunk?
>
Yes that could be handy, I might add another few fields.

I also looked back into my confusing remark on the upper/lower case
field names. I was not entirely wrong in what I said, but it seems to be
an issue specific to the "paste bibtex" feature. Before I was using the
ads-plugin I used to obtain the bibtex entry from ads and used the
"paste bibtex" feature in the properties dialog box in referencer to
import these data. Though the fields in the bibtex record are entirely
lower case, the fields that are not standard in referencer and which
thus end up as extra fields get assigned field names starting with an
upper case. It was thus for consistency with documents that I imported
earlier this way that I choose for the "Month" field instead of "month"
field. I agree it would be better to use the "month" field name, but
then "paste bibtex" should behave that way as well. Do you want me to
file a different bug report for this?

Revision history for this message
Mads Chr. Olesen (shiyee) wrote :

I think that the "paste bibtex" feature needs to cope with all sorts of garbage, so it should somehow try to normalise the case of keys. I'm not sure to what extent it does so currently, it looks like it just relies on the internal BibUtils library -- in which case it might make more sense to make the modifications there.

Revision history for this message
jesse andries (jesse-andries) wrote :

I looked back into the case issue. It seems bibtex itself is case insensitive, so in that sense it does not really make any difference how the case is normalised in referencer. In fact referencer properly avoids conflicts between keys with different case.
line 731 of Document.C is a comment referring to that, though I could not really identify the piece of code that actually establishes this (my programming knowledge is rather limited). As an example: if there is already a field "mOnth" with value "something" then both "paste bibtex" and the ads-plugin replace "something" with the actual value rather than creating an additional "Month" or "month" field.
Currently, the BibUtils library indeed normalises the case of newly created extra fields through a function firstCap (doing the obvious thing) (see lines 340-341 of BibUtils.C).
It seems to me the case normalisation in the BibUtils library was clearly thought through so I would suggest to try to stick to that and therefore replace the "month" key in the ads-plugin back into a "Month" key.
For further consistency I would suggest to also normalise the case if a field is added through the Document Properties dialog, which is not so at the moment. This just requires calling the firstCap function there as well (line 379 in DocumentProperties.C).

I'm happy to commit the above modifications if you agree.

Revision history for this message
Mads Chr. Olesen (shiyee) wrote :

Yes, I think I agree with your proposed changes.

Revision history for this message
jesse andries (jesse-andries) wrote :

I made the proposed changes and added an additional check when creating
fields through the document properties dialogue.
However, I was unable to commit to trunk directly (bzr: ERROR: Cannot
lock LockDir(chroot-78667536:///%2Bbranch/referencer/.bzr/branch/lock):
Transport operation not possible: readonly transport)
as you proposed.

Please find the changes in a merge request.

On 14-02-13 06:26, Mads Chr. Olesen wrote:
> Yes, I think I agree with your proposed changes.
>

Revision history for this message
Mads Chr. Olesen (shiyee) wrote :

Sorry for not getting around to it earlier, but your changes are now merged into trunk.

Revision history for this message
jesse andries (jesse-andries) wrote :

Thanks.

Op 16-04-13 11:50, Mads Chr. Olesen schreef:
> Sorry for not getting around to it earlier, but your changes are now
> merged into trunk.
>

Changed in referencer:
milestone: none → 1.2.1
Changed in referencer:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.