Re: Exception Value: global name 'dictfetchall2' is not defined
Yeah I will revert back to standalone function later on after I have confirmed something.
On Monday, September 9, 2013 2:52:03 AM UTC+2, Cal Leeming [Simplicity Media Ltd] wrote:
-- I just want to output this variable on my screen still don't know how to accomplish that with confusing MVC code...
desc = p.description
Somebody gave me a link to the document specification regarding how the content looks like.
But I like to see things with my own eyes before I move on with my Django project.
On Monday, September 9, 2013 2:52:03 AM UTC+2, Cal Leeming [Simplicity Media Ltd] wrote:
Ah sorry yeah, I forgot you needed @staticmethod decorator on the class method.To be honest though, that method should be a standalone function, not a method (as James said, you need to re-think your approach!)
CalOn Sun, Sep 8, 2013 at 9:25 PM, Pepsodent Cola <pepsod...@gmail.com> wrote:
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) CalOn Sun, Sep 8, 2013 at 8:23 PM, Pepsodent Cola <pepsod...@gmail.com> 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.descriptionreturn [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.descriptionreturn [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.roswordFROM navi_polls_altword""")#row = cursor.fetchall()#row = dictfetchall(cursor)row = dictfetchall2(cursor)return row......#___________________________________________________________ ____________________ To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.--
You received this message because you are subscribed to the Google Groups "Django users" group.com .
To post to this group, send email to django...@googlegroups.com.
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...@googlegroups.com .
To post to this group, send email to django...@googlegroups.com.
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+unsubscribe@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.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home