Merge lp:~openerp-dev/openobject-client-web/proto61-cleanups-xmo into lp:~openerp-dev/openobject-client-web/trunk-proto61
- proto61-cleanups-xmo
- Merge into trunk-proto61
Proposed by
Xavier (Open ERP)
Status: | Merged |
---|---|
Merged at revision: | 4559 |
Proposed branch: | lp:~openerp-dev/openobject-client-web/proto61-cleanups-xmo |
Merge into: | lp:~openerp-dev/openobject-client-web/trunk-proto61 |
Diff against target: |
668 lines (+122/-140) 4 files modified
addons/base/controllers/main.py (+11/-22) addons/base/static/openerp/js/boot.js (+34/-38) addons/base/static/openerp/js/controllers.js (+73/-75) openerpweb/openerpweb.py (+4/-5) |
To merge this branch: | bzr merge lp:~openerp-dev/openobject-client-web/proto61-cleanups-xmo |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
OpenERP R&D Team | Pending | ||
Review via email: mp+53378@code.launchpad.net |
Commit message
Description of the change
* A pair of source fixes (replace `json` by `simplejson` everywhere as json is not available in 2.5 and simplejson is already a dependency and often faster (C accelerator)
* Fixed a bunch of typos and warnings (missing semicolons and trailing commas) in JS code
* Fixed a test and some return values in the Python code (used dict literals when possible)
* Reformatted and renamed boot.js as I was reading it
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'addons/base/controllers/main.py' |
2 | --- addons/base/controllers/main.py 2011-03-11 13:26:22 +0000 |
3 | +++ addons/base/controllers/main.py 2011-03-15 07:13:29 +0000 |
4 | @@ -1,12 +1,11 @@ |
5 | # -*- coding: utf-8 -*- |
6 | - |
7 | -import glob,json,os |
8 | - |
9 | -#import simplejson as json |
10 | +import glob, os |
11 | +from xml.etree import ElementTree |
12 | + |
13 | +import simplejson |
14 | |
15 | import openerpweb |
16 | |
17 | -from xml.etree import ElementTree |
18 | |
19 | class Xml2Json: |
20 | # xml2json-direct |
21 | @@ -16,7 +15,7 @@ |
22 | # URL: http://code.google.com/p/xml2json-direct/ |
23 | @staticmethod |
24 | def convert_to_json(s): |
25 | - return json.dumps(Xml2Json.convert_to_structure(s), sort_keys=True, indent=4) |
26 | + return simplejson.dumps(Xml2Json.convert_to_structure(s), sort_keys=True, indent=4) |
27 | |
28 | @staticmethod |
29 | def convert_to_structure(s): |
30 | @@ -105,9 +104,7 @@ |
31 | |
32 | @openerpweb.jsonrequest |
33 | def modules(self, req): |
34 | - res={} |
35 | - res["modules"] = ["base","base_hello"] |
36 | - return res |
37 | + return {"modules": ["base", "base_hello"]} |
38 | |
39 | @openerpweb.jsonrequest |
40 | def csslist(self, req, mods='base,base_hello'): |
41 | @@ -148,7 +145,7 @@ |
42 | i['children'] = [] |
43 | d = dict([(i["id"],i) for i in menu_items]) |
44 | for i in menu_items: |
45 | - if i['parent_id'] == False: |
46 | + if not i['parent_id']: |
47 | pid = False |
48 | else: |
49 | pid = i['parent_id'][0] |
50 | @@ -157,9 +154,8 @@ |
51 | # sort by sequence a tree using parent_id |
52 | for i in menu_items: |
53 | i['children'].sort(key = lambda x:x["sequence"]) |
54 | - res={} |
55 | - res['data']=menu_root |
56 | - return res |
57 | + |
58 | + return {'data': menu_root} |
59 | |
60 | @openerpweb.jsonrequest |
61 | def action(self,req,menu_id): |
62 | @@ -180,10 +176,7 @@ |
63 | m = req.session.model(model) |
64 | ids = m.search(domain) |
65 | values = m.read(ids, fields) |
66 | - res = {} |
67 | - res['ids'] = ids |
68 | - res['values'] = values |
69 | - return res |
70 | + return {'ids': ids, 'values': values} |
71 | |
72 | class FormView(openerpweb.Controller): |
73 | _cp_path = "/base/formview" |
74 | @@ -217,8 +210,4 @@ |
75 | |
76 | @openerpweb.jsonrequest |
77 | def load(self,req,action_id): |
78 | - #m = req.session.model('ir.ui.menu') |
79 | - res={} |
80 | - return res |
81 | - |
82 | -# |
83 | + return {} |
84 | |
85 | === modified file 'addons/base/static/openerp/js/boot.js' |
86 | --- addons/base/static/openerp/js/boot.js 2011-03-10 12:54:15 +0000 |
87 | +++ addons/base/static/openerp/js/boot.js 2011-03-15 07:13:29 +0000 |
88 | @@ -62,46 +62,42 @@ |
89 | })(); |
90 | |
91 | //--------------------------------------------------------- |
92 | -// OpenERP initalisation and black magic about the pool |
93 | +// OpenERP initialisation and black magic about the pool |
94 | //--------------------------------------------------------- |
95 | |
96 | -(function(){ |
97 | - |
98 | -if(this.openerp) |
99 | - return; |
100 | - |
101 | -var openerp = this.openerp = function() { |
102 | - // create a new pool instance |
103 | - var o = {}; |
104 | - |
105 | - // links to the global openerp |
106 | - o._openerp = openerp; |
107 | - |
108 | - // Only base will be loaded, the rest will be by loaded by |
109 | - // openerp.base.Connection on the first connection |
110 | - o._modules_loaded = false |
111 | - |
112 | - // this unique id will be replaced by hostname_databasename by |
113 | - // openerp.base.Connection on the first connection |
114 | - o._session_id = "session" + openerp.sessions.length; |
115 | - openerp.sessions[o._session_id] = o; |
116 | - |
117 | - o.screen = openerp.screen; |
118 | - o.sessions = openerp.sessions; |
119 | - o.base = {}; |
120 | - openerp.base(o); |
121 | - |
122 | - return o; |
123 | -} |
124 | - |
125 | -// element_ids registry linked to all controllers on the page |
126 | -// TODO rename to elements, or keep gtk naming? |
127 | -this.openerp.screen = {}; |
128 | - |
129 | -// Per session namespace |
130 | -// openerp.<module> will map to |
131 | -// openerp.sessions.servername_port_dbname_login.<module> using a closure |
132 | -this.openerp.sessions = {}; |
133 | +(function() { |
134 | + if (this.openerp) |
135 | + return; |
136 | + |
137 | + // openerp instance constructor |
138 | + var openerp = this.openerp = function() { |
139 | + var new_instance = { |
140 | + // links to the global openerp |
141 | + _openerp: openerp, |
142 | + // Only base will be loaded, the rest will be by loaded by |
143 | + // openerp.base.Connection on the first connection |
144 | + _modules_loaded: false, |
145 | + // this unique id will be replaced by hostname_databasename by |
146 | + // openerp.base.Connection on the first connection |
147 | + _session_id: "session" + openerp.sessions.length, |
148 | + screen: openerp.screen, |
149 | + sessions: openerp.sessions, |
150 | + base: {} |
151 | + }; |
152 | + openerp.sessions[new_instance._session_id] = new_instance; |
153 | + openerp.base(new_instance); |
154 | + |
155 | + return new_instance; |
156 | + }; |
157 | + |
158 | + // element_ids registry linked to all controllers on the page |
159 | + // TODO rename to elements, or keep gtk naming? |
160 | + this.openerp.screen = {}; |
161 | + |
162 | + // Per session namespace |
163 | + // openerp.<module> will map to |
164 | + // openerp.sessions.servername_port_dbname_login.<module> using a closure |
165 | + this.openerp.sessions = {}; |
166 | |
167 | })(); |
168 | |
169 | |
170 | === modified file 'addons/base/static/openerp/js/controllers.js' |
171 | --- addons/base/static/openerp/js/controllers.js 2011-03-11 13:26:22 +0000 |
172 | +++ addons/base/static/openerp/js/controllers.js 2011-03-15 07:13:29 +0000 |
173 | @@ -16,9 +16,8 @@ |
174 | // position: "first" or "last" |
175 | // unique: boolean |
176 | // }) |
177 | - var args = Array.prototype.slice.call(arguments); |
178 | var callback = function() { |
179 | - var args2 = Array.prototype.slice.call(arguments); |
180 | + var args = Array.prototype.slice.call(arguments); |
181 | var r; |
182 | for(var i = 0; i < callback.callback_chain.length; i++) { |
183 | var c = callback.callback_chain[i]; |
184 | @@ -26,7 +25,7 @@ |
185 | // al: obscure but shortening C-style hack, sorry |
186 | callback.callback_chain.pop(i--); |
187 | } |
188 | - r = c.callback.apply(c.self, c.args.concat(args2)); |
189 | + r = c.callback.apply(c.self, c.args.concat(args)); |
190 | // TODO special value to stop the chain |
191 | // openerp.base.callback_stop |
192 | } |
193 | @@ -34,13 +33,12 @@ |
194 | }; |
195 | callback.callback_chain = []; |
196 | callback.add = function(f) { |
197 | - var args2 = Array.prototype.slice.call(arguments); |
198 | if(typeof(f) == 'function') { |
199 | - f = { callback: f, args: args2.slice(1) }; |
200 | + f = { callback: f, args: Array.prototype.slice.call(arguments, 1) }; |
201 | } |
202 | f.self = f.self || null; |
203 | f.args = f.args || []; |
204 | - f.unique = f.unique || false; |
205 | + f.unique = !!f.unique; |
206 | if(f.position == 'last') { |
207 | callback.callback_chain.push(f); |
208 | } else { |
209 | @@ -49,15 +47,22 @@ |
210 | return callback; |
211 | }; |
212 | callback.add_first = function(f) { |
213 | - callback.add.apply(null,arguments); |
214 | + return callback.add.apply(null,arguments); |
215 | }; |
216 | callback.add_last = function(f) { |
217 | - var args2 = Array.prototype.slice.call(arguments); |
218 | - callback.add({callback: f, args: args2.slice(1), position: "last"}); |
219 | + return callback.add({ |
220 | + callback: f, |
221 | + args: Array.prototype.slice.call(arguments, 1), |
222 | + position: "last" |
223 | + }); |
224 | }; |
225 | - callback.add({ callback: method, self:obj, args:args.slice(2) }); |
226 | - return callback; |
227 | -} |
228 | + |
229 | + return callback.add({ |
230 | + callback: method, |
231 | + self:obj, |
232 | + args:Array.prototype.slice.call(arguments, 2) |
233 | + }); |
234 | +}; |
235 | |
236 | openerp.base.BasicController = Class.extend({ |
237 | // TODO: init and start semantics are not clearly defined yet |
238 | @@ -92,7 +97,7 @@ |
239 | console.log(arguments); |
240 | }, |
241 | on_ready: function() { |
242 | - }, |
243 | + } |
244 | }); |
245 | |
246 | openerp.base.Console = openerp.base.BasicController.extend({ |
247 | @@ -110,12 +115,12 @@ |
248 | $('<pre></pre>').text(v.toString()).appendTo(self.$element); |
249 | } |
250 | }); |
251 | - }, |
252 | + } |
253 | }); |
254 | |
255 | openerp.base.Database = openerp.base.BasicController.extend({ |
256 | // Non Session Controller to manage databases |
257 | -}) |
258 | +}); |
259 | |
260 | openerp.base.Session = openerp.base.BasicController.extend({ |
261 | init: function(element_id, server, port) { |
262 | @@ -133,15 +138,13 @@ |
263 | this.context = {}; |
264 | }, |
265 | rpc: function(url, params, success_callback, error_callback) { |
266 | - var self = this; |
267 | - |
268 | - // Construct a JSON-RPC2 request, method is currently unsed |
269 | + // Construct a JSON-RPC2 request, method is currently unused |
270 | params.session_id = this.session_id; |
271 | params.context = typeof(params.context) != "undefined" ? params.context : this.context; |
272 | var request = { jsonrpc: "2.0", method: "call", params: params, "id":null }; |
273 | |
274 | // This is a violation of the JSON-RPC2 over HTTP protocol |
275 | - // specification but i dont know how to parse the raw POST content from |
276 | + // specification but i don't know how to parse the raw POST content from |
277 | // cherrypy so i use a POST form with one variable named request |
278 | var post = { request: JSON.stringify(request) }; |
279 | |
280 | @@ -190,7 +193,7 @@ |
281 | on_rpc_response: function() { |
282 | }, |
283 | on_rpc_error: function(error) { |
284 | - // TODO this should use the $element with focus and buttonsi displaying OPW etc... |
285 | + // TODO this should use the $element with focus and button is displaying OPW etc... |
286 | this.on_log(error, error.message, error.data.type, error.data.debug); |
287 | }, |
288 | on_session_invalid: function(contination) { |
289 | @@ -198,18 +201,18 @@ |
290 | session_valid: function() { |
291 | return this.uid; |
292 | }, |
293 | - session_login: function(db, login, password, sucess_callback) { |
294 | + session_login: function(db, login, password, success_callback) { |
295 | var self = this; |
296 | this.db = db; |
297 | this.login = login; |
298 | this.password = password; |
299 | - var params = { db: this.db, login: this.login, password: this.password } |
300 | + var params = { db: this.db, login: this.login, password: this.password }; |
301 | this.rpc("/base/session/login", params, function(result) { |
302 | self.session_id = result.session_id; |
303 | self.uid = result.uid; |
304 | self.session_check_modules(); |
305 | - if (sucess_callback) |
306 | - sucess_callback(); |
307 | + if (success_callback) |
308 | + success_callback(); |
309 | }); |
310 | }, |
311 | session_check_modules: function() { |
312 | @@ -234,8 +237,8 @@ |
313 | document.getElementsByTagName("head")[0].appendChild(s); |
314 | // at this point the js should be loaded or not ? |
315 | } |
316 | - for(var i=0; i<this.module_list.length; i++) { |
317 | - var mod = this.module_list[i]; |
318 | + for(var j=0; j<this.module_list.length; j++) { |
319 | + var mod = this.module_list[j]; |
320 | if(mod == "base") |
321 | continue; |
322 | self.log(mod); |
323 | @@ -255,13 +258,13 @@ |
324 | }, |
325 | session_logout: function() { |
326 | this.uid = false; |
327 | - }, |
328 | -}) |
329 | + } |
330 | +}); |
331 | |
332 | openerp.base.Controller = openerp.base.BasicController.extend({ |
333 | init: function(session, element_id) { |
334 | this._super(element_id); |
335 | - this.session = session |
336 | + this.session = session; |
337 | }, |
338 | on_log: function() { |
339 | if(this.session) |
340 | @@ -270,8 +273,8 @@ |
341 | rpc: function(url, data, success, error) { |
342 | // TODO: support additional arguments ? |
343 | this.session.rpc(url, data, success, error); |
344 | - }, |
345 | -}) |
346 | + } |
347 | +}); |
348 | |
349 | openerp.base.Loading = openerp.base.Controller.extend({ |
350 | init: function(session, element_id) { |
351 | @@ -279,7 +282,6 @@ |
352 | this.count = 0; |
353 | }, |
354 | start: function() { |
355 | - var self =this; |
356 | this.session.on_rpc_request.add_first(this.on_rpc_event, 1); |
357 | this.session.on_rpc_response.add_last(this.on_rpc_event, -1); |
358 | }, |
359 | @@ -301,7 +303,7 @@ |
360 | }, |
361 | start: function() { |
362 | this.$element.html(QWeb.render("Header", {})); |
363 | - }, |
364 | + } |
365 | }); |
366 | |
367 | openerp.base.Login = openerp.base.Controller.extend({ |
368 | @@ -331,7 +333,7 @@ |
369 | var login = $e.find("form input[name=login]").val(); |
370 | var password = $e.find("form input[name=password]").val(); |
371 | //$e.hide(); |
372 | - // Should hide then call calllback |
373 | + // Should hide then call callback |
374 | this.session.session_login("", login, password, function() { |
375 | if(self.session.session_valid()) { |
376 | self.on_login_valid(); |
377 | @@ -342,7 +344,6 @@ |
378 | return false; |
379 | }, |
380 | do_ask_login: function(continuation) { |
381 | - var self = this; |
382 | this.on_login_invalid(); |
383 | this.on_submit.add({ |
384 | position: "last", |
385 | @@ -351,7 +352,7 @@ |
386 | if(continuation) continuation(); |
387 | return false; |
388 | }}); |
389 | - }, |
390 | + } |
391 | }); |
392 | |
393 | openerp.base.Menu = openerp.base.Controller.extend({ |
394 | @@ -367,13 +368,12 @@ |
395 | var $e = this.$element; |
396 | $e.html(QWeb.render("Menu.root", this.data)); |
397 | $("ul.sf-menu").superfish({ |
398 | - speed: 'fast', |
399 | + speed: 'fast' |
400 | }); |
401 | $e.find("a").click(this.on_menu_click); |
402 | this.on_ready(); |
403 | }, |
404 | on_menu_click: function(ev) { |
405 | - var self = this; |
406 | var menu_id = Number(ev.target.id.split("_").pop()); |
407 | this.rpc("/base/menu/action", {"menu_id":menu_id}, this.on_menu_action_loaded); |
408 | return false; |
409 | @@ -386,7 +386,7 @@ |
410 | } |
411 | }, |
412 | on_action: function(action) { |
413 | - }, |
414 | + } |
415 | }); |
416 | |
417 | openerp.base.DataSet = openerp.base.Controller.extend({ |
418 | @@ -399,7 +399,7 @@ |
419 | this.domain = []; |
420 | this.context = {}; |
421 | this.order = ""; |
422 | - this.count; |
423 | + this.count = null; |
424 | this.ids = []; |
425 | this.values = {}; |
426 | /* |
427 | @@ -420,11 +420,11 @@ |
428 | this.rpc("/base/dataset/load", {model: this.model, fields: this.fields }, this.on_loaded); |
429 | }, |
430 | on_loaded: function(data) { |
431 | - this.ids = data.ids |
432 | - this.values = data.values |
433 | + this.ids = data.ids; |
434 | + this.values = data.values; |
435 | }, |
436 | on_reloaded: function(ids) { |
437 | - }, |
438 | + } |
439 | }); |
440 | |
441 | openerp.base.DataRecord = openerp.base.Controller.extend({ |
442 | @@ -440,12 +440,12 @@ |
443 | on_change: function() { |
444 | }, |
445 | on_reload: function() { |
446 | - }, |
447 | + } |
448 | }); |
449 | |
450 | openerp.base.XmlInput = openerp.base.Controller.extend({ |
451 | // to replace view editor |
452 | -}) |
453 | +}); |
454 | |
455 | openerp.base.FormView = openerp.base.Controller.extend({ |
456 | init: function(session, element_id, dataset, view_id) { |
457 | @@ -466,7 +466,7 @@ |
458 | on_button: function() { |
459 | }, |
460 | on_write: function() { |
461 | - }, |
462 | + } |
463 | }); |
464 | |
465 | openerp.base.ListView = openerp.base.Controller.extend({ |
466 | @@ -490,7 +490,6 @@ |
467 | this.rpc("/base/listview/load", {"model": this.model, "view_id":this.view_id}, this.on_loaded); |
468 | }, |
469 | on_loaded: function(data) { |
470 | - var self = this; |
471 | this.fields_view = data.fields_view; |
472 | //this.log(this.fields_view); |
473 | this.name = "" + this.fields_view.arch.attrs.string; |
474 | @@ -542,29 +541,29 @@ |
475 | caption: this.name |
476 | }).setGridWidth(this.$element.width()); |
477 | $(window).bind('resize', function() { self.$table.setGridWidth(self.$element.width()); }).trigger('resize'); |
478 | - }, |
479 | + } |
480 | }); |
481 | |
482 | openerp.base.TreeView = openerp.base.Controller.extend({ |
483 | -}) |
484 | +}); |
485 | |
486 | openerp.base.CalendarView = openerp.base.Controller.extend({ |
487 | // Dhtmlx scheduler ? |
488 | -}) |
489 | +}); |
490 | |
491 | openerp.base.GanttView = openerp.base.Controller.extend({ |
492 | // Dhtmlx gantt ? |
493 | -}) |
494 | +}); |
495 | |
496 | openerp.base.DiagramView = openerp.base.Controller.extend({ |
497 | // |
498 | -}) |
499 | +}); |
500 | |
501 | openerp.base.GraphView = openerp.base.Controller.extend({ |
502 | -}) |
503 | +}); |
504 | |
505 | openerp.base.SearchViewInput = openerp.base.Controller.extend({ |
506 | -// TODO not sure should we create a controler for every input ? |
507 | +// TODO not sure should we create a controller for every input ? |
508 | |
509 | // of we just keep a simple dict for each input in |
510 | // openerp.base.SearchView#input_ids |
511 | @@ -598,7 +597,7 @@ |
512 | this.$element.html(QWeb.render("SearchView", {"fields_view": this.fields_view})); |
513 | this.$element.find("#search").bind('click',this.on_search); |
514 | // TODO bind click event on all button |
515 | - // TODO we dont do many2one yet, but in the future bind a many2one controller on them |
516 | + // TODO we don't do many2one yet, but in the future bind a many2one controller on them |
517 | this.log(this.$element.find("#search")); |
518 | }, |
519 | register_input: function(node) { |
520 | @@ -608,15 +607,14 @@ |
521 | // generate id |
522 | var id = this.element_id + "_" + this.input_index++; |
523 | // TODO construct a nice object |
524 | - var input = { |
525 | + // save it in our registry |
526 | + this.input_ids[id] = { |
527 | node: node, |
528 | type: "filter", |
529 | domain: "", |
530 | context: "", |
531 | - disabled: false, |
532 | + disabled: false |
533 | }; |
534 | - // save it in our registry |
535 | - this.input_ids[id] = input; |
536 | |
537 | return id; |
538 | }, |
539 | @@ -632,17 +630,17 @@ |
540 | // save the result in this.domain |
541 | }, |
542 | on_clear: function() { |
543 | - }, |
544 | + } |
545 | }); |
546 | |
547 | openerp.base.ProcessView = openerp.base.Controller.extend({ |
548 | -}) |
549 | +}); |
550 | |
551 | openerp.base.HelpView = openerp.base.Controller.extend({ |
552 | -}) |
553 | +}); |
554 | |
555 | openerp.base.View = openerp.base.Controller.extend({ |
556 | -}) |
557 | +}); |
558 | |
559 | openerp.base.Action = openerp.base.Controller.extend({ |
560 | init: function(session, element_id) { |
561 | @@ -673,7 +671,7 @@ |
562 | $("#oe_action_list").hide(); |
563 | }, |
564 | do_action: function(action) { |
565 | - // instanciate the right controllers by understanding the action |
566 | + // instantiate the right controllers by understanding the action |
567 | this.action = action; |
568 | this.log(action); |
569 | // debugger; |
570 | @@ -700,9 +698,9 @@ |
571 | |
572 | // Locate first form view |
573 | this.listview_id = false; |
574 | - for(var i = 0; i < action.views.length; i++) { |
575 | - if(action.views[i][1] == "form") { |
576 | - this.formview_id = action.views[i][0]; |
577 | + for(var j = 0; j < action.views.length; j++) { |
578 | + if(action.views[j][1] == "form") { |
579 | + this.formview_id = action.views[j][0]; |
580 | break; |
581 | } |
582 | } |
583 | @@ -720,17 +718,17 @@ |
584 | // Connect the the dataset load event with the search button of search view |
585 | // THIS IS COOL |
586 | this.searchview.on_search.add_last(this.dataset.do_load); |
587 | - }, |
588 | + } |
589 | }); |
590 | |
591 | openerp.base.Preferences = openerp.base.Controller.extend({ |
592 | -}) |
593 | +}); |
594 | |
595 | openerp.base.ImportExport = openerp.base.Controller.extend({ |
596 | -}) |
597 | +}); |
598 | |
599 | openerp.base.Homepage = openerp.base.Controller.extend({ |
600 | -}) |
601 | +}); |
602 | |
603 | openerp.base.WebClient = openerp.base.Controller.extend({ |
604 | init: function(element_id) { |
605 | @@ -752,8 +750,8 @@ |
606 | self.$element.find(".on_logged").show(); |
607 | }); |
608 | |
609 | - // TODO MOVE ALL OF THAT IN on_loggued |
610 | - // after pooler udpate of modules |
611 | + // TODO MOVE ALL OF THAT IN on_logged |
612 | + // after pooler update of modules |
613 | // Cool no ? |
614 | this.session.on_session_invalid.add(this.login.do_ask_login); |
615 | |
616 | @@ -777,7 +775,7 @@ |
617 | this.action.do_action(action); |
618 | }, |
619 | do_about: function() { |
620 | - }, |
621 | + } |
622 | }); |
623 | |
624 | openerp.base.webclient = function(element_id) { |
625 | @@ -785,7 +783,7 @@ |
626 | var client = new openerp.base.WebClient(element_id); |
627 | client.start(); |
628 | return client; |
629 | -} |
630 | +}; |
631 | |
632 | }; |
633 | |
634 | |
635 | === modified file 'openerpweb/openerpweb.py' |
636 | --- openerpweb/openerpweb.py 2011-03-08 14:57:54 +0000 |
637 | +++ openerpweb/openerpweb.py 2011-03-15 07:13:29 +0000 |
638 | @@ -1,10 +1,9 @@ |
639 | #!/usr/bin/python |
640 | |
641 | -import os,re,sys,traceback,xmlrpclib |
642 | +import os, re, sys, traceback, xmlrpclib |
643 | |
644 | import cherrypy.lib.static |
645 | - |
646 | -import simplejson as json |
647 | +import simplejson |
648 | |
649 | import xmlrpctimeout |
650 | |
651 | @@ -91,7 +90,7 @@ |
652 | def parse(self, request): |
653 | self.cherrypy_request = None |
654 | self.cherrypy_session = None |
655 | - d=json.loads(request) |
656 | + d = simplejson.loads(request) |
657 | self.params = d.get("params",{}) |
658 | self.session_id = self.params.pop("session_id", None) or "random.random" |
659 | self.session = session_store.setdefault(self.session_id, OpenERPSession()) |
660 | @@ -126,7 +125,7 @@ |
661 | |
662 | #import pprint |
663 | #pprint.pprint(r) |
664 | - return json.dumps(r) |
665 | + return simplejson.dumps(r) |
666 | |
667 | def jsonrequest(f): |
668 | # check cleaner wrapping: |