On 02/04/2011 04:06 PM, Diez B. Roggisch wrote:
On Feb 4, 2011, at 2:55 PM, Luca Verardi wrote:

Hi all.
i see more topic on Turbogears and yui but nothing for this problem.

I want to install YUI on my turbogears project.
I read the doc (link http://turbogears.org/2.1/docs/main/GlobalJSLib.html),
I installed the extension for ToscaWidget (link 
http://toscawidgets.org/download),
and I write in my example/lib/base.py this:
from tw.yui import connection_js
class BaseController(TGController):

    def __call__(self, environ, start_response):
        """Invoke the Controller"""
        # TGController.__call__ dispatches to the Controller method
        # the request is routed to. This routing information is
        # available in environ['pylons.routes_dict']


        connection_js.inject()

        request.identity = request.environ.get('repoze.who.identity')
        tmpl_context.identity = request.identity
        return TGController.__call__(self, environ, start_response)


When i refresh my browser i have this error:

TypeError: unbound method inject() must be called with connection_js
instance as first argument (got nothing instead)

has anyone ever had this error?
This is a standard error that happens if you do this:

class Foo(object):

    def method(self):
          pass

Foo.method()

I had a quick look at the source of tw.yui. It's rather... unorthodox. From 
what I gather, you could try:

# on module level

my_connection_js = connection_js()

And then do

   my_connection_js.inject()


Diez

ohohoh
it works.
Thanks for all Diez

--
You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/turbogears?hl=en.

Reply via email to