#98 staticmethod uses self

closed-fixed
nobody
WebKit (58)
5
2012-03-08
2012-03-08
Marek
No

Hi,
a couple of days ago I got an application written in WebWare 1.1 to make some adjustments in it.
While preparing an environment for running I've encountered a problem. The application was raising an exception:

"NameError: global name 'self' is not defined" in WebKit/HTTPContent.py:321.

After looking into this file I've found this piece of code:

@staticmethod
def callMethodOfServlet(url, method, *args, **kwargs):
return self.application().callMethodOfServlet(self.transaction(), url, method, *args, **kwargs)

After removing @staticmethod decorator and adding the missing "self" parameter everything works like a charm.
At the moment I'm trying to find out if it is a bug in the WebWare (as it looks like to me) or does my software use the framework in a -wrong- way and the lack of the first parameter is intended?

Discussion

    • status: open --> closed-fixed
     
  • Thanks for reporting. This is a bug and your fix is correct. I have already applied it in the trunk as r8229. As a workaround, you can also use the same method on the Application object, passing the transaction.