falkolab.ext3.direct er en server-side stak for ExtJS 3.
Hvordan bruger jeg det?
Lad os registrere api og udsigt:
& Nbsp; & gt; & gt; & gt; fra zope.configuration import xmlconfig
& Nbsp; & gt; & gt; & gt; context = xmlconfig.string ("" "
& Nbsp; ... & lt; konfigurere
& Nbsp; ... xmlns = "http://namespaces.zope.org/zope"
& Nbsp; ... xmlns: extdirect = "http://namespaces.zope.org/extdirect"
& Nbsp; ... & gt;
& Nbsp; ... & lt; omfatter pakke = "falkolab.ext3.direct" file = "meta.zcml" / & gt;
& Nbsp; ...
& Nbsp; ... & lt; extdirect: api
& Nbsp; ... for = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... namespace = "my.app"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... & lt; view: extdirect
& Nbsp; ... for = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... class = "falkolab.ext3.direct.testing.AlbumList"
& Nbsp; ... tilladelse = "zope.ManageContent"
& Nbsp; ... name = "albumlist"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... & lt; view: extdirect
& Nbsp; ... for = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... class = "falkolab.ext3.direct.testing.Contact"
& Nbsp; ... tilladelse = "zope.ManageContent"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... "" ")
Direkte API:
& Nbsp; & gt; & gt; & gt; print http (r "" "
& Nbsp; ... GET /@@directapi HTTP / 1.1
& Nbsp; ... Autorisation: Grundlæggende bWdyOm1ncnB3
& Nbsp; ... "" ")
& Nbsp; HTTP / 1.1 200 OK
& Nbsp; Cache-Control: no-cache
& Nbsp; Content-Length: ...
& Nbsp; Content-Type: text / javascript; charset = utf-8
& Nbsp; Udløber: ...
& Nbsp; Pragma: no-cache
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; Ext.namespace (my.app ');
& Nbsp; my.app.REMOTING_API = {"url": "http: // localhost /@@directrouter", "namespace": "my.app", "type": "Remoting", "handlinger": {"Kontakt ": [{" name ":" getInfo "," len ": 1}]," albumlist ": [{" formHandler ": true," navn ":" tilføj "," len ": 0}, {" navn ":" getAll "," len ": 0}]}};
Auto tilføje udbyder:
& Nbsp; & gt; & gt; & gt; print http (r "" "
& Nbsp;? ... GET /@@directapi add_provider HTTP / 1.1
& Nbsp; ... Autorisation: Grundlæggende bWdyOm1ncnB3
& Nbsp; ... "" ")
& Nbsp; HTTP / 1.1 200 OK
& Nbsp; Cache-Control: no-cache
& Nbsp; Content-Length: ...
& Nbsp; Content-Type: text / javascript; charset = utf-8
& Nbsp; Udløber: ...
& Nbsp; Pragma: no-cache
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; Ext.namespace (my.app ');
& Nbsp; my.app.REMOTING_API = {"url": "http: // localhost /@@directrouter", "namespace": "my.app", "type": "Remoting", "handlinger": {"Kontakt ": [{" name ":" getInfo "," len ": 1}]," albumlist ": [{" formHandler ": true," navn ":" tilføj "," len ": 0}, {" navn ":" getAll "," len ": 0}]}};
& Nbsp; Ext.Direct.addProvider (my.app.REMOTING_API);
Og Direct Request Hanling (for tilsætning se ROUTER.TXT):
& Nbsp; & gt; & gt; & gt; print http (r "" "
& Nbsp; ... POST /@@directrouter HTTP / 1.1
& Nbsp; ... Autorisation: Grundlæggende bWdyOm1ncnB3
& Nbsp; ... Content-Length: 71
& Nbsp; ... Content-Type: application / JSON; charset = UTF-8
& Nbsp; ... Referer: http: // localhost /
& Nbsp; ...
& Nbsp; ... {"handling": "albumlist", "metode": "getAll", "data":, "type" []: "RPC", "tid": 1} "" ")
& Nbsp; HTTP / 1.1 200 OK
& Nbsp; Content-Length: 89
& Nbsp; Content-Type: text / javascript
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; {"handling": "albumlist", "tid": 1, "type": "RPC", "metode": "getAll", "resultat": [1, 2, 3]}
Hvad er nyt i denne udgivelse:
- Ændringer til støtte Python 2.6
Krav :
- Python
Kommentarer ikke fundet