Hlavní stránka > Areál administrátora > BibCatalog Admin Guide |
The BibCatalog Admin module allows the administrator to setup automatic ticket generation for incoming or existing records.
In the future, this might be expanded to also be able to manage the configured ticketing system via the command line. Like resolving a range of tickets etc.
The following functionality is currently available:
def check_record(ticket, record): """ Checks to see if we should create a ticket. @param ticket: a ticket object as created by BibCatalogTicket() containing the subject, body and queue to create a ticket in. @type ticket: record object of BibCatalogTicket. @param record: a recstruct object as created by bibrecord.create_record() @type record: record object of BibRecord. @return: returns True if record is a 'ARTICLE' record. @rtype: bool """ return record_in_collection(record, "ARTICLE")
def generate_ticket(ticket, record): """ Generates a ticket to be created, filling subject, body and queue values of the passed BibCatalogTicket object. The enriched object is returned. @param ticket: a ticket object as created by BibCatalogTicket() containing the subject, body and queue to create a ticket in. @type ticket: record object of BibCatalogTicket. @param record: a recstruct object as created by bibrecord.create_record() @type record: record object of BibRecord. @return: the modified ticket object to create. @rtype: BibCatalogTicket """ title_code = load_tag_code_from_name("title") title = record_get_field_value(record, **split_tag_code(title_code)) abstract_code = load_tag_code_from_name("abstract") abstract = record_get_field_value(record, **split_tag_code(abstract_code)) ticket.queue = "NEW-ARTICLES" ticket.body = "%s\n\n%s" % (title, abstract) ticket.subject = "New record: %s" % (title,) return ticket
The name of this file, or ticket template, is what you would later use to refer to it.
For example: a ticket template named article_record.py will be referred to on the command line like this:
$ bibcatalog --tickets="article_record"
Note: You can select more than one ticket template to run by seperating their names with comma (,)
To list all the available tickets, you can run the following:
$ bibcatalog --list-tickets
The special argument --all-tickets can be used to select all tickets available
When launching the BibCatalog daemon, selecting a specific ticket using --ticket=TICKET,TICKET or --all-tickets is mandatory.
Note: If some templates cannot be loaded due to syntax errors etc. BibCatalog will report the broken plug-ins to the terminal output. <∕p>
A ticket template like the above named article_record.py will be referred to on the command line like this:
$ bibcatalog --tickets="article_record"
Note: You can select more than one ticket template to run by seperating their names with comma (,)
BibCatalog needs a set of records to create tickets for. You can give the BibCatalog task these records in many ways:
By search query:
$ bibcatalog -q "collection:Thesis and not subject:automation" --all-tickets
or, by -i parameter:
$ bibcatalog -i 12,13,15 --tickets="article_ticket,thesis_ticket"