Ok, its pretty hard to really put an example script up, but heres the
relelvant parts.
#From the Model
jobs_table = Table('jobs', metadata, autoload=True)
mapper(Job, jobs_table )
#The Job Class is pretty generic so I wont include it
#The method that does the display with a debug print
def list(self):
c.jobs = Session.query(Job).all()
for j in c.jobs:
print j
return render('/jobs/listjobs.mako')
#Error/output to console
None
#Pylons Error
<type 'exceptions.AttributeError'>: 'NoneType' object has no attribute
'jobnum'
#Interactive debugger >>> is stuff I executed
>>> print Session.query(Job).all()
[None]
>>> print Session.query(Job).first()
None
>>> print Session.query(Job)
SELECT jobs.cmdline AS jobs_cmdline, jobs.nextschd AS jobs_jobnum,
jobs.repunit AS jobs_repunit, jobs.repvalue AS jobs_repvalue, etc. etc.
(there are like a million fields)
FROM jobs ORDER BY jobs.batch
The SQL generated works perfectly when run in a query tool.
The only thing I really changed was elminating a bunch of fields from
this table, then restarting everything.
Thanks,
Dan
On May 6, 11:00 am, Michael Bayer <[EMAIL PROTECTED]> wrote:
> On May 6, 2008, at 11:42 AM, [EMAIL PROTECTED] wrote:
>
>
>
> > No, I do implement a __str__ so that I can format up the composite
> > primary key. I didnt implement __repr__ at all.
>
> Ok you'd have to work up an example script that can illustrate this
> happening, I can't see any codepath that would actually return "None"
> inside a list. Id check very carefully to ensure that it is actually
> [None] and not just a particular string representation of an instance.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---