falkolab.ext3.direct är en server-side stacken för ExtJS 3.
Hur använder jag det?
Låt oss registrera api och visningar:
& Nbsp; & gt; & gt; & gt; från zope.configuration import xmlconfig
& Nbsp; & gt; & gt; & gt; sammanhang = xmlconfig.string ("" "
& Nbsp; ... & lt; konfigurera
& Nbsp; ... xmlns = "http://namespaces.zope.org/zope"
& Nbsp; ... xmlns: extdirect = "http://namespaces.zope.org/extdirect"
& Nbsp; ... & gt;
& Nbsp; ... & lt; inkluderar paket = "falkolab.ext3.direct" file = "meta.zcml" / & gt;
& Nbsp; ...
& Nbsp; ... & lt; extdirect: api
& Nbsp; ... för = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... namespace = "my.app"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... & lt; extdirect: view
& Nbsp; ... för = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... class = "falkolab.ext3.direct.testing.AlbumList"
& Nbsp; ... tillstånd = "zope.ManageContent"
& Nbsp; ... name = "albumlist"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... & lt; extdirect: view
& Nbsp; ... för = "zope.app.folder.interfaces.IFolder"
& Nbsp; ... class = "falkolab.ext3.direct.testing.Contact"
& Nbsp; ... tillstånd = "zope.ManageContent"
& Nbsp; ... / & gt;
& Nbsp; ...
& Nbsp; ... "" ")
Direkt API:
& Nbsp; & gt; & gt; & gt; utskrifts http (r "" "
& Nbsp; ... GET /@@directapi HTTP / 1.1
& Nbsp; ... Bemyndigande: Enkel 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; Utgår: ...
& 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", "typ": "Remoting", "åtgärder": {"Kontakt ": [{" namn ":" getInfo "," len ": 1}]," albumlist ": [{" formHandler ": true," namn ":" lägga "," len "0}, {" namn ":" getAll "," len ": 0}]}};
Auto lägga leverantören:
& Nbsp; & gt; & gt; & gt; utskrifts http (r "" "
& Nbsp;? ... GET /@@directapi add_provider HTTP / 1.1
& Nbsp; ... Bemyndigande: Enkel 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; Utgår: ...
& 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", "typ": "Remoting", "åtgärder": {"Kontakt ": [{" namn ":" getInfo "," len ": 1}]," albumlist ": [{" formHandler ": true," namn ":" lägga "," len "0}, {" namn ":" getAll "," len ": 0}]}};
& Nbsp; Ext.Direct.addProvider (my.app.REMOTING_API);
Och Direkt förfrågan Hanling (för tillsats se ROUTER.TXT):
& Nbsp; & gt; & gt; & gt; utskrifts http (r "" "
& Nbsp; ... POST /@@directrouter HTTP / 1.1
& Nbsp; ... Bemyndigande: Enkel bWdyOm1ncnB3
& Nbsp; ... Content-Length: 71
& Nbsp; ... Content-Type: application / json; charset = UTF-8
& Nbsp; ... Referer: http: // localhost /
& Nbsp; ...
& Nbsp; ... {"action": "albumlist", "metod": "getAll", "data": [], "typ": "rpc", "tid": 1} "" ")
& Nbsp; HTTP / 1.1 200 OK
& Nbsp; Content-Length: 89
& Nbsp; Content-Type: text / javascript
& Nbsp; & lt; BLANKLINE & gt;
& Nbsp; {"action": "albumlist", "tid": 1, "typ": "rpc", "metod": "getAll", "resultat": [1, 2, 3]}
Vad är nytt i den här versionen:
- Ändringar för att stödja Python 2.6
Krav :
- Python
Kommentarer hittades inte