tacker.objects.base module

class tacker.objects.base.TackerObject(context=None, **kwargs)

Bases: VersionedObject

OBJ_PROJECT_NAMESPACE = 'tacker'
OBJ_SERIAL_NAMESPACE = 'tacker_object'
obj_alternate_context(context)
obj_reset_changes(fields=None, recursive=False)

Reset the list of fields that have been changed.

Note

  • This is NOT “revert to previous values”

  • Specifying fields on recursive resets will only be honored at the top level. Everything below the top will reset all.

Parameters:
  • fields – List of fields to reset, or “all” if None.

  • recursive – Call obj_reset_changes(recursive=True) on any sub-objects within the list of fields being reset.

tacker_obj_get_changes()

Returns a dict of changed fields with tz unaware datetimes.

Any timezone aware datetime field will be converted to UTC timezone and returned as timezone unaware datetime.

This will allow us to pass these fields directly to a db update method as they can’t have timezone information.

class tacker.objects.base.TackerObjectRegistry(*args, **kwargs)

Bases: VersionedObjectRegistry

notification_classes = []
registration_hook(cls, index)
class tacker.objects.base.TackerObjectSerializer

Bases: NoOpSerializer

A TackerObject-aware Serializer.

This implements the Oslo Serializer interface and provides the ability to serialize and deserialize TackerObject entities. Any service that needs to accept or return TackerObjects as arguments or result values should pass this to its RPCClient and RPCServer objects.

deserialize_entity(context, entity)

Deserialize something from primitive form.

Parameters:
  • ctxt – Request context, in deserialized form

  • entity – Primitive to be deserialized

Returns:

Deserialized form of entity

serialize_entity(context, entity)

Serialize something to primitive form.

Parameters:
  • ctxt – Request context, in deserialized form

  • entity – Entity to be serialized

Returns:

Serialized form of entity

class tacker.objects.base.TackerPersistentObject

Bases: object

Mixin class for Persistent objects.

This adds the fields that we use in common for most persistent objects.

fields = {'created_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=False), 'deleted': Integer(default=0,nullable=True), 'deleted_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True), 'updated_at': DateTime(default=<class 'oslo_versionedobjects.fields.UnspecifiedDefault'>,nullable=True)}
tacker.objects.base.get_attrname(name)

Return the mangled name of the attribute’s underlying storage.