1- // PythonScript Runtime - regenerated on: Thu Nov 21 18:05:10 2013
1+ // PythonScript Runtime - regenerated on: Thu Nov 21 20:42:18 2013
22__NULL_OBJECT__ = Object . create ( null ) ;
33if ( "window" in this && "document" in this ) {
44 __NODEJS__ = false ;
@@ -135,7 +135,7 @@ get_attribute = function(object, attribute) {
135135 args = [ args , Object ( ) ] ;
136136 }
137137 args [ 0 ] . splice ( 0 , 0 , object ) ;
138- return attr . apply ( undefined , args ) ;
138+ return attr . apply ( this , args ) ;
139139 }
140140
141141 method . is_wrapper = true ;
@@ -154,7 +154,7 @@ get_attribute = function(object, attribute) {
154154 args = [ args , Object ( ) ] ;
155155 }
156156 args [ 0 ] . splice ( 0 , 0 , object ) ;
157- return attr . apply ( undefined , args ) ;
157+ return attr . apply ( this , args ) ;
158158 }
159159
160160 method . is_wrapper = true ;
@@ -182,7 +182,7 @@ get_attribute = function(object, attribute) {
182182 args = [ args , Object ( ) ] ;
183183 }
184184 args [ 0 ] . splice ( 0 , 0 , object ) ;
185- return attr . apply ( undefined , args ) ;
185+ return attr . apply ( this , args ) ;
186186 }
187187
188188 method . is_wrapper = true ;
@@ -428,6 +428,7 @@ create_class = function(class_name, parents, attrs, props) {
428428 klass . __bases__ = parents ;
429429 klass . __name__ = class_name ;
430430 klass . __unbound_methods__ = Object . create ( null ) ;
431+ klass . __all_method_names__ = [ ] ;
431432 klass . __properties__ = props ;
432433 klass . __attributes__ = attrs ;
433434 var iter = attrs ;
@@ -437,6 +438,7 @@ create_class = function(class_name, parents, attrs, props) {
437438 var backup = key ; key = iter [ key ] ;
438439 if ( typeof ( attrs [ key ] ) == "function" ) {
439440 klass . __unbound_methods__ [ key ] = attrs [ key ] ;
441+ klass . __all_method_names__ . push ( key ) ;
440442 }
441443 if ( key == "__getattribute__" ) {
442444 continue ;
@@ -463,31 +465,47 @@ create_class = function(class_name, parents, attrs, props) {
463465 if ( ! ( iter instanceof Array ) ) { iter = __object_keys__ ( iter ) }
464466 for ( var base = 0 ; base < iter . length ; base ++ ) {
465467 var backup = base ; base = iter [ base ] ;
466- klass . __getters__ . concat ( base . __getters__ ) ;
467- klass . __setters__ . concat ( base . __setters__ ) ;
468+ Array . prototype . push . apply ( klass . __getters__ , base . __getters__ ) ;
469+ Array . prototype . push . apply ( klass . __setters__ , base . __setters__ ) ;
470+ Array . prototype . push . apply ( klass . __all_method_names__ , base . __all_method_names__ ) ;
468471 base = backup ;
469472 }
470473 var __call__ = function ( ) {
471- var init , object , wrapper ;
474+ var has_getattr , wrapper , object , has_getattribute ;
472475 "Create a PythonJS object" ;
473476 object = Object . create ( null ) ;
474477 object . __class__ = klass ;
475478 Object . defineProperty ( object , "__dict__" , { enumerable :false , value :object , writeable :false , configurable :false } ) ;
476- var iter = klass . __unbound_methods__ ;
479+ has_getattribute = false ;
480+ has_getattr = false ;
481+ var iter = klass . __all_method_names__ ;
477482
478483 if ( ! ( iter instanceof Array ) ) { iter = __object_keys__ ( iter ) }
479484 for ( var name = 0 ; name < iter . length ; name ++ ) {
480485 var backup = name ; name = iter [ name ] ;
481- wrapper = get_attribute ( object , name ) ;
482- if ( ! wrapper . is_wrapper ) {
483- console . log ( "ERROR: failed to get wrapper for:" , name ) ;
486+ if ( name == "__getattribute__" ) {
487+ has_getattribute = true ;
488+ } else {
489+ if ( name == "__getattr__" ) {
490+ has_getattr = true ;
491+ } else {
492+ wrapper = get_attribute ( object , name ) ;
493+ if ( ! wrapper . is_wrapper ) {
494+ console . log ( "RUNTIME ERROR: failed to get wrapper for:" , name ) ;
495+ }
496+ }
484497 }
485498 name = backup ;
486499 }
500+ if ( has_getattr ) {
501+ get_attribute ( object , "__getattr__" ) ;
502+ }
503+ if ( has_getattribute ) {
504+ get_attribute ( object , "__getattribute__" ) ;
505+ }
487506 __bind_property_descriptors__ ( object , klass ) ;
488- init = object . __init__ ;
489- if ( init ) {
490- init . apply ( undefined , arguments ) ;
507+ if ( object . __init__ ) {
508+ object . __init__ . apply ( this , arguments ) ;
491509 }
492510 return object ;
493511 }
0 commit comments