[albatross-users] Python 2.4.1 incompatibility with al-for ?

Sheila King sheila at thinkspot.net
Tue Apr 19 23:59:13 EST 2005


Hello Andrew,

Thanks for the suggestions...

--On Tuesday, April 19, 2005 8:25 PM +1000 Andrew McNamara 
<andrewm at object-craft.com.au> wrote:

>> Maybe the mysql library was upgraded when you went
>> from 2.2 to 2.4?

This is probably true. I will check with the package maintainer for our 
server to be sure...

>> My guess would be that it's returning an iterable,
>> rather than an array.

I will check it out. What's strange is that I use <al-for> tags on a number 
of pages in the app, but most of them work fine.

I've found another page that is throwing an error although it doesn't go to 
500 Internal Server error...probably because I'm catching the error on that 
page. I will have to investigate what the difference is between the pages 
where al-for works and where it doesn't, and it does sound like starting 
with the objects MySQL is returning is the next logical place to look. I 
believe on the pages where it works, I am constructing my own lists and not 
directly using the object returned by MySQLdb.

Thank you again for the pointer on where to look next...

-- 
Sheila King
sheila at thinkspot.net
http://www.thinkspot.net/sheila/


>> Currently <al-for> requires an indexable object
>> such as an array or tuple. I guess you could try something like:
>
> It might also be worth trying to cast the object returned by mysql to a
> list explicitly:
>
>     if result:
>         ctx.locals._loglist = list(c.fetchone()['changelog'])
>
> --
> Andrew McNamara, Senior Developer, Object Craft
> http://www.object-craft.com.au/
>





More information about the Albatross-users mailing list