##// END OF EJS Templates
Merge pull request #8273 from SylvainCorlay/fixes_widget_serialization...
Min RK -
r21184:d8f34f38 merge
parent child Browse files
Show More
@@ -215,7 +215,7 b' class BaseIPythonApplication(Application):'
215 215 return crashhandler.crash_handler_lite(etype, evalue, tb)
216 216
217 217 def _ipython_dir_changed(self, name, old, new):
218 if old is not None and old is not Undefined:
218 if old is not Undefined:
219 219 str_old = py3compat.cast_bytes_py2(os.path.abspath(old),
220 220 sys.getfilesystemencoding()
221 221 )
@@ -369,7 +369,7 b' define(["widgets/js/manager",'
369 369 // being the value or the promise of the serialized value
370 370 var serializers = this.constructor.serializers;
371 371 if (serializers) {
372 for (k in attrs) {
372 for (var k in attrs) {
373 373 if (serializers[k] && serializers[k].serialize) {
374 374 attrs[k] = (serializers[k].serialize)(attrs[k], this);
375 375 }
@@ -383,6 +383,7 b' define(["widgets/js/manager",'
383 383 for (var i=0; i<keys.length; i++) {
384 384 var key = keys[i];
385 385 var value = state[key];
386 if (value) {
386 387 if (value.buffer instanceof ArrayBuffer
387 388 || value instanceof ArrayBuffer) {
388 389 buffers.push(value);
@@ -390,6 +391,7 b' define(["widgets/js/manager",'
390 391 delete state[key];
391 392 }
392 393 }
394 }
393 395 that.comm.send({method: 'backbone', sync_data: state, buffer_keys: buffer_keys}, callbacks, {}, buffers);
394 396 }).catch(function(error) {
395 397 that.pending_msgs--;
@@ -1376,6 +1376,24 b' def test_hold_trait_notifications():'
1376 1376 nt.assert_equal(t.b, 0)
1377 1377
1378 1378
1379 class RollBack(HasTraits):
1380 bar = Int()
1381 def _bar_validate(self, value, trait):
1382 if value:
1383 raise TraitError('foobar')
1384 return value
1385
1386
1387 class TestRollback(TestCase):
1388
1389 def test_roll_back(self):
1390
1391 def assign_rollback():
1392 RollBack(bar=1)
1393
1394 self.assertRaises(TraitError, assign_rollback)
1395
1396
1379 1397 class OrderTraits(HasTraits):
1380 1398 notified = Dict()
1381 1399
@@ -623,7 +623,7 b' class HasTraits(py3compat.with_metaclass(MetaHasTraits, object)):'
623 623 if cache[name][1] is not Undefined:
624 624 setattr(self, name, cache[name][1])
625 625 else:
626 delattr(self, name)
626 self._trait_values.pop(name)
627 627 cache = {}
628 628 raise e
629 629 finally:
General Comments 0
You need to be logged in to leave comments. Login now