views:

37

answers:

1

i use gaema for twitter user loggin http://code.google.com/p/gaema/

and my code is :

class TwitterAuth(WebappAuth, auth.TwitterMixin):
    pass

class TwitterHandler(BaseHandler):
    def get(self):
        twitter_auth = TwitterAuth(self)
        try:
            if self.request.GET.get("oauth_token", None):
                twitter_auth.get_authenticated_user(self._on_auth)
                self.response.out.write('sss')
                return

            twitter_auth.authorize_redirect()
        except RequestRedirect, e:
            return self.redirect(e.url, permanent=True)

        self.render_template('index.html', user=None)

    def _on_auth(self, user):
        """This function is called immediatelly after an authentication attempt.
        Use it to save the login information in a session or secure cookie.

        :param user:
            A dictionary with user data if the authentication was successful,
            or ``None`` if the authentication failed.
        """
        if user:
            # Authentication was successful. Create a session or secure cookie
            # to keep the user logged in.
            #self.response.out.write('logged in as '+user['first_name']+' '+user['last_name'])
            self.response.out.write(user)

            return

        else:
            # Login failed. Show an error message or do nothing.
            pass

        # After cookie is persisted, redirect user to the original URL, using
        # the home page as fallback.
        self.redirect(self.request.GET.get('redirect', '/'))

and the error is :

Traceback (most recent call last):
  File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 511, in __call__
    handler.get(*groups)
  File "D:\zjm_code\gaema\demos\webapp\main.py", line 76, in get
    twitter_auth.authorize_redirect()
  File "D:\zjm_code\gaema\demos\webapp\gaema\auth.py", line 209, in authorize_redirect
    http.fetch(self._oauth_request_token_url(), self.async_callback(
  File "D:\zjm_code\gaema\demos\webapp\gaema\auth.py", line 239, in _oauth_request_token_url
    consumer_token = self._oauth_consumer_token()
  File "D:\zjm_code\gaema\demos\webapp\gaema\auth.py", line 441, in _oauth_consumer_token
    self.require_setting("twitter_consumer_key", "Twitter OAuth")
TypeError: require_setting() takes at most 2 arguments (3 given)

thanks

A: 

http://www.google.com/codesearch?q=%22def+require_setting%22+package:http://gaema.googlecode.com&hl=en

This is a bug. They should be using "self" as the first argument to require_settings.

I see it's already been reported @ http://code.google.com/p/gaema/issues/detail?id=6

Drew Sears