Hi Mauricio,
That doesn't appear to have worked though I have some ideas for using this 
other code anyway.
So thank you very much for the help!
Best,
Max

From: mauricio [mailto:[email protected]]
Sent: Sunday, June 22, 2014 9:46 AM
To: Max Cohen; [email protected]
Subject: Re: Bibexport of restricted files

Hello Max,
I had looked into the bibexport recently and hadn't even considered your 
problem (i had assumed that i would get restricted collections as long they 
matched provided filter). Now again i've looked into the code and performed 
some tests, and indeed it seems to work just as the web interface does, in the 
way that it auto-select "Any public collection" when you perform searches, so 
no matter the filters, only elements in public collections are found. There 
should be a better way to do it, but i thought it wouldn't take so much to at 
least "avoid" your problem and possibly mine in a near future, so i coded a 
marcxml method, which allows the standard filter usage, but also a new type of 
constraint, which can indicate a collection. Config file would be like this:

[export_job]
export_method = marcxml_extra
[export_criterias]
thesis = collection_name:Theses
report = 980__a:REPORT

Note that "collection_name" filter uses the actual name (the one you see in 
WebSearch admin) instead of 980__a value and that constraints can't be combined 
(collections and filters). Also note that it uses a marcxml_extra method, you 
would have to place the file i attach inside invenio lib folders, most probably:
/opt/invenio/lib/python/invenio/
and change owner to user running invenio, most probably www-data:
sudo chown www-data:www-data 
/opt/invenio/lib/python/invenio/bibexport_method_marcxml_extra.py

For the record, differences between methods' code:

diff lib/python/invenio/bibexport_method_marcxml_extra.py 
lib/python/invenio/bibexport_method_marcxml.py
43d42
< import re
133,135c132,133
<         return perform_request_search(dt="m", d1y = one_month_ago.year, d1m = 
one_month_ago.month,
<                                       d1d = one_month_ago.day,
<                                       
**self._get_perform_search_dict(export_pattern))
---
>
>         return perform_request_search(dt="m", p=export_pattern, d1y = 
> one_month_ago.year, d1m = one_month_ago.month, d1d = one_month_ago.day)
139,154c137,138
<         return 
perform_request_search(**self._get_perform_search_dict(export_pattern))
<
<     def _get_perform_search_dict(self, export_pattern):
<         """
<         Get dictionary paramameter to call perform_request_search
<         """
<         result = {}
<         group = re.match(r"\s*collection_name\s*:\s*(?P<coll_name>.+?)\s*$",
<                          export_pattern, re.IGNORECASE)
<         if group:
<             result["c"]=list(group.groups("coll_name"))
<             print result["c"]
<         else:
<             result["p"]=export_pattern
<         return result
<
---
>         return perform_request_search(p=export_pattern)


I hope this works for you.
Regards

Mauricio.

On 06/19/2014 05:23 PM, Max Cohen wrote:
Hello all.
Does anyone know if it possible to do a bibexport of restricted records without 
unrestricting them, running bibexport, and then re-restricting the records?
I ran bibexport with my superadmin privileges (because of course I have access 
to those records) but it didn't seem to work...
So ./bibexport marcxml.cfg -u "myusername"

My marcxml.cfg
[export_job]
export_method = marcxml
[export_criterias]
grey = 980__a:GREY
article = 980__a:ARTICLE (this is the restricted section)

Which results in all_aritcle.xml and nothing inside that file except:

<?xml version="1.0" encoding="UTF-8"?>
<collection 
xmlns="http://www.loc.gov/MARC21/slim";<http://www.loc.gov/MARC21/slim>>

</collection>




Max Cohen, Research Information Support
Union of Concerned Scientists | 2 Brattle Square | Cambridge, MA 02138-3780 | 
617-301-8048
The Union of Concerned Scientists puts rigorous, independent science to work to 
solve our planet's most pressing problems. Joining with citizens across the 
country, we combine technical analysis and effective advocacy to create 
innovative, practical solutions for a healthy, safe, and sustainable future.
www.ucsusa.org<http://www.ucsusa.org/> | Take action with our citizen 
network<http://ucs.convio.net/site/PageServer?pagename=sign_up> or expert 
network<http://www.ucsusa.org/forms/sign-up-for-ucs-science-network.html>. | 
Support our 
work<https://secure3.convio.net/ucs/site/Donation2?df_id=1420&1420.donation=form1&s_src=signature>.
 |
Join the conversation on our blog<blog.ucsusa.org> or follow us on 
Facebook<facebook.com/unionofconcernedscientists> and 
Twitter<twitter.com/ucsusa>.


Reply via email to