MambuPy.rest.mambucentre

Mambu Centres objects.

MambuCentre holds a centre.

MambuCentres holds a list of centres.

Uses mambugeturl.getcentresurl as default urlfunc

Classes

MambuCentre([urlfunc, entid])

A Centre from Mambu.

MambuCentres([urlfunc, entid])

A list of Centres from Mambu.

class MambuPy.rest.mambucentre.MambuCentre(urlfunc=<function getcentresurl>, entid='', *args, **kwargs)[source]

Bases: MambuStruct

A Centre from Mambu.

With the default urlfunc, entid argument must be the ID of the centre you wish to retrieve.

__init__(urlfunc=<function getcentresurl>, entid='', *args, **kwargs)[source]

Tasks done here:

Just initializes the MambuStruct.

__module__ = 'MambuPy.rest.mambucentre'
setBranch(*args, **kwargs)[source]

Adds the branch for this centre to a ‘branch’ field.

Returns the number of requests done to Mambu.

class MambuPy.rest.mambucentre.MambuCentres(urlfunc=<function getcentresurl>, entid='', *args, **kwargs)[source]

Bases: MambuStruct

A list of Centres from Mambu.

With the default urlfunc, entid argument must be empty at instantiation time to retrieve all the centres according to any other filter you send to the urlfunc.

__init__(urlfunc=<function getcentresurl>, entid='', *args, **kwargs)[source]

By default, entid argument is empty. That makes perfect sense: you want several centres, not just one

__iter__()[source]
__module__ = 'MambuPy.rest.mambucentre'
convert_dict_to_attrs(*args, **kwargs)[source]

The trick for iterable Mambu Objects comes here:

You iterate over each element of the responded List from Mambu, and create a Mambu Centre object for each one, initializing them one at a time, and changing the attrs attribute (which just holds a list of plain dictionaries) with a MambuCentre just created.

Todo

pass a valid (perhaps default) urlfunc, and its corresponding id to entid to each MambuCentre, telling MambuStruct not to connect() by default. It’s desirable to connect at any other further moment to refresh some element in the list.