blot.assets.base

class blot.assets.base.Aggregate(name, assets=None)

Bases: blot.assets.base.ContentAsset

A special type of ContentAsset that has two known metadata properties:
  • name : The metadata value of some other ContentAsset this Aggregate is based on
  • assets : The list of ContentAssets in which this Aggregate appears
class blot.assets.base.Aggregator(key, pattern, asset_class=<class 'blot.assets.base.Aggregate'>)

Bases: object

Base-class for an asset processor that generates Aggregates for each value in the metadata of processed ContentAssets.

When used as an asset processor, it will look at a specific metdata property of each ContentAsset. For each unique value found at this property, a new Aggregate asset will be generated.

Each Aggregate object contains in its own metadata an assets key that contains a list of each of the ContentAssets in which the aggregated value was found.

It is up to subclasses of Aggregator to make the list of generated Aggregate assets available. Subclasses also have the chance to update each aggregate and the asset it comes from.

Generally, the original content type’s context will be updated with a list of the Aggregates under a relevant key in the finish method. Check the Tags and Categories processors for examples.

finish(context, aggregates)
get_values(asset)

Get the aggregated property value from the asset.

process(context)

Check each asset in the content Type context and aggregate discovered values over the specific metadata key into new assets.

process_aggregate(aggregate, asset)
class blot.assets.base.ContentAsset(source=None, content=None, metadata={})

Bases: object

An object with some data and associated metadata.

ContentAssets represent the result of loading and reading content sources. The result of parsing the source source provides its content and optional metadata dictionary.

ContentAssets are fed through a pipeline of processors where they may be modified in various ways. Eventually, they are passed to Writers which can render them to their final destinations on disk.

A basic dictionary-like access is avaiable as a shortcut to the asset’s metadata. Once the assets’s target attribute has been set, its url property will become available.

Some assets are produced by the processing of other assets and have no source.

get(key, default=None)
url