rattail.db.model.batch

Core batch data models

Actually the classes in this module are not true models but rather are mixins, which provide the common columns etc. for batch tables.

class rattail.db.model.batch.core.BatchMixin[source]

Mixin for all (new-style) batch classes.

absolute_filepath(config, filename=None, name_attr='filename', makedirs=False)[source]

Return the absolute path where a data file resides.

add_row(row)[source]

Convenience method for appending a data row, with auto-sequence.

delete_data(config)[source]

Delete the data folder for the batch

filedir(config)[source]

Returns the absolute path to the folder in which the data file resides. The config object determines the root path for such files, e.g.:

[rattail]
batch.files = /path/to/batch/files

Within this root path, a more complete path is generated using the BatchMixin.key and the BatchMixin.uuid values.

filepath(config, filename=None, name_attr='filename', makedirs=False)

Return the absolute path where a data file resides.

filesize(config, name_attr='filename')[source]

Returns the size of the data file in bytes.

relative_filedir(config)[source]

Returns the path for batch data file storage, relative to the root folder for all batch storage. This includes the batch key as the first segment, e.g. 'labels/d4/83d6f2aeb011e6afeb3ca9f40bc550'.

relative_filepath(config)

Returns the path for batch data file storage, relative to the root folder for all batch storage. This includes the batch key as the first segment, e.g. 'labels/d4/83d6f2aeb011e6afeb3ca9f40bc550'.

class rattail.db.model.batch.core.BaseFileBatchMixin[source]

Common mixin for all batches which may involve a data file, either as initial data, or perhaps as “export” etc.

class rattail.db.model.batch.core.FileBatchMixin[source]

Mixin for all (new-style) batch classes which involve a file upload as their first step.

write_file(config, contents)[source]

Save a data file for the batch to the location specified by filepath().

class rattail.db.model.batch.core.BatchRowMixin[source]

Mixin for all (new-style) batch row classes.

class rattail.db.model.batch.core.ProductBatchRowMixin[source]

Mixin for all row classes of (new-style) batches which pertain to products.