Decorators¶
Most of these decorators are intended to handle various aspects of
a complete parse()
implementation. Normally you should only use the
managedparsing()
decorator (if you even
override the basic implementation). If you create separate actions
aside from the standards (download
, parse
, generate
et
al), you should also use action()
so that
manage.py will be able to call it.
-
ferenda.decorators.
timed
(f)[source]¶ Automatically log a statement of how long the function call takes
-
ferenda.decorators.
recordlastdownload
(f)[source]¶ Automatically stores current time in
self.config.lastdownload
-
ferenda.decorators.
parseifneeded
(f)[source]¶ Makes sure the parse function is only called if needed, i.e. if the outfile is nonexistent or older than the infile(s), or if the user has specified in the config file or on the command line that it should be re-generated.
-
ferenda.decorators.
render
(f)[source]¶ Handles the serialization of the
Document
object to XHTML+RDFa and RDF/XML files. Must be used in conjunction withmakedocument()
.
-
ferenda.decorators.
handleerror
(f)[source]¶ Make sure any errors in
ferenda.DocumentRepository.parse()
are handled appropriately and do not stop the parsing of all documents.
-
ferenda.decorators.
makedocument
(f)[source]¶ Changes the signature of the parse method to expect a Document object instead of a basefile string, and creates the object.
-
ferenda.decorators.
managedparsing
(f)[source]¶ Use all standard decorators for parse() in the correct order (
ifneeded()
,updateentry()
,makedocument()
,timed()
,render()
)
-
ferenda.decorators.
action
(f)[source]¶ Decorator that marks a class or instance method as runnable by
ferenda.manager.run()