Seems that 'name' is actually a specially reserved attribute, or conflicts with the internal JS object representation somehow. Trying to retrieve it with getattr always returns the empty string. Here's the sample code:
def __init__( self ):
self.name = 'foo'
test_class = TestClass()
my_name = getattr( test_class, 'name' )
print "my_name is: " + my_name
print "no, actually it is: " + test_class.name
Original issue: http://code.google.com/p/pyjamas/issues/detail?id=521 (November 23, 2010 18:53:23)
From cornelis...@gmail.com on November 23, 2010 19:57:02:
Which pyjamas version are you using and what are the compile options?
Which browser (if any)?
I get the following output:
my_name is: foo
no, actually it is: foo
From geoff.fl...@gmail.com on November 23, 2010 21:12:32:
I'm using the git head, I've reproduced the issue on a separate machine. Here's the last commit:
Author: Kees Bos email@example.com
Date: Mon Nov 22 08:41:52 2010 +0100
Fixes issue 520 : Replaced eval() in sys.trackstackstr() with reference to
From geoff.fl...@gmail.com on November 23, 2010 21:48:13:
Oh, I was just using regular pyjsbuild with no args. Though generally I try to use --strict.
From cornelis...@gmail.com on November 24, 2010 09:34:24:
I've tried with several options. I still can't reproduce this.
What I've tried:
rm output/lib/.js; ./pyjsbuild --no-compile-inplace -O --print test_getattr.py
rm output/lib/.js; ./pyjsbuild --no-compile-inplace test_getattr.py
rm output/lib/*.js; ./pyjsbuild --no-compile-inplace --strict test_getattr.py
So, it should also work without --strict option. If you could provide more details to get to this problem, that s appreciated. (E.g. the test_getattr.js that's generated, assuming that you name your test file also test_getattr.py ;-) )
Which browser do you use?
From cornelis...@gmail.com on January 31, 2012 11:20:55:
I was able to reproduce this with chrome.
This bug should be fixed (commit c06a123)
I'll close this ticket, unless you still see the problem.
From luke.lei...@gmail.com on February 05, 2012 20:18:59:
apologies, kees - LibTest doesn't run (throws an exception with "CompileTest" no attribute named prototype) so i had to back this out (attached)