Backend

Definitions

The Definition module contains object wrappers of the various data-types found in Radiant Grids. Those are:

Note

Each entry in “Variables” list for each class has a name [emphasized within brackets]. This is the key in the dict- representation of it’s data, which would be used when serializing to JSON.

class radiant.grid.backend.definition.ColumnDefinition(d=None)

Defines a Column within a Document. The properties of the ColumnDefinition are meant to describe a database column.

Variables:
  • name (str) – [name] Document-unique name of this Column
  • type_name (str) – [type-name] Database type (INTEGER, TEXT, REAL, BLOB)
  • type_size (int) – [type-size] Database type size (if applicable, else None)
  • primary_key (bool) – [primary-key] Column is the primary key (default False)
  • default (str) – [default] Use this default value (default None)
  • auto_increment (bool) – [auto-increment] Column is the auto incrementing (default False)
  • unique (bool) – [unique] Column has a unique constraint (default False)
__init__(d=None)

Constructor.

Parameters:d (dict) – Optional dictionary to import
data_type = 'grid/column/entry'
from_dict(d)
to_dict()
class radiant.grid.backend.definition.DataDefinition(d=None)

Defines a Row of Data within a Document.

Variables:data (dict) – [data] A dict with the values of the columns
__init__(d=None)

Constructor.

Parameters:d (dict) – Optional dictionary to import
data_type = 'grid/data/entry'
from_dict(d)
to_dict()
class radiant.grid.backend.definition.DocumentDefinition(d=None)

Defines a Document within a Workspace. A Document describes a table in a database that can hold data. The columns are defined by ColumnDefinition objects.

Variables:
__init__(d=None)

Constructor.

Parameters:d (dict) – Optional dictionary to import
data_type = 'grid/document/entry'
from_dict(d)
to_dict()
class radiant.grid.backend.definition.Feed(entry_class, d=None, data_type=None)

Defines a Feed of any given entry data type.

Variables:
  • entry_class (class) – The class used for the entries in the feed
  • data_type (str) – [data-type] The feed data-type to use
  • workspace (str) – [workspace] The workspace of this Feed’s origin
  • start (int) – [start] Paging start index
  • count (int) – [start] Paging total count
  • page_size (int) – [page-size] Paging page size
  • entries (list) – [entries] Entry of type entry_class
__init__(entry_class, d=None, data_type=None)

Constructor.

Parameters:
  • entry_class (class) – The class used for the entries of this feed
  • d (dict) – Optional dictionary to import
  • data_type (str) – Optional data-type to use, overriding entry_class.data_type
from_dict(d)
to_dict()
class radiant.grid.backend.definition.ItemDefinition(d=None)

Defines a graphical Item in a View (ViewDefinition). The item_type can be one of:

  • Label - A label with an optional title
  • Table - A table bound to a document
Variables:
  • item_type (str) – [item-type] The type of item this is
  • name (str) – [name] View-unique name of this Item
  • properties (dict) – [properties] Various properties for this item
  • position (list) – [position] Two or four values describing the position, either as (x, y) or (x1, y1, x2, y2) depending on item type
__init__(d=None)

Constructor.

Parameters:d (dict) – Optional dictionary to import
data_type = 'grid/item/entry'
from_dict(d)
to_dict()
class radiant.grid.backend.definition.VariableDefinition(d=None)

Defines a Variable within a Workspace. Variables typically have dot-separated names.

Variables:
  • name (str) – [name] Workspace-unique name of this Variable
  • type (str) – [type] Type of the variable (str (default), int, float, bool)
  • value (str) – [value] The value of the Variable
__init__(d=None)

Constructor.

Parameters:d (dict) – Optional dictionary to import
data_type = 'grid/variable/entry'
from_dict(d)
to_dict()
class radiant.grid.backend.definition.ViewDefinition(d=None)

Defines a View within a Workspace. A View describes a graphical representation of the data in the Workspace using items. Items have various properties depending on what type of item they are. See ItemDefinition.

Variables:
  • name (str) – [name] Workspace-unique name of this View
  • items (list) – [items] List of ItemDefinition
__init__(d=None)

Constructor.

Parameters:d (dict) – Optional dictionary to import
data_type = 'grid/view/entry'
from_dict(d)
to_dict()