lino 25.3.0__py3-none-any.whl → 25.3.2__py3-none-any.whl
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.
- lino/__init__.py +6 -7
- lino/api/dd.py +1 -0
- lino/api/doctest.py +35 -102
- lino/api/rt.py +2 -4
- lino/core/actors.py +22 -16
- lino/core/boundaction.py +17 -7
- lino/core/dashboard.py +5 -4
- lino/core/dbtables.py +15 -16
- lino/core/fields.py +3 -3
- lino/core/inject.py +7 -6
- lino/core/kernel.py +0 -46
- lino/core/menus.py +1 -1
- lino/core/model.py +18 -16
- lino/core/plugin.py +4 -4
- lino/core/renderer.py +10 -11
- lino/core/requests.py +11 -7
- lino/core/site.py +84 -30
- lino/core/tables.py +2 -2
- lino/core/utils.py +3 -3
- lino/core/views.py +3 -3
- lino/help_texts.py +1 -0
- lino/management/commands/buildsite.py +57 -0
- lino/management/commands/initdb.py +12 -14
- lino/management/commands/prep.py +1 -1
- lino/mixins/sequenced.py +1 -1
- lino/modlib/comments/models.py +1 -1
- lino/modlib/comments/ui.py +2 -2
- lino/modlib/extjs/ext_renderer.py +2 -2
- lino/modlib/extjs/views.py +50 -48
- lino/modlib/help/config/makehelp/model.tpl.rst +1 -1
- lino/modlib/help/management/commands/makehelp.py +11 -7
- lino/modlib/jinja/mixins.py +2 -2
- lino/modlib/jinja/renderer.py +2 -2
- lino/modlib/linod/management/commands/linod.py +5 -2
- lino/modlib/linod/mixins.py +3 -0
- lino/modlib/memo/__init__.py +1 -1
- lino/modlib/printing/mixins.py +3 -0
- lino/modlib/publisher/choicelists.py +3 -3
- lino/modlib/publisher/views.py +2 -2
- lino/modlib/search/models.py +5 -5
- lino/modlib/system/choicelists.py +6 -3
- lino/modlib/tinymce/views.py +1 -1
- lino/modlib/uploads/models.py +7 -6
- lino/modlib/users/ui.py +2 -3
- lino/utils/__init__.py +4 -1
- lino/utils/diag.py +1 -1
- lino/utils/fieldutils.py +79 -0
- {lino-25.3.0.dist-info → lino-25.3.2.dist-info}/METADATA +1 -1
- {lino-25.3.0.dist-info → lino-25.3.2.dist-info}/RECORD +52 -71
- lino/sandbox/bcss/PerformInvestigation.py +0 -2260
- lino/sandbox/bcss/SSDNReply.py +0 -3924
- lino/sandbox/bcss/SSDNRequest.py +0 -3723
- lino/sandbox/bcss/__init__.py +0 -0
- lino/sandbox/bcss/readme.txt +0 -1
- lino/sandbox/bcss/test.py +0 -92
- lino/sandbox/bcss/test2.py +0 -128
- lino/sandbox/bcss/test3.py +0 -161
- lino/sandbox/bcss/test4.py +0 -167
- lino/sandbox/contacts/__init__.py +0 -0
- lino/sandbox/contacts/fixtures/__init__.py +0 -0
- lino/sandbox/contacts/fixtures/demo.py +0 -365
- lino/sandbox/contacts/manage.py +0 -10
- lino/sandbox/contacts/models.py +0 -395
- lino/sandbox/contacts/settings.py +0 -67
- lino/sandbox/tx25/XSD/RetrieveTIGroupsV3.wsdl +0 -65
- lino/sandbox/tx25/XSD/RetrieveTIGroupsV3.xsd +0 -286
- lino/sandbox/tx25/XSD/rn25_Release201104.xsd +0 -2855
- lino/sandbox/tx25/xsd2py1.py +0 -68
- lino/sandbox/tx25/xsd2py2.py +0 -62
- lino/sandbox/tx25/xsd2py3.py +0 -56
- {lino-25.3.0.dist-info → lino-25.3.2.dist-info}/WHEEL +0 -0
- {lino-25.3.0.dist-info → lino-25.3.2.dist-info}/licenses/AUTHORS.rst +0 -0
- {lino-25.3.0.dist-info → lino-25.3.2.dist-info}/licenses/COPYING +0 -0
lino/sandbox/bcss/__init__.py
DELETED
File without changes
|
lino/sandbox/bcss/readme.txt
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
Code in this directory is not maintained.
|
lino/sandbox/bcss/test.py
DELETED
@@ -1,92 +0,0 @@
|
|
1
|
-
# -*- coding: UTF-8 -*-
|
2
|
-
"""
|
3
|
-
|
4
|
-
Send a SOAP request to the :term: `BCSS` server
|
5
|
-
using Dave Kuhlmann's :term:`generateDS` (version 2.6a).
|
6
|
-
|
7
|
-
I got a set of XSD files that describe the services provided by the
|
8
|
-
BCSS. I could sucessfully convert them to Python modules using
|
9
|
-
commands like::
|
10
|
-
|
11
|
-
python -m generateDS -o SSDNRequest.py XSD\SSDN\SERVICE\SSDNREQUEST.XSD
|
12
|
-
|
13
|
-
(See :srcref:`xsd2py.bat </lino/sandbox/bcss/xsd2py.bat>`
|
14
|
-
for the actual commands used on a windows machine.)
|
15
|
-
|
16
|
-
Currently only the `SSDNRequest.py` module is being used,
|
17
|
-
you can browse the input XSD
|
18
|
-
:srcref:`here </lino/sandbox/bcss/XSD/SSDN/SERVICE/SSDNREQUEST.XSD>`
|
19
|
-
and the generated source code
|
20
|
-
:srcref:`here </lino/sandbox/bcss/SSDNRequest.py>`.
|
21
|
-
|
22
|
-
Running the :mod:`lino.sandbox.bcss.test` module
|
23
|
-
(source code :srcref:`here </lino/sandbox/bcss/test.py>`)
|
24
|
-
should simply output an XML string to stdout.
|
25
|
-
My problem is that it causes a traceback::
|
26
|
-
|
27
|
-
Traceback (most recent call last):
|
28
|
-
File "test.py", line 45, in <module>
|
29
|
-
req.export(f,0)
|
30
|
-
File "SSDNRequest.py", line 613, in export
|
31
|
-
self.exportChildren(outfile, level + 1, namespace_, name_)
|
32
|
-
File "SSDNRequest.py", line 622, in exportChildren
|
33
|
-
self.RequestContext.export(outfile, level, namespace_, name_='RequestContext', )
|
34
|
-
File "SSDNRequest.py", line 525, in export
|
35
|
-
self.exportChildren(outfile, level + 1, namespace_, name_)
|
36
|
-
File "SSDNRequest.py", line 534, in exportChildren
|
37
|
-
self.AuthorizedUser.export(outfile, level, namespace_, name_='AuthorizedUser', )
|
38
|
-
File "SSDNRequest.py", line 800, in export
|
39
|
-
self.exportChildren(outfile, level + 1, namespace_, name_)
|
40
|
-
File "SSDNRequest.py", line 810, in exportChildren
|
41
|
-
outfile.write('<%sUserID>%s</%sUserID>\\n' % (namespace_, self.gds_format_string(quote_xml(self.UserID).encode(ExternalEncoding), input_name='UserID'), namespace_))
|
42
|
-
AttributeError: 'AuthorizedUserType' object has no attribute 'gds_format_string'
|
43
|
-
|
44
|
-
What is going wrong?
|
45
|
-
|
46
|
-
|
47
|
-
"""
|
48
|
-
import sys
|
49
|
-
import SSDNRequest
|
50
|
-
# ~ import PerformInvestigation
|
51
|
-
|
52
|
-
from cStringIO import StringIO
|
53
|
-
|
54
|
-
|
55
|
-
def main():
|
56
|
-
user = SSDNRequest.AuthorizedUserType(
|
57
|
-
UserID="123", Email="123@example.com", OrgUnit="123", MatrixID=12, MatrixSubID=3
|
58
|
-
)
|
59
|
-
service = SSDNRequest.ServiceRequestType(ServiceId="Test", Version="20090409")
|
60
|
-
msg = SSDNRequest.RequestMessageType(
|
61
|
-
Reference="123456789", TimeRequest="20110921T105230"
|
62
|
-
)
|
63
|
-
context = SSDNRequest.RequestContextType(AuthorizedUser=user, Message=msg)
|
64
|
-
req = SSDNRequest.SSDNRequest(RequestContext=context, ServiceRequest=[service])
|
65
|
-
|
66
|
-
f = StringIO()
|
67
|
-
req.export(f, 0)
|
68
|
-
xmlrequest = f.getvalue()
|
69
|
-
f.close()
|
70
|
-
|
71
|
-
# ~ The SOAP Envelope element is the root element of a SOAP message.
|
72
|
-
# ~ http://www.w3schools.com/soap/soap_envelope.asp
|
73
|
-
|
74
|
-
soap_envelope = """
|
75
|
-
<?xml version="1.0" encoding="utf-8"?>
|
76
|
-
<soap:Envelope
|
77
|
-
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
|
78
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
79
|
-
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
80
|
-
<soap:Body>
|
81
|
-
<xmlString xmlns="http://ksz-bcss.fgov.be/connectors/WebServiceConnector">
|
82
|
-
<![CDATA[%s]]>
|
83
|
-
</xmlString>
|
84
|
-
</soap:Body>
|
85
|
-
</soap:Envelope>
|
86
|
-
"""
|
87
|
-
|
88
|
-
print(soap_envelope % xmlrequest)
|
89
|
-
|
90
|
-
|
91
|
-
if __name__ == "__main__":
|
92
|
-
main()
|
lino/sandbox/bcss/test2.py
DELETED
@@ -1,128 +0,0 @@
|
|
1
|
-
# -*- coding: UTF-8 -*-
|
2
|
-
"""
|
3
|
-
Send a SOAP request to the :term: `BCSS` server
|
4
|
-
using Dave Kuhlmann's :term:`generateDS` (version 2.6a).
|
5
|
-
|
6
|
-
Continued from :mod:`lino.sandbox.bcss.test`.
|
7
|
-
File :file:`SSDNRequest.py` has been modified manually
|
8
|
-
for <any> support according to Dave's instructions.
|
9
|
-
|
10
|
-
When running this script you need to set your
|
11
|
-
DJANGO_SETTINGS_MODULE environment variable
|
12
|
-
which points to a :xfile:`settings.py`
|
13
|
-
that defines your :attr:`lino.Lino.bcss_user_params`.
|
14
|
-
Since this script doesn't actually perform any connection,
|
15
|
-
the `bcss_user_params` may contain fictive values.
|
16
|
-
But they must exist.
|
17
|
-
|
18
|
-
"""
|
19
|
-
|
20
|
-
import sys
|
21
|
-
from cStringIO import StringIO
|
22
|
-
|
23
|
-
from lino import logger
|
24
|
-
|
25
|
-
from SOAPpy import WSDL
|
26
|
-
import SSDNRequest
|
27
|
-
# ~ import PerformInvestigation
|
28
|
-
|
29
|
-
from django.conf import settings
|
30
|
-
|
31
|
-
# ~ The SOAP Envelope element is the root element of a SOAP message.
|
32
|
-
# ~ http://www.w3schools.com/soap/soap_envelope.asp
|
33
|
-
|
34
|
-
SOAP_ENVELOPE = """
|
35
|
-
<?xml version="1.0" encoding="utf-8"?>
|
36
|
-
<soap:Envelope
|
37
|
-
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
|
38
|
-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
39
|
-
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
40
|
-
<soap:Body>
|
41
|
-
<xmlString xmlns="http://ksz-bcss.fgov.be/connectors/WebServiceConnector">
|
42
|
-
<![CDATA[%s]]>
|
43
|
-
</xmlString>
|
44
|
-
</soap:Body>
|
45
|
-
</soap:Envelope>
|
46
|
-
"""
|
47
|
-
|
48
|
-
|
49
|
-
class Service:
|
50
|
-
# ,*args,**kw):
|
51
|
-
|
52
|
-
def __init__(self, name, requestClass, targetNamespace, doc):
|
53
|
-
self.name = name
|
54
|
-
self.requestClass = requestClass
|
55
|
-
self.targetNamespace = targetNamespace
|
56
|
-
self.doc = doc
|
57
|
-
# ~ self.args = args
|
58
|
-
# ~ self.kw = kw
|
59
|
-
|
60
|
-
def instantiate(self, *args, **kw):
|
61
|
-
return self.requestClass(*args, **kw)
|
62
|
-
|
63
|
-
|
64
|
-
from PerformInvestigation import PerformInvestigationRequest
|
65
|
-
|
66
|
-
SERVICES = []
|
67
|
-
|
68
|
-
SERVICES.append(
|
69
|
-
Service(
|
70
|
-
"OCMWCPASPerformInvestigation",
|
71
|
-
PerformInvestigationRequest,
|
72
|
-
"http://www.ksz-bcss.fgov.be/XSD/SSDN/OCMW_CPAS/PerformInvestigation",
|
73
|
-
"""
|
74
|
-
Obtention d’informations des registres national et BCSS
|
75
|
-
en vue de l’enquête sociale (données légales, composition
|
76
|
-
de ménage, historique des adresses, recherche dans le
|
77
|
-
fichier d’attente).
|
78
|
-
|
79
|
-
Instance parameters:
|
80
|
-
|
81
|
-
- SocialSecurityUser (string)
|
82
|
-
- DataGroups : The possible types of information that can be obtained.
|
83
|
-
If not specified, all available information is returned
|
84
|
-
""",
|
85
|
-
)
|
86
|
-
)
|
87
|
-
|
88
|
-
|
89
|
-
def req2str(req):
|
90
|
-
f = StringIO()
|
91
|
-
req.export(f, 0)
|
92
|
-
s = f.getvalue()
|
93
|
-
f.close()
|
94
|
-
return s
|
95
|
-
|
96
|
-
|
97
|
-
def run_request(serviceId, *args, **kw):
|
98
|
-
srv = SERVICES[serviceId]
|
99
|
-
srvReq = srv.instantiate(*args, **kw)
|
100
|
-
user = SSDNRequest.AuthorizedUserType(**settings.SITE.bcss_user_params)
|
101
|
-
service = SSDNRequest.ServiceRequestType(
|
102
|
-
ServiceId=srv.name, Version="20090409", any_=srvReq
|
103
|
-
)
|
104
|
-
msg = SSDNRequest.RequestMessageType(
|
105
|
-
Reference="123456789", TimeRequest="20110921T105230"
|
106
|
-
)
|
107
|
-
context = SSDNRequest.RequestContextType(AuthorizedUser=user, Message=msg)
|
108
|
-
req = SSDNRequest.SSDNRequest(RequestContext=context, ServiceRequest=[service])
|
109
|
-
|
110
|
-
requestXML = SOAP_ENVELOPE % req2str(req)
|
111
|
-
|
112
|
-
print(requestXML)
|
113
|
-
if False:
|
114
|
-
logger.info("Going to send request:\n%s", requestXML)
|
115
|
-
proxy = WSDL.Proxy(wsdl_url)
|
116
|
-
# ~ proxy.soapproxy.config.dumpSOAPOut = 1
|
117
|
-
# ~ proxy.soapproxy.config.dumpSOAPIn = 1
|
118
|
-
m = proxy.methods["sendXML"]
|
119
|
-
response = m(requestXML)
|
120
|
-
logger.info("Got response:\n%s", response)
|
121
|
-
|
122
|
-
|
123
|
-
def simple_test():
|
124
|
-
run_request(0, SocialSecurityUser="36806010010")
|
125
|
-
|
126
|
-
|
127
|
-
if __name__ == "__main__":
|
128
|
-
simple_test()
|
lino/sandbox/bcss/test3.py
DELETED
@@ -1,161 +0,0 @@
|
|
1
|
-
# -*- coding: UTF-8 -*-
|
2
|
-
"""
|
3
|
-
Send a SOAP request to the :term: `BCSS` server
|
4
|
-
using Gaëtan Delannay's :term:`appy` toolkit.
|
5
|
-
|
6
|
-
"""
|
7
|
-
|
8
|
-
import sys
|
9
|
-
from cStringIO import StringIO
|
10
|
-
|
11
|
-
from lino import logger
|
12
|
-
|
13
|
-
import SSDNRequest
|
14
|
-
|
15
|
-
from appy import Object
|
16
|
-
from appy.shared.dav import Resource
|
17
|
-
from appy.shared.xml_parser import XmlUnmarshaller, XmlMarshaller
|
18
|
-
from xml.dom.minidom import parseString
|
19
|
-
|
20
|
-
# ~ from django.conf import settings.SITE
|
21
|
-
# simulate a Django `settings.SITE` module:
|
22
|
-
settings = Object(
|
23
|
-
SITE=Object(
|
24
|
-
bcss_user_params=dict(
|
25
|
-
UserID="123456",
|
26
|
-
Email="info@exemple.be",
|
27
|
-
OrgUnit="0123456",
|
28
|
-
MatrixID=17,
|
29
|
-
MatrixSubID=1,
|
30
|
-
)
|
31
|
-
)
|
32
|
-
)
|
33
|
-
|
34
|
-
|
35
|
-
class AnyMarshaller(XmlMarshaller):
|
36
|
-
"""
|
37
|
-
An XmlMarshaller who expects an attribute `_any` on its
|
38
|
-
root instance which is expected to contain a string to be
|
39
|
-
written after the other child elements.
|
40
|
-
"""
|
41
|
-
|
42
|
-
fieldsToExclude = ["_any"]
|
43
|
-
|
44
|
-
def marshallSpecificElements(self, instance, res):
|
45
|
-
res.write(instance._any)
|
46
|
-
|
47
|
-
|
48
|
-
def assert_equivalent(xs1, xs2):
|
49
|
-
print("xs1: -------------------")
|
50
|
-
print(xs1)
|
51
|
-
print("xs2: -------------------")
|
52
|
-
print(xs2)
|
53
|
-
print("-------------------")
|
54
|
-
dom1 = parseString(xs1)
|
55
|
-
dom2 = parseString(xs2)
|
56
|
-
if dom1 != dom2:
|
57
|
-
sys.exit()
|
58
|
-
|
59
|
-
|
60
|
-
def main():
|
61
|
-
allocationReq1 = """<ns1:AllocationRequest xmlns:ns1="http://www.smals.be/XSD/OCMW_CPAS/HeatingAllocationRequest" xmlns:com="http://www.smals.be/XSD/OCMW_CPAS/HeatingAllocationDataTypes"><ns1:ComputeAllocation><ns1:PrimaryBeneficiary><ns1:SSIN>67031703807</ns1:SSIN><ns1:Category>1</ns1:Category></ns1:PrimaryBeneficiary><ns1:Invoice><com:Amount>8390100</com:Amount><com:Quantity>1000</com:Quantity><com:HousingNumber>1</com:HousingNumber><com:DeliveryDate>2011-09-19</com:DeliveryDate><com:UnitFuel>3</com:UnitFuel></ns1:Invoice></ns1:ComputeAllocation><ns1:OCMW_CPAS><ns1:KboBceNumber>0212344876</ns1:KboBceNumber></ns1:OCMW_CPAS></ns1:AllocationRequest>"""
|
62
|
-
|
63
|
-
ssin = "67031703807"
|
64
|
-
|
65
|
-
allocationReq = Object(
|
66
|
-
ComputeAllocation=Object(
|
67
|
-
Invoice=Object(
|
68
|
-
Amount="8390100",
|
69
|
-
Quantity=1000,
|
70
|
-
HousingNumber=1,
|
71
|
-
DeliveryDate="2011-09-19",
|
72
|
-
UnitFuel=3,
|
73
|
-
),
|
74
|
-
PrimaryBeneficiary=Object(SSIN=ssin, Category="1"),
|
75
|
-
),
|
76
|
-
OCMW_CPAS=Object(KboBceNumber="0212344876"),
|
77
|
-
)
|
78
|
-
|
79
|
-
ns = dict(
|
80
|
-
ns1="http://www.smals.be/XSD/OCMW_CPAS/HeatingAllocationRequest",
|
81
|
-
com="http://www.smals.be/XSD/OCMW_CPAS/HeatingAllocationDataTypes",
|
82
|
-
)
|
83
|
-
nst = dict()
|
84
|
-
nst.update(AllocationRequest="ns1")
|
85
|
-
nst.update(ComputeAllocation="ns1")
|
86
|
-
nst.update(OCMW_CPAS="ns1")
|
87
|
-
nst.update(KboBceNumber="ns1")
|
88
|
-
nst.update(Invoice="ns1")
|
89
|
-
nst.update(Quantity="com")
|
90
|
-
nst.update(HousingNumber="com")
|
91
|
-
nst.update(DeliveryDate="com")
|
92
|
-
nst.update(UnitFuel="com")
|
93
|
-
|
94
|
-
m = XmlMarshaller(
|
95
|
-
namespaces=ns,
|
96
|
-
namespacedTags=nst,
|
97
|
-
dumpXmlPrologue=False,
|
98
|
-
rootTag="AllocationRequest",
|
99
|
-
)
|
100
|
-
allocationReq2 = m.marshall(allocationReq)
|
101
|
-
|
102
|
-
# ~ assert_equivalent(allocationReq1,allocationReq2)
|
103
|
-
|
104
|
-
contenu1 = (
|
105
|
-
"""<SSDNRequest xmlns="http://www.ksz-bcss.fgov.be/XSD/SSDN/Service">
|
106
|
-
<RequestContext><AuthorizedUser><UserID>00901732883</UserID><Email>info@oshz.eupen.net</Email><OrgUnit>0212344876</OrgUnit><MatrixID>17</MatrixID><MatrixSubID>1</MatrixSubID></AuthorizedUser><Message><Reference>630230001126766</Reference><TimeRequest>20110921T105230</TimeRequest></Message></RequestContext><ServiceRequest><ServiceId>OCMWCPASHeatingAllocation</ServiceId><Version>20090409</Version>
|
107
|
-
%s
|
108
|
-
</ServiceRequest></SSDNRequest>"""
|
109
|
-
% allocationReq1
|
110
|
-
)
|
111
|
-
|
112
|
-
ssdnReq = Object(
|
113
|
-
RequestContext=Object(
|
114
|
-
AuthorizedUser=Object(**settings.SITE.bcss_user_params),
|
115
|
-
Message=Object(Reference="630230001126766", TimeRequest="20110921T105230"),
|
116
|
-
),
|
117
|
-
ServiceRequest=Object(
|
118
|
-
ServiceId="OCMWCPASHeatingAllocation", Version="20090409"
|
119
|
-
),
|
120
|
-
_any=allocationReq2,
|
121
|
-
)
|
122
|
-
|
123
|
-
ns = dict(xmlns="http://www.ksz-bcss.fgov.be/XSD/SSDN/Service")
|
124
|
-
m = AnyMarshaller(namespaces=ns, dumpXmlPrologue=False, rootTag="SSDNRequest")
|
125
|
-
contenu2 = m.marshall(ssdnReq)
|
126
|
-
|
127
|
-
assert_equivalent(contenu1, contenu2)
|
128
|
-
|
129
|
-
body = Object(
|
130
|
-
# ~ xmlString="<![CDATA[%s]]>" % contenu)
|
131
|
-
xmlString=contenu2
|
132
|
-
)
|
133
|
-
|
134
|
-
raise Exception("ok jusqu'ici")
|
135
|
-
|
136
|
-
server = Resource(
|
137
|
-
"https://bcssksz-services-test.smals.be/connectors/webservice/KSZBCSSWebServiceConnectorPort",
|
138
|
-
measure=True,
|
139
|
-
)
|
140
|
-
|
141
|
-
res = server.soap(
|
142
|
-
body, namespace="http://ksz-bcss.fgov.be/connectors/WebServiceConnector"
|
143
|
-
)
|
144
|
-
|
145
|
-
print(res.code)
|
146
|
-
print(res.data)
|
147
|
-
|
148
|
-
s = str(res.data.xmlString)
|
149
|
-
# ~ s = res.data.xmlString.replace('"UTF-8"','"utf-8"')
|
150
|
-
# ~ s = s.replace('?>','?>\n')
|
151
|
-
print(s)
|
152
|
-
|
153
|
-
reply = XmlUnmarshaller().parse(s)
|
154
|
-
|
155
|
-
import pdb
|
156
|
-
|
157
|
-
pdb.set_trace()
|
158
|
-
|
159
|
-
|
160
|
-
if __name__ == "__main__":
|
161
|
-
main()
|
lino/sandbox/bcss/test4.py
DELETED
@@ -1,167 +0,0 @@
|
|
1
|
-
# -*- coding: UTF-8 -*-
|
2
|
-
"""
|
3
|
-
Send a SOAP request to the :term: `BCSS` server
|
4
|
-
using Gaëtan Delannay's :term:`appy` toolkit.
|
5
|
-
|
6
|
-
test4 : Using a class AnyMarshaller and a slightly
|
7
|
-
modified `xml_parser.py` to support ANY elements.
|
8
|
-
|
9
|
-
"""
|
10
|
-
|
11
|
-
import sys
|
12
|
-
from cStringIO import StringIO
|
13
|
-
|
14
|
-
from lino import logger
|
15
|
-
|
16
|
-
from appy import Object
|
17
|
-
from appy.shared.dav import Resource
|
18
|
-
from appy.shared.xml_parser import XmlUnmarshaller, XmlMarshaller
|
19
|
-
from xml.dom.minidom import parseString
|
20
|
-
|
21
|
-
# ~ from django.conf import settings
|
22
|
-
# simulate a Django `settings` module:
|
23
|
-
settings = Object(
|
24
|
-
SITE=Object(
|
25
|
-
bcss_user_params=dict(
|
26
|
-
UserID="123456",
|
27
|
-
Email="info@exemple.be",
|
28
|
-
OrgUnit="0123456",
|
29
|
-
MatrixID=17,
|
30
|
-
MatrixSubID=1,
|
31
|
-
)
|
32
|
-
)
|
33
|
-
)
|
34
|
-
|
35
|
-
|
36
|
-
class AnyMarshaller(XmlMarshaller):
|
37
|
-
"""
|
38
|
-
An XmlMarshaller who expects an attribute `_any` on its
|
39
|
-
root instance which is expected to contain a string to be
|
40
|
-
written after the other child elements.
|
41
|
-
"""
|
42
|
-
|
43
|
-
fieldsToExclude = ["_any"]
|
44
|
-
|
45
|
-
def marshallSpecificElements(self, instance, res):
|
46
|
-
res.write(instance._any)
|
47
|
-
|
48
|
-
|
49
|
-
def assert_equivalent(xs1, xs2):
|
50
|
-
print("xs1: -------------------")
|
51
|
-
print(xs1)
|
52
|
-
print("xs2: -------------------")
|
53
|
-
print(xs2)
|
54
|
-
print("-------------------")
|
55
|
-
dom1 = parseString(xs1)
|
56
|
-
dom2 = parseString(xs2)
|
57
|
-
if dom1 != dom2:
|
58
|
-
open("s1.xml", "w").write(xs1)
|
59
|
-
open("s2.xml", "w").write(xs2)
|
60
|
-
sys.exit()
|
61
|
-
|
62
|
-
|
63
|
-
def main():
|
64
|
-
allocationReq1 = """<ns1:AllocationRequest xmlns:ns1="http://www.smals.be/XSD/OCMW_CPAS/HeatingAllocationRequest" xmlns:com="http://www.smals.be/XSD/OCMW_CPAS/HeatingAllocationDataTypes"><ns1:ComputeAllocation><ns1:PrimaryBeneficiary><ns1:SSIN>67031703807</ns1:SSIN><ns1:Category>1</ns1:Category></ns1:PrimaryBeneficiary><ns1:Invoice><com:Amount>8390100</com:Amount><com:Quantity>1000</com:Quantity><com:HousingNumber>1</com:HousingNumber><com:DeliveryDate>2011-09-19</com:DeliveryDate><com:UnitFuel>3</com:UnitFuel></ns1:Invoice></ns1:ComputeAllocation><ns1:OCMW_CPAS><ns1:KboBceNumber>0212344876</ns1:KboBceNumber></ns1:OCMW_CPAS></ns1:AllocationRequest>"""
|
65
|
-
|
66
|
-
ssin = "67031703807"
|
67
|
-
|
68
|
-
allocationReq = Object(
|
69
|
-
ComputeAllocation=Object(
|
70
|
-
Invoice=Object(
|
71
|
-
Amount="8390100",
|
72
|
-
Quantity=1000,
|
73
|
-
HousingNumber=1,
|
74
|
-
DeliveryDate="2011-09-19",
|
75
|
-
UnitFuel=3,
|
76
|
-
),
|
77
|
-
PrimaryBeneficiary=Object(SSIN=ssin, Category="1"),
|
78
|
-
),
|
79
|
-
OCMW_CPAS=Object(KboBceNumber="0212344876"),
|
80
|
-
)
|
81
|
-
|
82
|
-
ns = dict(
|
83
|
-
ns1="http://www.smals.be/XSD/OCMW_CPAS/HeatingAllocationRequest",
|
84
|
-
com="http://www.smals.be/XSD/OCMW_CPAS/HeatingAllocationDataTypes",
|
85
|
-
)
|
86
|
-
nst = dict()
|
87
|
-
nst.update(AllocationRequest="ns1")
|
88
|
-
nst.update(ComputeAllocation="ns1")
|
89
|
-
nst.update(OCMW_CPAS="ns1")
|
90
|
-
nst.update(KboBceNumber="ns1")
|
91
|
-
nst.update(Invoice="ns1")
|
92
|
-
nst.update(Quantity="com")
|
93
|
-
nst.update(HousingNumber="com")
|
94
|
-
nst.update(DeliveryDate="com")
|
95
|
-
nst.update(UnitFuel="com")
|
96
|
-
|
97
|
-
m = XmlMarshaller(
|
98
|
-
namespaces=ns,
|
99
|
-
namespacedTags=nst,
|
100
|
-
dumpXmlPrologue=False,
|
101
|
-
rootTag="AllocationRequest",
|
102
|
-
)
|
103
|
-
allocationReq2 = m.marshall(allocationReq)
|
104
|
-
|
105
|
-
# ~ assert_equivalent(allocationReq1,allocationReq2)
|
106
|
-
|
107
|
-
contenu1 = (
|
108
|
-
"""<SSDNRequest xmlns="http://www.ksz-bcss.fgov.be/XSD/SSDN/Service">
|
109
|
-
<RequestContext><AuthorizedUser><UserID>00901732883</UserID><Email>info@oshz.eupen.net</Email><OrgUnit>0212344876</OrgUnit><MatrixID>17</MatrixID><MatrixSubID>1</MatrixSubID></AuthorizedUser><Message><Reference>630230001126766</Reference><TimeRequest>20110921T105230</TimeRequest></Message></RequestContext><ServiceRequest><ServiceId>OCMWCPASHeatingAllocation</ServiceId><Version>20090409</Version>
|
110
|
-
%s
|
111
|
-
</ServiceRequest></SSDNRequest>"""
|
112
|
-
% allocationReq1
|
113
|
-
)
|
114
|
-
|
115
|
-
ssdnReq = Object(
|
116
|
-
RequestContext=Object(
|
117
|
-
AuthorizedUser=Object(**settings.SITE.bcss_user_params),
|
118
|
-
Message=Object(Reference="630230001126766", TimeRequest="20110921T105230"),
|
119
|
-
),
|
120
|
-
ServiceRequest=Object(
|
121
|
-
ServiceId="OCMWCPASHeatingAllocation", Version="20090409"
|
122
|
-
),
|
123
|
-
_any=allocationReq2,
|
124
|
-
)
|
125
|
-
|
126
|
-
m = AnyMarshaller(
|
127
|
-
dumpXmlPrologue=False,
|
128
|
-
rootTag="SSDNRequest",
|
129
|
-
defaultNamespace="http://www.ksz-bcss.fgov.be/XSD/SSDN/Service",
|
130
|
-
)
|
131
|
-
contenu2 = m.marshall(ssdnReq)
|
132
|
-
|
133
|
-
assert_equivalent(contenu1, contenu2)
|
134
|
-
|
135
|
-
body = Object(
|
136
|
-
# ~ xmlString="<![CDATA[%s]]>" % contenu)
|
137
|
-
xmlString=contenu2
|
138
|
-
)
|
139
|
-
|
140
|
-
raise Exception("ok jusqu'ici")
|
141
|
-
|
142
|
-
server = Resource(
|
143
|
-
"https://bcssksz-services-test.smals.be/connectors/webservice/KSZBCSSWebServiceConnectorPort",
|
144
|
-
measure=True,
|
145
|
-
)
|
146
|
-
|
147
|
-
res = server.soap(
|
148
|
-
body, namespace="http://ksz-bcss.fgov.be/connectors/WebServiceConnector"
|
149
|
-
)
|
150
|
-
|
151
|
-
print(res.code)
|
152
|
-
print(res.data)
|
153
|
-
|
154
|
-
s = str(res.data.xmlString)
|
155
|
-
# ~ s = res.data.xmlString.replace('"UTF-8"','"utf-8"')
|
156
|
-
# ~ s = s.replace('?>','?>\n')
|
157
|
-
print(s)
|
158
|
-
|
159
|
-
reply = XmlUnmarshaller().parse(s)
|
160
|
-
|
161
|
-
import pdb
|
162
|
-
|
163
|
-
pdb.set_trace()
|
164
|
-
|
165
|
-
|
166
|
-
if __name__ == "__main__":
|
167
|
-
main()
|
File without changes
|
File without changes
|