You are using # but you have to use @ for the decorador
class PluginWikiWidgets(PluginWikiWidgets):
@staticmethod
def blabla(a,b):
return blabla
Enviado via iPhone
Em 26/09/2010, às 22:59, "[email protected]" <[email protected]>
escreveu:
> Hi,
>
> I have been following the video at http://www.vimeo.com/13485916
>
> I'm impressed by the possibilities of this plugin and I was able to
> successfully run the examples localy, but I ran into a problem when
> trying to duplicate the tutorial's example of creating a new widget.
> I believe I copied the code correctly, but I receive the following
> error:
>
> Traceback (most recent call last):
> File "/home/xa21/web2py/applications/mypwiki/models/plugin_wiki.py",
> line 584, in render_widget
> html = getattr(PluginWikiWidgets,name)(**args)
> TypeError: unbound method sayhi() must be called with
> PluginWikiWidgets instance as first argument (got nothing instead)
>
> I'm running version 1.85.3 of web2py on fedora linux, and my python
> version is 2.5.2
>
> The following is the code I entered
> .... mypwiki/models/plugin_wiki_custom.py ....................
> # coding: utf8
> class PluginWikiWidgets(PluginWikiWidgets):
> #staticmethod
> def sayhi(message='Welcome'):
> """
> This plugin just says hi
> """
> return SPAN(message,auth.user.first_name)
> .............................................................
>
> ... Home ....................................................
> # Example of custom widget
> ``
> name: sayhi
> message: Welcome
> ``:widget
> .............................................................
>
> I'm hoping someone can point out the source of my error.
>
> Thanks in advance, - Tom