mewlo.mpacks.core.helpers.serializabledbdict module

serializabledbdict.py This module contains classes to support a serializable dictionary for db use

class mewlo.mpacks.core.helpers.serializabledbdict.SerializeableDbDict[source]

Bases: object

Dictionary like object that is made for smart automatic serialization and unserialization to a database model.

aftermodify()[source]

Called after a change has been made; we record that our serialized string is not up to date with dictionary, and that changes have occurred that need db saving.

delete_keyval(keyname)[source]

Remove a dictionary value – no effect if value doesn’t exist.

get_haschanged()[source]

Check this to see if we need to write out new serialization to database.

get_keyval(keyname, defaultval)[source]

Get a dictionary value, or default if missing.

get_serializedstr()[source]

Get the serialized version of the dictionary suitable for db saving; caller could call get_haschanged() first to see if it needs saving.

set_dict(newdict)[source]

Set entire dictionary.

set_fromserializedstr(serializedstring)[source]

Set the dictionary from the db string of it serialized; note we lazy unserialize so don’t do that now

set_haschanged(val)[source]

Force value of haschanged; could be called after saving to db.

set_keyval(keyname, val)[source]

Set a dictionary value – no effect if value is same as existing.

unserialize_ifpending()[source]

Lazy unserialize.

update_serializestring_ifneeded()[source]

Updates serialized string of dictionary IFF it needs updating (dictionary has changed since load).

class mewlo.mpacks.core.helpers.serializabledbdict.SerializeableDbDictCollection(dictnamelist=None)[source]

Bases: object

Collection of SerializeableDbDict.

append(dictname, thedict)[source]
get_alldicts()[source]
get_keyval(dictname, keyname, defaultval)[source]
init_dicts(dictnamelist)[source]
lookup_byname(dictname)[source]
set_keyval(dictname, keyname, val)[source]

Table Of Contents

Previous topic

mewlo.mpacks.core.helpers.misc module

Next topic

mewlo.mpacks.core.helpers.thindict module

This Page