[open-ils-commits] r9251 - in
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb:
controllers/acq lib/acq public/oils/media/js/openils/acq
svn at svn.open-ils.org
svn at svn.open-ils.org
Mon Apr 7 13:45:49 EDT 2008
Author: erickson
Date: 2008-04-07 13:08:43 -0400 (Mon, 07 Apr 2008)
New Revision: 9251
Modified:
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/provider_mgr.py
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Fund.js
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js
branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js
Log:
updated python code to use atomic calls for new streaming methods for backwards compat. streaming in js calls
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py 2008-04-07 17:00:05 UTC (rev 9250)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/controllers/acq/fund.py 2008-04-07 17:08:43 UTC (rev 9251)
@@ -82,7 +82,7 @@
fund = self._retrieve_fund(r, ses, r.ctx.acq.fund_id.value)
source_list = ses.request(
- 'open-ils.acq.funding_source.org.retrieve',
+ 'open-ils.acq.funding_source.org.retrieve.atomic',
r.ctx.core.authtoken.value, None, {'limit_perm':'MANAGE_FUNDING_SOURCE', 'flesh_summary':1}).recv().content()
Event.parse_and_raise(source_list)
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py 2008-04-07 17:00:05 UTC (rev 9250)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/fund.py 2008-04-07 17:08:43 UTC (rev 9251)
@@ -23,7 +23,7 @@
def retrieve_org_funds(self, limit_perm=None):
funds = self.ses.request(
- 'open-ils.acq.fund.org.retrieve',
+ 'open-ils.acq.fund.org.retrieve.atomic',
self.request_mgr.ctx.core.authtoken.value, None, limit_perm).recv().content()
oils.event.Event.parse_and_raise(funds)
return funds
@@ -45,7 +45,7 @@
def retrieve_org_funding_sources(self, options=None):
sources = self.ses.request(
- 'open-ils.acq.funding_source.org.retrieve',
+ 'open-ils.acq.funding_source.org.retrieve.atomic',
self.request_mgr.ctx.core.authtoken.value, None, options).recv().content()
oils.event.Event.parse_and_raise(sources)
return sources
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/provider_mgr.py
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/provider_mgr.py 2008-04-07 17:00:05 UTC (rev 9250)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/lib/acq/provider_mgr.py 2008-04-07 17:08:43 UTC (rev 9251)
@@ -11,7 +11,7 @@
def list(r):
ses = ClientSession(oils.const.OILS_APP_ACQ)
- providers = ses.request('open-ils.acq.provider.org.retrieve',
+ providers = ses.request('open-ils.acq.provider.org.retrieve.atomic',
r.ctx.core.authtoken.value, None,
{"flesh_summary":1}).recv().content()
Event.parse_and_raise(providers)
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Fund.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Fund.js 2008-04-07 17:00:05 UTC (rev 9250)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Fund.js 2008-04-07 17:08:43 UTC (rev 9251)
@@ -12,18 +12,17 @@
openils.acq.Fund.loadGrid = function(domId, columns) {
/** Fetches the list of funds and builds a grid from them */
+ var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true);
var ses = new OpenSRF.ClientSession('open-ils.acq');
var req = ses.request('open-ils.acq.fund.org.retrieve',
- oilsAuthtoken, null, {flesh_summary:1}); /* XXX make this a streaming call */
+ oilsAuthtoken, null, {flesh_summary:1});
req.oncomplete = function(r) {
- var funds = r.recv().content();
- var items = [];
-
- for(var f in funds) {
- var fund = funds[f];
-
- items.push({
+ var msg
+ gridRefs.grid.setModel(gridRefs.model);
+ while(msg = r.recv()) {
+ var fund = msg.content();
+ gridRefs.store.newItem({
id:fund.id(),
name:fund.name(),
org: findOrgUnit(fund.org()).name(),
@@ -32,9 +31,11 @@
combined_balance:fund.summary()['combined_balance']
});
}
- util.Dojo.buildSimpleGrid(domId, columns, items);
+ gridRefs.grid.update();
};
+
req.send();
+ return gridRefs.grid;
};
}
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js 2008-04-07 17:00:05 UTC (rev 9250)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/FundingSource.js 2008-04-07 17:08:43 UTC (rev 9251)
@@ -15,13 +15,13 @@
var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true);
var ses = new OpenSRF.ClientSession('open-ils.acq');
var req = ses.request('open-ils.acq.funding_source.org.retrieve',
- oilsAuthtoken, null, {flesh_summary:1}); /* XXX make this a streaming call */
+ oilsAuthtoken, null, {flesh_summary:1});
req.oncomplete = function(r) {
- srcs = r.recv().content();
-
- for(var f in srcs) {
- var src = srcs[f];
+ var msg
+ gridRefs.grid.setModel(gridRefs.model);
+ while(msg = r.recv()) {
+ var src = msg.content();
gridRefs.store.newItem({
id:src.id(),
name:src.name(),
@@ -30,12 +30,10 @@
balance:src.summary()['balance']
});
}
-
- /* set the model after loading all of the data */
- gridRefs.grid.setModel(gridRefs.model);
+ gridRefs.grid.update();
};
+
req.send();
- //return gridRefs;
return gridRefs.grid;
};
}
Modified: branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js
===================================================================
--- branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js 2008-04-07 17:00:05 UTC (rev 9250)
+++ branches/acq-experiment/Open-ILS/web/oilsweb/oilsweb/public/oils/media/js/openils/acq/Provider.js 2008-04-07 17:08:43 UTC (rev 9251)
@@ -13,25 +13,27 @@
openils.acq.Provider.loadGrid = function(domId, columns) {
/** Fetches the list of providers and builds a grid from them */
+ var gridRefs = util.Dojo.buildSimpleGrid(domId, columns, [], 'id', true);
var ses = new OpenSRF.ClientSession('open-ils.acq');
- var req = ses.request('open-ils.acq.provider.org.retrieve', oilsAuthtoken); /* XXX make this a streaming call */
+ var req = ses.request('open-ils.acq.provider.org.retrieve', oilsAuthtoken);
req.oncomplete = function(r) {
- var providers = r.recv().content();
- var items = [];
-
- for(var p in providers) {
- var prov = providers[p];
- items.push({
+ var msg
+ gridRefs.grid.setModel(gridRefs.model);
+ while(msg = r.recv()) {
+ var prov = msg.content();
+ gridRefs.store.newItem({
id:prov.id(),
name:prov.name(),
owner: findOrgUnit(prov.owner()).name(),
currency_type:prov.currency_type()
});
}
- util.Dojo.buildSimpleGrid(domId, columns, items);
+ gridRefs.grid.update();
};
+
req.send();
+ return gridRefs.grid;
};
}
More information about the open-ils-commits
mailing list