View Single Post
Old 08-21-2012, 06:54 AM   #1
Agama
Guru
Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.Agama ought to be getting tired of karma fortunes by now.
 
Agama's Avatar
 
Posts: 652
Karma: 436517
Join Date: Jul 2010
Location: UK
Device: PRS-300, PW2
Using Class Variable in Def

In a plugin ui.py I have:

Code:
class InterfacePlugin(InterfaceAction):

    name        = 'Repository Links'
    action_spec = (name, None, 'Link book to supplementary material', None)
But referencing name within a def in this same class, such as:

Code:
def show_ui(self):
:
    return error_dialog(self.gui, name, 'Repository file not found', show=True)
gives error: NameError: global name 'name' is not defined.

So, how do I refer to name within a def?
Agama is offline   Reply With Quote