lesana.collection module

class lesana.collection.Collection(directory=None, itemdir='items')[source]

Bases: object

PARSER_FLAGS = 23
entries_from_short_eid(seid)[source]
entry_from_eid(eid)[source]
get_all_documents()[source]
get_all_search_results()[source]
get_search_results(offset=0, pagesize=12)[source]
get_template(template_fname, searchpath='.')[source]
git_add_files(files=[])[source]
property indexed_fields
classmethod init(directory=None, git_enabled=True, edit_file=None, settings={})[source]

Initialize a lesana repository

directory defaults to . if git_enabled is True, git support is enabled and if possible a git repository is initalized. edit_file is a syncronous function that runs on a filename (possibly opening the file in an editor) and should manage its own errors.

remove_entries(eids)[source]
remove_file(fname)[source]
save_entries(entries=[])[source]

Prepare a search for querystring.

update_cache(fnames=None)[source]

Update the xapian db with the data in files.

fnames is a list of basenames of files in self.itemdir.

If no files have been passed, add everything.

Return the number of files that have been added to the cache.

update_field(query, field, value)[source]
class lesana.collection.Entry(collection, data={}, fname=None)[source]

Bases: object

empty_data()[source]
get_data()[source]
property idterm
render(template, searchpath='.')[source]
property short_id
validate()[source]
property yaml_data
exception lesana.collection.TemplatingError[source]

Bases: Exception

Raised when there are errors rendering a jinja template