[PonyORM-list] Error on wrong line

Goldberg, Arthur P arthur.p.goldberg at mssm.edu
Mon Oct 27 18:27:44 UTC 2014

Hi guys

 Generally, pony has been great. Thanks!

However I think this is a bug. I ran the attached program, and it generates this call stack. The error is reported in line 202 but it is actually in line 203.  I know that the ID in 203 overrides the db.entity class of that name, but I would think that the error does not exist until line 203.

Traceback (most recent call last):
  File "../geneticsSubjects.py", line 212, in <module>
  File "<auto generated wrapper of dumpIDs() function>", line 2, in dumpIDs
  File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pony/orm/core.py", line 345, in new_func
    try: return func(*args, **kwargs)
  File "../geneticsSubjects.py", line 202, in dumpIDs
    print( ID.__header__() )
UnboundLocalError: local variable 'ID' referenced before assignment

 Also, I have a documentation suggestion.for example, your documentation  says:

for p in select(p for p in Product):
    print p.name, p.price

 whereas it  is more convenient to say:

for p in Product.select():

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </ponyorm-list/attachments/20141027/49e4147e/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: geneticsSubjects.py
Type: text/x-python-script
Size: 14000 bytes
Desc: geneticsSubjects.py
URL: </ponyorm-list/attachments/20141027/49e4147e/attachment.bin>

More information about the ponyorm-list mailing list