MambuPy 2.0.0b49__tar.gz → 2.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/__init__.py +21 -4
- {MambuPy-2.0.0b49/mambupy → mambupy-2.1.0/MambuPy}/api/connector/rest.py +41 -9
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/entities.py +14 -8
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/mambuutil.py +1 -1
- mambupy-2.1.0/MambuPy/rest/__init__.py +49 -0
- mambupy-2.1.0/MambuPy/rest/mambuactivity.py +87 -0
- mambupy-2.1.0/MambuPy/rest/mambubranch.py +122 -0
- mambupy-2.1.0/MambuPy/rest/mambucentre.py +104 -0
- mambupy-2.1.0/MambuPy/rest/mambuclient.py +317 -0
- mambupy-2.1.0/MambuPy/rest/mambugroup.py +372 -0
- mambupy-2.1.0/MambuPy/rest/mambuloan.py +687 -0
- mambupy-2.1.0/MambuPy/rest/mambuproduct.py +180 -0
- mambupy-2.1.0/MambuPy/rest/mamburepayment.py +99 -0
- mambupy-2.1.0/MambuPy/rest/mamburestutils.py +119 -0
- mambupy-2.1.0/MambuPy/rest/mamburoles.py +98 -0
- mambupy-2.1.0/MambuPy/rest/mambusaving.py +114 -0
- mambupy-2.1.0/MambuPy/rest/mambusavingfundingrepayment.py +94 -0
- mambupy-2.1.0/MambuPy/rest/mambusavingtransaction.py +163 -0
- mambupy-2.1.0/MambuPy/rest/mambustruct.py +1066 -0
- mambupy-2.1.0/MambuPy/rest/mambutask.py +163 -0
- mambupy-2.1.0/MambuPy/rest/mambutransaction.py +103 -0
- mambupy-2.1.0/MambuPy/rest/mambutransactionchannel.py +101 -0
- mambupy-2.1.0/MambuPy/rest/mambuuser.py +229 -0
- mambupy-2.1.0/MambuPy.egg-info/PKG-INFO +759 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy.egg-info/SOURCES.txt +39 -27
- mambupy-2.1.0/MambuPy.egg-info/requires.txt +30 -0
- mambupy-2.1.0/MambuPy.egg-info/top_level.txt +3 -0
- mambupy-2.1.0/PKG-INFO +759 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/__init__.py +21 -4
- {MambuPy-2.0.0b49/MambuPy → mambupy-2.1.0/mambupy}/api/connector/rest.py +41 -9
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/entities.py +14 -8
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/mambuutil.py +1 -1
- mambupy-2.1.0/mambupy/rest/__init__.py +49 -0
- mambupy-2.1.0/mambupy/rest/mambuactivity.py +87 -0
- mambupy-2.1.0/mambupy/rest/mambubranch.py +122 -0
- mambupy-2.1.0/mambupy/rest/mambucentre.py +104 -0
- mambupy-2.1.0/mambupy/rest/mambuclient.py +317 -0
- mambupy-2.1.0/mambupy/rest/mambugroup.py +372 -0
- mambupy-2.1.0/mambupy/rest/mambuloan.py +687 -0
- mambupy-2.1.0/mambupy/rest/mambuproduct.py +180 -0
- mambupy-2.1.0/mambupy/rest/mamburepayment.py +99 -0
- mambupy-2.1.0/mambupy/rest/mamburestutils.py +119 -0
- mambupy-2.1.0/mambupy/rest/mamburoles.py +98 -0
- mambupy-2.1.0/mambupy/rest/mambusaving.py +114 -0
- mambupy-2.1.0/mambupy/rest/mambusavingfundingrepayment.py +94 -0
- mambupy-2.1.0/mambupy/rest/mambusavingtransaction.py +163 -0
- mambupy-2.1.0/mambupy/rest/mambustruct.py +1066 -0
- mambupy-2.1.0/mambupy/rest/mambutask.py +163 -0
- mambupy-2.1.0/mambupy/rest/mambutransaction.py +103 -0
- mambupy-2.1.0/mambupy/rest/mambutransactionchannel.py +101 -0
- mambupy-2.1.0/mambupy/rest/mambuuser.py +229 -0
- mambupy-2.1.0/pyproject.toml +44 -0
- MambuPy-2.0.0b49/MambuPy/rest1to2/__init__.py +0 -18
- MambuPy-2.0.0b49/MambuPy/rest1to2/mambubranch.py +0 -74
- MambuPy-2.0.0b49/MambuPy/rest1to2/mambucentre.py +0 -35
- MambuPy-2.0.0b49/MambuPy/rest1to2/mambuclient.py +0 -133
- MambuPy-2.0.0b49/MambuPy/rest1to2/mambugroup.py +0 -108
- MambuPy-2.0.0b49/MambuPy/rest1to2/mambuloan.py +0 -215
- MambuPy-2.0.0b49/MambuPy/rest1to2/mambuproduct.py +0 -34
- MambuPy-2.0.0b49/MambuPy/rest1to2/mamburepayment.py +0 -97
- MambuPy-2.0.0b49/MambuPy/rest1to2/mambustruct.py +0 -352
- MambuPy-2.0.0b49/MambuPy/rest1to2/mambutask.py +0 -64
- MambuPy-2.0.0b49/MambuPy/rest1to2/mambutransaction.py +0 -46
- MambuPy-2.0.0b49/MambuPy/rest1to2/mambuuser.py +0 -85
- MambuPy-2.0.0b49/MambuPy/utils/logging_config.py +0 -5
- MambuPy-2.0.0b49/MambuPy.egg-info/PKG-INFO +0 -49
- MambuPy-2.0.0b49/MambuPy.egg-info/requires.txt +0 -5
- MambuPy-2.0.0b49/MambuPy.egg-info/top_level.txt +0 -6
- MambuPy-2.0.0b49/PKG-INFO +0 -49
- MambuPy-2.0.0b49/mambupy/rest1to2/__init__.py +0 -18
- MambuPy-2.0.0b49/mambupy/rest1to2/mambubranch.py +0 -74
- MambuPy-2.0.0b49/mambupy/rest1to2/mambucentre.py +0 -35
- MambuPy-2.0.0b49/mambupy/rest1to2/mambuclient.py +0 -133
- MambuPy-2.0.0b49/mambupy/rest1to2/mambugroup.py +0 -108
- MambuPy-2.0.0b49/mambupy/rest1to2/mambuloan.py +0 -215
- MambuPy-2.0.0b49/mambupy/rest1to2/mambuproduct.py +0 -34
- MambuPy-2.0.0b49/mambupy/rest1to2/mamburepayment.py +0 -97
- MambuPy-2.0.0b49/mambupy/rest1to2/mambustruct.py +0 -352
- MambuPy-2.0.0b49/mambupy/rest1to2/mambutask.py +0 -64
- MambuPy-2.0.0b49/mambupy/rest1to2/mambutransaction.py +0 -46
- MambuPy-2.0.0b49/mambupy/rest1to2/mambuuser.py +0 -85
- MambuPy-2.0.0b49/mambupy/utils/logging_config.py +0 -5
- MambuPy-2.0.0b49/setup.py +0 -128
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/LICENSE +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/__init__.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/classes.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/connector/__init__.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/connector/mambuconnector.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/interfaces.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/mambubranch.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/mambucentre.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/mambuclient.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/mambucustomfield.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/mambugroup.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/mambuloan.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/mambuproduct.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/mamburole.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/mambustruct.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/mambutask.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/mambutransaction.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/mambuuser.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/api/vos.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/mambuconfig.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/mambugeturl.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/__init__.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_activities.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_addresses.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_branches.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_centres.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_clients.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_customfields.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_dummies.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_groups.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_loans.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_mambu.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_orm.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_tasks.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/orm/schema_users.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/utils/__init__.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy/utils/userdeactivate.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/MambuPy.egg-info/dependency_links.txt +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/README.md +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/__init__.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/classes.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/connector/__init__.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/connector/mambuconnector.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/interfaces.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/mambubranch.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/mambucentre.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/mambuclient.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/mambucustomfield.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/mambugroup.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/mambuloan.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/mambuproduct.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/mamburole.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/mambustruct.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/mambutask.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/mambutransaction.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/mambuuser.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/api/vos.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/mambuconfig.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/mambugeturl.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/__init__.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_activities.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_addresses.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_branches.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_centres.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_clients.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_customfields.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_dummies.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_groups.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_loans.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_mambu.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_orm.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_tasks.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/orm/schema_users.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/utils/__init__.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/mambupy/utils/userdeactivate.py +0 -0
- {MambuPy-2.0.0b49 → mambupy-2.1.0}/setup.cfg +0 -0
|
@@ -5,17 +5,18 @@
|
|
|
5
5
|
|
|
6
6
|
MambuPy.mambuconfig
|
|
7
7
|
MambuPy.mambuutil
|
|
8
|
-
MambuPy.rest
|
|
9
|
-
MambuPy.orm
|
|
10
8
|
MambuPy.api
|
|
11
9
|
MambuPy.api.connector
|
|
10
|
+
MambuPy.orm
|
|
11
|
+
MambuPy.rest
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
Currently, there are two different ways to access Mambu objects:
|
|
15
15
|
|
|
16
16
|
1) Objects using `Mambu REST API
|
|
17
17
|
<https://developer.mambu.com/customer/en/portal/articles/1162276-rest-apis-overview/>`_
|
|
18
|
-
, they live at the :any:`MambuPy.
|
|
18
|
+
, they live at the :any:`MambuPy.api` package (the old-and-soon-to-be-deprecated,
|
|
19
|
+
V1-compatible code lives at :any:`MambuPy.rest`
|
|
19
20
|
|
|
20
21
|
2) An ORM using a `DB backup retrieved from Mambu
|
|
21
22
|
<https://support.mambu.com/docs/mambu-data-dictionary>`_
|
|
@@ -34,5 +35,21 @@ TODOS
|
|
|
34
35
|
to achive TDD when implementing features or correcting bugs.
|
|
35
36
|
"""
|
|
36
37
|
|
|
37
|
-
|
|
38
|
+
import sys
|
|
39
|
+
from importlib.abc import MetaPathFinder
|
|
40
|
+
from importlib.util import spec_from_file_location
|
|
41
|
+
|
|
42
|
+
__version__ = "2.1.0"
|
|
38
43
|
"""The version of this module."""
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
class CaseInsensitiveFinder(MetaPathFinder):
|
|
47
|
+
def find_spec(self, fullname, path, target=None):
|
|
48
|
+
if fullname.lower() == "mambupy":
|
|
49
|
+
# Get the actual module file location
|
|
50
|
+
return spec_from_file_location(fullname, __file__)
|
|
51
|
+
return None
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
# Register the finder
|
|
55
|
+
sys.meta_path.insert(0, CaseInsensitiveFinder())
|
|
@@ -52,10 +52,16 @@ class MambuConnectorREST(MambuConnector, MambuConnectorReader, MambuConnectorWri
|
|
|
52
52
|
def __init__(self, user=apiuser, pwd=apipwd, url=apiurl, **kwargs):
|
|
53
53
|
self._headers = {
|
|
54
54
|
"Accept": "application/vnd.mambu.v2+json",
|
|
55
|
-
"Authorization": "Basic {}".format(
|
|
56
|
-
base64.b64encode(bytes("{}:{}".format(user, pwd), "utf-8")).decode()
|
|
57
|
-
),
|
|
58
55
|
}
|
|
56
|
+
self.__set_authorization_header(user, pwd)
|
|
57
|
+
self.__set_url(url)
|
|
58
|
+
|
|
59
|
+
def __set_authorization_header(self, user, pwd):
|
|
60
|
+
self._headers["Authorization"] = "Basic {}".format(
|
|
61
|
+
base64.b64encode(bytes("{}:{}".format(user, pwd), "utf-8")).decode()
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
def __set_url(self, url):
|
|
59
65
|
self._tenant = url
|
|
60
66
|
|
|
61
67
|
def __request_headers(self, method, content_type):
|
|
@@ -104,7 +110,7 @@ class MambuConnectorREST(MambuConnector, MambuConnectorReader, MambuConnectorWri
|
|
|
104
110
|
|
|
105
111
|
retry_strategy = Retry(
|
|
106
112
|
total=self._RETRIES,
|
|
107
|
-
status_forcelist=[429, 502, 503, 504],
|
|
113
|
+
status_forcelist=[429, 500, 502, 503, 504],
|
|
108
114
|
backoff_factor=1,
|
|
109
115
|
allowed_methods=[
|
|
110
116
|
"HEAD",
|
|
@@ -489,36 +495,48 @@ url %s, params %s, data %s, headers %s",
|
|
|
489
495
|
|
|
490
496
|
return self.__list_request("POST", url, params=params, data=data)
|
|
491
497
|
|
|
492
|
-
def mambu_update(self, entid, prefix, attrs):
|
|
498
|
+
def mambu_update(self, entid, prefix, attrs, **kwargs):
|
|
493
499
|
"""updates a mambu entity
|
|
494
500
|
|
|
495
501
|
Args:
|
|
496
502
|
entid (str): the id or encoded key of the entity owning the document
|
|
497
503
|
prefix (str): entity's URL prefix
|
|
498
504
|
attrs (dict): entity to be updated, complying with Mambu's schemas
|
|
505
|
+
kwargs (dict): keyword arguments for this method.
|
|
506
|
+
May include a user, pwd and url to connect to Mambu.
|
|
499
507
|
|
|
500
508
|
Returns:
|
|
501
509
|
response content (str json {})
|
|
502
510
|
"""
|
|
511
|
+
if "url" in kwargs:
|
|
512
|
+
self.__set_url(kwargs["url"])
|
|
513
|
+
if "user" in kwargs and "pwd" in kwargs:
|
|
514
|
+
self.__set_authorization_header(kwargs["user"], kwargs["pwd"])
|
|
503
515
|
url = "https://{}/api/{}/{}".format(self._tenant, prefix, entid)
|
|
504
516
|
|
|
505
517
|
return self.__request("PUT", url, data=attrs)
|
|
506
518
|
|
|
507
|
-
def mambu_create(self, prefix, attrs):
|
|
519
|
+
def mambu_create(self, prefix, attrs, **kwargs):
|
|
508
520
|
"""creates a mambu entity
|
|
509
521
|
|
|
510
522
|
Args:
|
|
511
523
|
prefix (str): entity's URL prefix
|
|
512
524
|
attrs (dict): entity to be created, complying with Mambu's schemas
|
|
525
|
+
kwargs (dict): keyword arguments for this method.
|
|
526
|
+
May include a user, pwd and url to connect to Mambu.
|
|
513
527
|
|
|
514
528
|
Returns:
|
|
515
529
|
response content (str json {})
|
|
516
530
|
"""
|
|
531
|
+
if "url" in kwargs:
|
|
532
|
+
self.__set_url(kwargs["url"])
|
|
533
|
+
if "user" in kwargs and "pwd" in kwargs:
|
|
534
|
+
self.__set_authorization_header(kwargs["user"], kwargs["pwd"])
|
|
517
535
|
url = "https://{}/api/{}".format(self._tenant, prefix)
|
|
518
536
|
|
|
519
537
|
return self.__request("POST", url, data=attrs)
|
|
520
538
|
|
|
521
|
-
def mambu_patch(self, entid, prefix, fields_ops=None):
|
|
539
|
+
def mambu_patch(self, entid, prefix, fields_ops=None, **kwargs):
|
|
522
540
|
"""patches certain parts of a mambu entity
|
|
523
541
|
|
|
524
542
|
https://api.mambu.com/?python#tocspatchoperation
|
|
@@ -532,10 +550,16 @@ url %s, params %s, data %s, headers %s",
|
|
|
532
550
|
OP (str): operation ("ADD", "REPLACE", "REMOVE")
|
|
533
551
|
PATH (str): json pointer referencing the location in the target entity
|
|
534
552
|
VALUE (obj, opc): the value of the field (not for REMOVE op)
|
|
553
|
+
kwargs (dict): keyword arguments for this method.
|
|
554
|
+
May include a user, pwd and url to connect to Mambu.
|
|
535
555
|
"""
|
|
536
556
|
if not fields_ops:
|
|
537
557
|
fields_ops = []
|
|
538
558
|
|
|
559
|
+
if "url" in kwargs:
|
|
560
|
+
self.__set_url(kwargs["url"])
|
|
561
|
+
if "user" in kwargs and "pwd" in kwargs:
|
|
562
|
+
self.__set_authorization_header(kwargs["user"], kwargs["pwd"])
|
|
539
563
|
url = "https://{}/api/{}/{}".format(self._tenant, prefix, entid)
|
|
540
564
|
|
|
541
565
|
# build data from fields_ops param
|
|
@@ -549,8 +573,16 @@ url %s, params %s, data %s, headers %s",
|
|
|
549
573
|
if patch_data:
|
|
550
574
|
return self.__request("PATCH", url, data=patch_data)
|
|
551
575
|
|
|
552
|
-
def mambu_delete(self, entid, prefix):
|
|
553
|
-
"""deletes a mambu entity
|
|
576
|
+
def mambu_delete(self, entid, prefix, **kwargs):
|
|
577
|
+
"""deletes a mambu entity
|
|
578
|
+
|
|
579
|
+
kwargs (dict): keyword arguments for this method.
|
|
580
|
+
May include a user, pwd and url to connect to Mambu.
|
|
581
|
+
"""
|
|
582
|
+
if "url" in kwargs:
|
|
583
|
+
self.__set_url(kwargs["url"])
|
|
584
|
+
if "user" in kwargs and "pwd" in kwargs:
|
|
585
|
+
self.__set_authorization_header(kwargs["user"], kwargs["pwd"])
|
|
554
586
|
url = "https://{}/api/{}/{}".format(self._tenant, prefix, entid)
|
|
555
587
|
|
|
556
588
|
return self.__request("DELETE", url)
|
|
@@ -428,19 +428,22 @@ class MambuEntity(MambuStruct):
|
|
|
428
428
|
class MambuEntityWritable(MambuStruct, MambuWritable):
|
|
429
429
|
"""A Mambu object with writing capabilities."""
|
|
430
430
|
|
|
431
|
-
def update(self):
|
|
431
|
+
def update(self, **kwargs):
|
|
432
432
|
"""updates a mambu entity
|
|
433
433
|
|
|
434
434
|
Uses the current values of the _attrs to send to Mambu.
|
|
435
435
|
Pre-requires that CustomFields are updated previously.
|
|
436
436
|
Post-requires that CustomFields are extracted again.
|
|
437
|
+
|
|
438
|
+
kwargs (dict): keyword arguments for this method.
|
|
439
|
+
May include a user, pwd and url to connect to Mambu.
|
|
437
440
|
"""
|
|
438
441
|
self._updateVOs()
|
|
439
442
|
self._updateCustomFields()
|
|
440
443
|
self._serializeFields()
|
|
441
444
|
try:
|
|
442
445
|
self._connector.mambu_update(
|
|
443
|
-
self.id, self._prefix, copy.deepcopy(self._attrs)
|
|
446
|
+
self.id, self._prefix, copy.deepcopy(self._attrs), **kwargs
|
|
444
447
|
)
|
|
445
448
|
# should I refresh _attrs? (either get request from Mambu or using the response)
|
|
446
449
|
except MambuError:
|
|
@@ -450,19 +453,22 @@ class MambuEntityWritable(MambuStruct, MambuWritable):
|
|
|
450
453
|
self._extractCustomFields()
|
|
451
454
|
self._extractVOs()
|
|
452
455
|
|
|
453
|
-
def create(self):
|
|
456
|
+
def create(self, **kwargs):
|
|
454
457
|
"""creates a mambu entity
|
|
455
458
|
|
|
456
459
|
Uses the current values of the _attrs to send to Mambu.
|
|
457
460
|
Pre-requires that CustomFields are updated previously.
|
|
458
461
|
Post-requires that CustomFields are extracted again.
|
|
462
|
+
|
|
463
|
+
kwargs (dict): keyword arguments for this method.
|
|
464
|
+
May include a user, pwd and url to connect to Mambu.
|
|
459
465
|
"""
|
|
460
466
|
self._updateVOs()
|
|
461
467
|
self._updateCustomFields()
|
|
462
468
|
self._serializeFields()
|
|
463
469
|
try:
|
|
464
470
|
self._resp = self._connector.mambu_create(
|
|
465
|
-
self._prefix, copy.deepcopy(self._attrs)
|
|
471
|
+
self._prefix, copy.deepcopy(self._attrs), **kwargs
|
|
466
472
|
)
|
|
467
473
|
self._attrs.update(dict(json.loads(self._resp.decode())))
|
|
468
474
|
self._tzattrs = dict(json.loads(self._resp.decode()))
|
|
@@ -516,7 +522,7 @@ class MambuEntityWritable(MambuStruct, MambuWritable):
|
|
|
516
522
|
else:
|
|
517
523
|
raise MambuPyError("Unrecognizable field {} for patching".format(field))
|
|
518
524
|
|
|
519
|
-
def patch(self, fields=None, autodetect_remove=False):
|
|
525
|
+
def patch(self, fields=None, autodetect_remove=False, **kwargs):
|
|
520
526
|
"""patches a mambu entity
|
|
521
527
|
|
|
522
528
|
Allows patching of parts of the entity up to Mambu.
|
|
@@ -583,7 +589,7 @@ class MambuEntityWritable(MambuStruct, MambuWritable):
|
|
|
583
589
|
self._updateCustomFields()
|
|
584
590
|
self._serializeFields()
|
|
585
591
|
if fields_ops:
|
|
586
|
-
self._connector.mambu_patch(self.id, self._prefix, fields_ops)
|
|
592
|
+
self._connector.mambu_patch(self.id, self._prefix, fields_ops, **kwargs)
|
|
587
593
|
# should I refresh _attrs? (needs get request from Mambu)
|
|
588
594
|
except MambuError:
|
|
589
595
|
raise
|
|
@@ -599,7 +605,7 @@ class MambuEntityWritable(MambuStruct, MambuWritable):
|
|
|
599
605
|
Implement on entities which require further cleaning.
|
|
600
606
|
"""
|
|
601
607
|
|
|
602
|
-
def delete(self):
|
|
608
|
+
def delete(self, **kwargs):
|
|
603
609
|
"""deletes a mambu entity.
|
|
604
610
|
|
|
605
611
|
Leaves the object in a supposedly state where you can create
|
|
@@ -610,7 +616,7 @@ class MambuEntityWritable(MambuStruct, MambuWritable):
|
|
|
610
616
|
make sure we can run creation after deletion.
|
|
611
617
|
"""
|
|
612
618
|
try:
|
|
613
|
-
self._connector.mambu_delete(self.id, self._prefix)
|
|
619
|
+
self._connector.mambu_delete(self.id, self._prefix, **kwargs)
|
|
614
620
|
except MambuError:
|
|
615
621
|
raise
|
|
616
622
|
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"""MambuPy's REST package (SOON TO BE DEPRECATED).
|
|
2
|
+
|
|
3
|
+
Objects using `Mambu REST API
|
|
4
|
+
<https://developer.mambu.com/customer/en/portal/articles/1162276-rest-apis-overview/>`_
|
|
5
|
+
|
|
6
|
+
.. autosummary::
|
|
7
|
+
:toctree: _autosummary
|
|
8
|
+
|
|
9
|
+
MambuPy.rest.mambustruct
|
|
10
|
+
MambuPy.rest.mambuclient
|
|
11
|
+
MambuPy.rest.mambugroup
|
|
12
|
+
MambuPy.rest.mambuloan
|
|
13
|
+
MambuPy.rest.mamburepayment
|
|
14
|
+
MambuPy.rest.mambutransaction
|
|
15
|
+
MambuPy.rest.mambuproduct
|
|
16
|
+
MambuPy.rest.mambubranch
|
|
17
|
+
MambuPy.rest.mambucentre
|
|
18
|
+
MambuPy.rest.mambuactivity
|
|
19
|
+
MambuPy.rest.mambutask
|
|
20
|
+
MambuPy.rest.mambusaving
|
|
21
|
+
MambuPy.rest.mambusavingtransaction
|
|
22
|
+
MambuPy.rest.mambutransactionchannel
|
|
23
|
+
MambuPy.rest.mambuuser
|
|
24
|
+
MambuPy.rest.mamburoles
|
|
25
|
+
|
|
26
|
+
.. warning:: This package is soon to be deprecated. Use the :any:`MambuPy.api` package instead.
|
|
27
|
+
|
|
28
|
+
The REST API way is the currently most developed code on *MambuPy*.
|
|
29
|
+
|
|
30
|
+
Lives under the :any:`MambuPy.rest` package
|
|
31
|
+
|
|
32
|
+
It has a lot of objects which model some Mambu entity.
|
|
33
|
+
|
|
34
|
+
Every object inherits from the parent :any:`mambustruct.MambuStruct`
|
|
35
|
+
class. Start at the documentation there for more info on how it works.
|
|
36
|
+
|
|
37
|
+
.. todo:: Implement objects to make POST requests. The suggestion may be to use
|
|
38
|
+
MambuStruct, to default the __init__ to make a POST request (via the data
|
|
39
|
+
argument) and the attrs attribute to store the elements of the response that
|
|
40
|
+
Mambu gives when a successful POST is achieved.
|
|
41
|
+
.. todo:: Implement a lot of other Mambu entities available through GET requests on
|
|
42
|
+
Mambu.
|
|
43
|
+
.. todo:: Implement a lot of lacking GET filters on the currently available Mambu
|
|
44
|
+
objects, inside the urlfuncs on the mambuutil module.
|
|
45
|
+
.. todo:: A lot of TODO comments are inserted inside the pydocs of the code
|
|
46
|
+
itself. Please read them for suggestions on work need to be done.
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
from .. import mambuconfig, mambuutil
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
"""Mambu Activity objects.
|
|
3
|
+
|
|
4
|
+
.. autosummary::
|
|
5
|
+
:nosignatures:
|
|
6
|
+
:toctree: _autosummary
|
|
7
|
+
|
|
8
|
+
MambuActivity holds a mambu activity. Don't instantiate this class
|
|
9
|
+
directly. Look at MambuActivity pydoc for further info.
|
|
10
|
+
|
|
11
|
+
MambuActivities holds a list of activities.
|
|
12
|
+
|
|
13
|
+
Uses mambugeturl.getactivitiesurl as default urlfunc
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
from ..mambugeturl import getactivitiesurl
|
|
18
|
+
from .mambustruct import MambuStruct
|
|
19
|
+
from .mamburestutils import MambuStructIterator
|
|
20
|
+
|
|
21
|
+
mod_urlfunc = getactivitiesurl
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class MambuActivity(MambuStruct):
|
|
25
|
+
"""A loan Activity from Mambu.
|
|
26
|
+
|
|
27
|
+
Don't instantiate this class directly. It's mostly used by
|
|
28
|
+
MambuActivities to configure each of its elements as
|
|
29
|
+
MambuActivity objects. There's no suitable urlfunc to use to
|
|
30
|
+
retrieve just a specific transaction from a loan account. In fact,
|
|
31
|
+
you can look at the code of MambuActivities.convert_dict_to_attrs(),
|
|
32
|
+
it uses urlfunc and entid = None , so no connection to Mambu will be
|
|
33
|
+
made, never, for any particular MambuActivity object.
|
|
34
|
+
"""
|
|
35
|
+
|
|
36
|
+
def __init__(self, urlfunc=mod_urlfunc, entid="", *args, **kwargs):
|
|
37
|
+
"""Tasks done here:
|
|
38
|
+
|
|
39
|
+
Just initializes the MambuStruct.
|
|
40
|
+
"""
|
|
41
|
+
MambuStruct.__init__(self, urlfunc, entid, *args, **kwargs)
|
|
42
|
+
|
|
43
|
+
def __repr__(self):
|
|
44
|
+
"""Instead of the default id given by the parent class, shows
|
|
45
|
+
the transactionid of the transaction.
|
|
46
|
+
"""
|
|
47
|
+
try:
|
|
48
|
+
return self.__class__.__name__ + " - activityid: %s" % self["activity"]
|
|
49
|
+
except KeyError:
|
|
50
|
+
return self.__class__.__name__ + " - activityid: %s" % self["activity"]
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class MambuActivities(MambuStruct):
|
|
54
|
+
"""A list of loan Activities from Mambu."""
|
|
55
|
+
|
|
56
|
+
def __init__(self, urlfunc=mod_urlfunc, entid="", *args, **kwargs):
|
|
57
|
+
MambuStruct.__init__(self, urlfunc, entid, *args, **kwargs)
|
|
58
|
+
|
|
59
|
+
def __iter__(self):
|
|
60
|
+
return MambuStructIterator(self.attrs)
|
|
61
|
+
|
|
62
|
+
def convert_dict_to_attrs(self, *args, **kwargs):
|
|
63
|
+
"""The trick for iterable Mambu Objects comes here:
|
|
64
|
+
|
|
65
|
+
You iterate over each element of the responded List from Mambu,
|
|
66
|
+
and create a Mambu Activity object for each one, initializing
|
|
67
|
+
them one at a time, and changing the attrs attribute (which just
|
|
68
|
+
holds a list of plain dictionaries) with a MambuActivity just
|
|
69
|
+
created.
|
|
70
|
+
|
|
71
|
+
"""
|
|
72
|
+
for n, a in enumerate(self.attrs):
|
|
73
|
+
# ok ok, I'm modifying elements of a list while iterating it. BAD PRACTICE!
|
|
74
|
+
try:
|
|
75
|
+
params = self.params
|
|
76
|
+
except AttributeError:
|
|
77
|
+
params = {}
|
|
78
|
+
kwargs.update(params)
|
|
79
|
+
try:
|
|
80
|
+
self.mambuactivityclass
|
|
81
|
+
except AttributeError:
|
|
82
|
+
self.mambuactivityclass = MambuActivity
|
|
83
|
+
|
|
84
|
+
activity = self.mambuactivityclass(urlfunc=None, entid=None, *args, **kwargs)
|
|
85
|
+
activity.init(a, *args, **kwargs)
|
|
86
|
+
activity._MambuStruct__urlfunc = getactivitiesurl
|
|
87
|
+
self.attrs[n] = activity
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
"""Mambu Branches objects.
|
|
3
|
+
|
|
4
|
+
.. autosummary::
|
|
5
|
+
:nosignatures:
|
|
6
|
+
:toctree: _autosummary
|
|
7
|
+
|
|
8
|
+
MambuBranch holds a branch.
|
|
9
|
+
|
|
10
|
+
MambuBranches holds a list of branches.
|
|
11
|
+
|
|
12
|
+
Uses mambugeturl.getbranchesurl as default urlfunc
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from ..mambugeturl import getbranchesurl
|
|
17
|
+
from .mambustruct import MambuStruct
|
|
18
|
+
from .mamburestutils import MambuStructIterator
|
|
19
|
+
|
|
20
|
+
mod_urlfunc = getbranchesurl
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class MambuBranch(MambuStruct):
|
|
24
|
+
"""A Branch from Mambu.
|
|
25
|
+
|
|
26
|
+
With the default urlfunc, entid argument must be the ID of the
|
|
27
|
+
branch you wish to retrieve.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(self, urlfunc=mod_urlfunc, entid="", *args, **kwargs):
|
|
31
|
+
"""Tasks done here:
|
|
32
|
+
|
|
33
|
+
Just initializes the MambuStruct.
|
|
34
|
+
"""
|
|
35
|
+
MambuStruct.__init__(
|
|
36
|
+
self, urlfunc, entid, custom_field_name="customFieldValues", *args, **kwargs
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
def setUsers(self, *args, **kwargs):
|
|
40
|
+
"""Adds the active users for this branch to a 'users' field.
|
|
41
|
+
|
|
42
|
+
Returns the number of requests done to Mambu.
|
|
43
|
+
|
|
44
|
+
.. todo:: since pagination logic was added, is not always true that
|
|
45
|
+
just 1 request was done. It may be more! But since request
|
|
46
|
+
counter singleton holds true information about how many requests
|
|
47
|
+
were done to Mambu, in fact this return value may be obsolete
|
|
48
|
+
"""
|
|
49
|
+
try:
|
|
50
|
+
self.mambuuserclass
|
|
51
|
+
except AttributeError:
|
|
52
|
+
from .mambuuser import MambuUsers
|
|
53
|
+
|
|
54
|
+
self.mambuusersclass = MambuUsers
|
|
55
|
+
|
|
56
|
+
usrs = [
|
|
57
|
+
us
|
|
58
|
+
for us in self.mambuusersclass(branchId=self["id"], *args, **kwargs)
|
|
59
|
+
if us["userState"] == "ACTIVE"
|
|
60
|
+
]
|
|
61
|
+
self["users"] = usrs
|
|
62
|
+
|
|
63
|
+
return 1
|
|
64
|
+
|
|
65
|
+
def update(self, *args, **kwargs):
|
|
66
|
+
"""Updates a branch from Mambu
|
|
67
|
+
"""
|
|
68
|
+
if "data" in kwargs:
|
|
69
|
+
data = kwargs.pop("data")
|
|
70
|
+
if data:
|
|
71
|
+
raise NotImplementedError
|
|
72
|
+
return super(MambuBranch, self).update(data={}, *args, **kwargs)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
class MambuBranches(MambuStruct):
|
|
76
|
+
"""A list of Branches from Mambu.
|
|
77
|
+
|
|
78
|
+
With the default urlfunc, entid argument must be empty at
|
|
79
|
+
instantiation time to retrieve all the branches according to any
|
|
80
|
+
other filter you send to the urlfunc.
|
|
81
|
+
"""
|
|
82
|
+
|
|
83
|
+
def __init__(self, urlfunc=mod_urlfunc, entid="", *args, **kwargs):
|
|
84
|
+
"""By default, entid argument is empty. That makes perfect
|
|
85
|
+
sense: you want several branches, not just one
|
|
86
|
+
"""
|
|
87
|
+
MambuStruct.__init__(self, urlfunc, entid, *args, **kwargs)
|
|
88
|
+
|
|
89
|
+
def __iter__(self):
|
|
90
|
+
return MambuStructIterator(self.attrs)
|
|
91
|
+
|
|
92
|
+
def convert_dict_to_attrs(self, *args, **kwargs):
|
|
93
|
+
"""The trick for iterable Mambu Objects comes here:
|
|
94
|
+
|
|
95
|
+
You iterate over each element of the responded List from Mambu,
|
|
96
|
+
and create a Mambu Branch object for each one, initializing them
|
|
97
|
+
one at a time, and changing the attrs attribute (which just
|
|
98
|
+
holds a list of plain dictionaries) with a MambuBranch just
|
|
99
|
+
created.
|
|
100
|
+
|
|
101
|
+
.. todo:: pass a valid (perhaps default) urlfunc, and its
|
|
102
|
+
corresponding id to entid to each MambuBranch, telling
|
|
103
|
+
MambuStruct not to connect() by default. It's desirable to
|
|
104
|
+
connect at any other further moment to refresh some element in
|
|
105
|
+
the list.
|
|
106
|
+
"""
|
|
107
|
+
for n, b in enumerate(self.attrs):
|
|
108
|
+
# ok ok, I'm modifying elements of a list while iterating it. BAD PRACTICE!
|
|
109
|
+
try:
|
|
110
|
+
params = self.params
|
|
111
|
+
except AttributeError:
|
|
112
|
+
params = {}
|
|
113
|
+
kwargs.update(params)
|
|
114
|
+
try:
|
|
115
|
+
self.mambubranchclass
|
|
116
|
+
except AttributeError:
|
|
117
|
+
self.mambubranchclass = MambuBranch
|
|
118
|
+
|
|
119
|
+
branch = self.mambubranchclass(urlfunc=None, entid=None, *args, **kwargs)
|
|
120
|
+
branch.init(b, *args, **kwargs)
|
|
121
|
+
branch._MambuStruct__urlfunc = getbranchesurl
|
|
122
|
+
self.attrs[n] = branch
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# coding: utf-8
|
|
2
|
+
"""Mambu Centres objects.
|
|
3
|
+
|
|
4
|
+
.. autosummary::
|
|
5
|
+
:nosignatures:
|
|
6
|
+
:toctree: _autosummary
|
|
7
|
+
|
|
8
|
+
MambuCentre holds a centre.
|
|
9
|
+
|
|
10
|
+
MambuCentres holds a list of centres.
|
|
11
|
+
|
|
12
|
+
Uses mambugeturl.getcentresurl as default urlfunc
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
from ..mambugeturl import getcentresurl
|
|
17
|
+
from .mambustruct import MambuStruct
|
|
18
|
+
from .mamburestutils import MambuStructIterator
|
|
19
|
+
|
|
20
|
+
mod_urlfunc = getcentresurl
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class MambuCentre(MambuStruct):
|
|
24
|
+
"""A Centre from Mambu.
|
|
25
|
+
|
|
26
|
+
With the default urlfunc, entid argument must be the ID of the
|
|
27
|
+
centre you wish to retrieve.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
def __init__(self, urlfunc=mod_urlfunc, entid="", *args, **kwargs):
|
|
31
|
+
"""Tasks done here:
|
|
32
|
+
|
|
33
|
+
Just initializes the MambuStruct.
|
|
34
|
+
"""
|
|
35
|
+
MambuStruct.__init__(
|
|
36
|
+
self, urlfunc, entid, custom_field_name="customFieldValues", *args, **kwargs
|
|
37
|
+
)
|
|
38
|
+
|
|
39
|
+
def setBranch(self, *args, **kwargs):
|
|
40
|
+
"""Adds the branch for this centre to a 'branch' field.
|
|
41
|
+
|
|
42
|
+
Returns the number of requests done to Mambu.
|
|
43
|
+
"""
|
|
44
|
+
try:
|
|
45
|
+
self.mambubranchclass
|
|
46
|
+
except AttributeError:
|
|
47
|
+
from .mambubranch import MambuBranch
|
|
48
|
+
|
|
49
|
+
self.mambubranchclass = MambuBranch
|
|
50
|
+
|
|
51
|
+
brnch = self.mambubranchclass(entid=self["assignedBranchKey"], *args, **kwargs)
|
|
52
|
+
self["branch"] = brnch
|
|
53
|
+
|
|
54
|
+
return 1
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class MambuCentres(MambuStruct):
|
|
58
|
+
"""A list of Centres from Mambu.
|
|
59
|
+
|
|
60
|
+
With the default urlfunc, entid argument must be empty at
|
|
61
|
+
instantiation time to retrieve all the centres according to any
|
|
62
|
+
other filter you send to the urlfunc.
|
|
63
|
+
"""
|
|
64
|
+
|
|
65
|
+
def __init__(self, urlfunc=mod_urlfunc, entid="", *args, **kwargs):
|
|
66
|
+
"""By default, entid argument is empty. That makes perfect
|
|
67
|
+
sense: you want several centres, not just one
|
|
68
|
+
"""
|
|
69
|
+
MambuStruct.__init__(self, urlfunc, entid, *args, **kwargs)
|
|
70
|
+
|
|
71
|
+
def __iter__(self):
|
|
72
|
+
return MambuStructIterator(self.attrs)
|
|
73
|
+
|
|
74
|
+
def convert_dict_to_attrs(self, *args, **kwargs):
|
|
75
|
+
"""The trick for iterable Mambu Objects comes here:
|
|
76
|
+
|
|
77
|
+
You iterate over each element of the responded List from Mambu,
|
|
78
|
+
and create a Mambu Centre object for each one, initializing them
|
|
79
|
+
one at a time, and changing the attrs attribute (which just
|
|
80
|
+
holds a list of plain dictionaries) with a MambuCentre just
|
|
81
|
+
created.
|
|
82
|
+
|
|
83
|
+
.. todo:: pass a valid (perhaps default) urlfunc, and its
|
|
84
|
+
corresponding id to entid to each MambuCentre, telling
|
|
85
|
+
MambuStruct not to connect() by default. It's desirable to
|
|
86
|
+
connect at any other further moment to refresh some element in
|
|
87
|
+
the list.
|
|
88
|
+
"""
|
|
89
|
+
for n, b in enumerate(self.attrs):
|
|
90
|
+
# ok ok, I'm modifying elements of a list while iterating it. BAD PRACTICE!
|
|
91
|
+
try:
|
|
92
|
+
params = self.params
|
|
93
|
+
except AttributeError:
|
|
94
|
+
params = {}
|
|
95
|
+
kwargs.update(params)
|
|
96
|
+
try:
|
|
97
|
+
self.mambucentreclass
|
|
98
|
+
except AttributeError:
|
|
99
|
+
self.mambucentreclass = MambuCentre
|
|
100
|
+
|
|
101
|
+
centre = self.mambucentreclass(urlfunc=None, entid=None, *args, **kwargs)
|
|
102
|
+
centre.init(b, *args, **kwargs)
|
|
103
|
+
centre._MambuStruct__urlfunc = getcentresurl
|
|
104
|
+
self.attrs[n] = centre
|