HI Alex,
when I tried this, I get the following :
file : buildobject.py
import profile
class BuildObject:
def __init__(self, id):
self.id = id
self.setObjectAttributes();
def setObjectAttributes(self):
global _o
_o = self
profile.run('_o.dbCalls()')
def dbCalls(self):
print "hello world!"
file: ../views.py
build_object_one = BuildObject(b1)
now when I run this I get this error:
Traceback (most recent call last):
File "views.py", line 134, in
processQuery(sys.argv[1], sys.argv[2])
File "views.py", line 105, in processQuery
build_object_one = BuildObject(b1)
File "/perforce/hhimanshu-dev-webapps-main/webapp/webapps/changelog/classes/buildobject.py", line 26, in init
self.setObjectAttributes();
File "/perforce/hhimanshu-dev-webapps-main/webapp/webapps/changelog/classes/buildobject.py", line 86, in setObjectAttributes
profile.run('_o.dbCalls()')
File "/build/toolchain/lin32/python-2.6.1/lib/python2.6/profile.py", line 70, in run
prof = prof.run(statement)
File "/build/toolchain/lin32/python-2.6.1/lib/python2.6/profile.py", line 456, in run
return self.runctx(cmd, dict, dict)
File "/build/toolchain/lin32/python-2.6.1/lib/python2.6/profile.py", line 462, in runctx
exec cmd in globals, locals
File "", line 1, in
NameError: name '_o' is not defined