PyXWF.Resource – Baseclass for a reloadable resource

class PyXWF.Resource.Resource(**kwargs)[source]

Resources represent data which was loaded and can be reloaded from an original source. Resource derivates must implement LastModified and update() to allow for precise caching and on-demand reload.

LastModified None[source]

Return a datetime.datetime object referring to the timestamp of last modification of the resource stored in this object (not the one represented by this object).

It MUST refer to the date of last modification of the source at the time it was loaded or the timestamp of modification by any program code, which is not neccessarily the same as the current timestamp of last modification of the original source.

threadsafe_update()[source]

The Resource class provides basic means to make your update thread safe: The update() method will only be called with the _updatelock held, if you don’t overwrite this method.

Note that this method will only be called by the framework itself; If you call update() on your own, you will not be safeguarded.

update()[source]

Check for modifications of the resource represented by this object and reload the data if neccessary. Should also update the value returned by LastModified.

class PyXWF.Resource.XMLTree(filename, **kwargs)[source]

Represent a file-backed XML tree resource. Load the XML tree from filename and watch out for modifications.

Previous topic

PyXWF.Cache – Caching baseclasses

Next topic

Plugin framework

This Page