Dear Johnny,

In data martedì 10 novembre 2009 11:36:54, Johnny Mariéthoz ha scritto:
> Hello,
> 
> I want to run webcoll from a (python) script for a specific collection.
> The problem is that I need to be authentified to run this action and
> I can't specify the passowrd in the command line.

that's true.

> I can add the webcoll action in bibtask.py as:
> CFG_VALID_PROCESSES_NO_AUTH_NEEDED = ("bibupload",  "webcoll").
> 
> But this is probably not the best way to do that.
>
> Do you have any suggestion?

the above solution is correct but as you say it's not the best because it 
would remove completely the authorization checking. If you need to schedule a 
task from a Python script, than there is an API call for this that will bypass 
the authorization check (assuming that your script is performing the 
authorization check on is own).

It's "task_low_level_submission" from module "invenio.bibtask".

<http://cdsware.cern.ch/invenio/code-browser/invenio.bibtask-
module.html#task_low_level_submission>

Note the that description of the argv parameter is out of date. What you 
should specify there is the list of command line parameter as you would put 
them on the command line. So to e.g. submit a webcoll you can do:

$ from invenio.bibtask import task_low_level_submission
$ task_low_level_submission('webcoll', 'myscript', '-f', '--collection', \ 
      'foo')

It was not advertised in Invenio latest stable version, but it will in the 
future release.
 
> Moreover, I do not understand why bibsched do not need a password while
> it can run actions that need it.
 
This is because authorization is checked only upon submission of the 
corresponding bibliographic task. Once it is submitted (i.e. it gets into the 
bibsched queue) bibsched will assume it as the right to be there and will 
execute it at the proper time. If you are asking why you don't need a password 
to start bibsched, well this is because bibsched will anyway execute only 
tasks for which they where already checked for authorization.

> Many thanks in advance.

Hoping to have answered all your questions.

Best regards,
        Samuele


-- 
Samuele Kaplun ** CERN Document Server ** <http://cds.cern.ch/>

Reply via email to