Hi Cal,

I replaced the code with this:
        row = AltwordManager.dictfetchall2(cursor)

Then I got a different error message that I don't understand?
ExceptionValue: 

  


unbound method dictfetchall2() must be called with AltwordManager instance as 
first argument (got CursorDebugWrapper instance instead)







On Sunday, September 8, 2013 9:54:36 PM UTC+2, Cal Leeming [Simplicity 
Media Ltd] wrote:
>
> Try and replace
> row = dictfetchall2(cursor)
>
> With this
> row = AltwordManager.dictfetchall2(cursor)
>
> Cal
>
>
> On Sun, Sep 8, 2013 at 8:23 PM, Pepsodent Cola 
> <pepsod...@gmail.com<javascript:>
> > wrote:
>
>> I don't understand how to fix this error message?  Here is the code that 
>> made things break.
>>
>> Exception Value: global name 'dictfetchall2' is not defined
>>
>>
>>
>>
>> #_______________________________________________________________________________
>>
>> def dictfetchall(cursor):
>>     "Returns all rows from a cursor as a dict."
>>     desc = cursor.description
>>     return [
>>         dict(zip([col[0] for col in desc], row))
>>         for row in cursor.fetchall()
>>     ]
>>
>> #_______________________________________________________________________________
>>
>> class AltwordManager(models.Manager):
>> *    def dictfetchall2(cursor):*
>>         "Returns all rows from a cursor as a dict."
>>         desc = cursor.description
>>         return [
>>             dict(zip([col[0] for col in desc], row))
>>             for row in cursor.fetchall()
>>         ]
>>
>>     def vote_order(self):
>>         "Returns a 1:M list ordered by votes."
>>         cursor =  connection.cursor()
>>         cursor.execute("""
>> SELECT navi_polls_word.rosword
>> FROM navi_polls_altword
>>         """)
>>         #row = cursor.fetchall()
>>         #row = dictfetchall(cursor)
>> *        row = dictfetchall2(cursor)*
>>         return row
>>
>> ...
>> ...
>>
>> #_______________________________________________________________________________
>>
>>
>>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to django-users...@googlegroups.com <javascript:>.
>> To post to this group, send email to django...@googlegroups.com<javascript:>
>> .
>> Visit this group at http://groups.google.com/group/django-users.
>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to