On Jul 15, 5:09 pm, "Diez B. Roggisch" <[email protected]> wrote:
>Well, I'm not sure, but you seem to take a rather strange approach of
>working with TG (or TW, in this case). It appears as if you formed an
>idea of how things should work by some snippets of documentation, and
>then start building wildly on them.

Uhh, yeah. You got me. That's exactly what I've done. Is this so
wrong?
This is after all what abstraction is supposed to be about isn't it?

>Take the above: you somehow are aware that there is a possibility to
>declare JS-dependencies, and that there is injection. And you mix that
>together to something that is looking awful, and not working ...

Ok, so it's a bit mangled but the test first idea is agile/pythonic
is it not?  To me the javascript side of things seemed the most
likely part to be messy and/or tricky.

>This is not meant to be offensive - it's just something I've noted.

That's Ok, none taken.

>And yes, I think that's rather beautiful compared to PL/SQL mixed
>with HTML.

For this I am deeply sorry Diez. It was a completely unjustifed
comment.  Of course TG is more elegant than ASP, PHP etc. That's
why I'm here.  I was just trying to provoke a response which I
suppose my request was indeed met with ;-)

>Resource injection is only needed if you want something inside
>the page that isn't a dependency of some other wiget that gets
>called it's display()-method.

Huh?  Ok, I'm guessing I normally wouldn't need to do this.

=======================================================
What I am trying to do is very similar to this example:
http://www.turbogears.org/2.0/docs/main/ToscaWidgets/Cookbook/JSUnit.html

If I could test some Dojo inside a ToscaWidget and see it onscreen,
I'd be happy. I would then immediately be converted and become a
true believer in TG2.0 albeit still a newbie ;)

The above it _still_ not working for me.
Given up on "tg undefined" error
Trying another tack (based on JSUnit)
===========================================
#Can I subst my own JS that I want to test?
#from tw.extjs.test import ItemSelectorTest

#controllers"/root.py
#...
runner = Runner(testpage='/widgettest') #Why have '/' here?
testwidget = TestWidget() # (??='testUpdating')
# I want this to go looking for <div id="testUpdating"
#...
    @expose('pkg.templates.widgettest')
    def widgettest(self, **kw):
        pylons.c.widgettest = testwidget
        return dict()

#widgets/testWidget.py
#...
test_js = JSLink(modname=__name__, filename='public/js/chart.js')
class TestWidget(JSUnit):
    def __init(self, *args, **kw):
        super(TestWidget, self).__init__(*args, **kw)
        #self.javascript.append(all);
        self.javascript.append(test_js);
    def update_params(self, d):
        super(TestWidget, self).upadate_params(d)

#templates/widgettest.html
#...
    ${tmpl_context.testwidget(value=value)}
===========================================
! UndefinedError: "value" not defined
Where am I supposed to get this value from?

Can I just ditch the param?  No.
! TypeError: 'str' object is not callable

Should it be testwidget(page='widgettest')?  No.
! TypeError: 'str' object is not callable

Any chance I could get some more tips?
Apologies in advance for long posts.

--~--~---------~--~----~------------~-------~--~----~
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