Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #1961 (closed defect: fixed)

Opened 9 years ago

Last modified 9 years ago

Widget browser broken in TG 1.1

Reported by: chrisz Owned by: chrisz
Priority: high Milestone: 1.1b2
Component: TurboGears Version: 1.1 HEAD
Severity: major Keywords:
Cc:

Description

Most widgets using Javascript don't work in the widget browser in TG 1.1 any more. It seems the Mochikit library is not loaded for whatever reason.

Change History

comment:1 Changed 9 years ago by faide

  • Milestone changed from 1.5 to 1.1

comment:2 Changed 9 years ago by chrisz

The reasons is clear now: Mochikit is included by referring widgets.base.mochikit. In TG 1.0, this is itself a JSLink, while in TG 1.1, this is a TGMochiKit which only retrieves indirectly a JSLink. When is displayed in the widgets.kid template, nothing happens, since the indirect fetching of JS works only from a controller.

We can add a work around in the widget browser, but I wonder whether this is not a general problem. Why can't TGMochiKit be itself a JS resource at it was before?

comment:3 Changed 9 years ago by droggisch

  • Owner changed from anonymous to chrisz

I changed the implementation in r5289. If somebody can please test & if successful, close this ticket.

comment:4 Changed 9 years ago by Chris Arndt

The toolbox works perfectly for me, but when I use MochiKit in my app by setting tg.include_widgets['turbogears.mochikit'] AND tg_mochikit_version = "1.4" and tmochikit.dragndrop = True I get the following HTML output from the templates.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
    &lt;Element script at 247e9f0&gt;&lt;Element script at 247e8d0&gt;
    <title>Welcome to TurboGears</title>
    <style type="text/css">
        #pageLogin
        {
            font-size: 10px;
            font-family: verdana;
            text-align: right;
        }
    </style>
	<link rel="stylesheet" type="text/css" media="screen" href="/static/css/style.css">

</head>
[...]

N.B.: it seems that the default doctype of Genshi is XHTML. Is this intended?

But even if I set:

genshi.default_doctype = "html"
genshi.default_format = "html"

in my app.cfg I still get:

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>


<head>
    &lt;Element script at 247aa50&gt;&lt;Element script at 247a930&gt;
    <title>Welcome to TurboGears</title>
    <style type="text/css">
        #pageLogin
        {
            font-size: 10px;
            font-family: verdana;
            text-align: right;
        }
    </style>
	<link rel="stylesheet" type="text/css" media="screen" href="/static/css/style.css">

</head>
[...]

comment:5 Changed 9 years ago by Chris Arndt

  • Milestone changed from 1.1 to 1.1 beta 1

comment:6 Changed 9 years ago by chrisz

@Chris, Diez: Solved the problem mentioned in the last comment in r5364. Can you check and close the ticket if everything is fine now?

comment:7 Changed 9 years ago by droggisch

  • Status changed from new to closed
  • Resolution set to fixed

I checked, it works now.

comment:8 Changed 9 years ago by Chris Arndt

  • Status changed from closed to reopened
  • Resolution fixed deleted

comment:9 Changed 9 years ago by Chris Arndt

I get a 500 error again, when I open the widget browser in the toolbox with TG 1.1b1 or 1.1. HEAD (r5472):

500 Internal error

The server encountered an unexpected condition which prevented it from fulfilling the request.

Page handler: <function _wrapper at 0x21038f0>
Traceback (most recent call last):
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/CherryPy-2.3.0-py2.5.egg/cherrypy/_cphttptools.py", line 121, in _run
    self.main()
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/CherryPy-2.3.0-py2.5.egg/cherrypy/_cphttptools.py", line 264, in main
    body = page_handler(*virtual_path, **self.params)
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboGears-1.1b1-py2.5.egg/turbogears/identity/conditions.py", line 249, in _wrapper
    return fn(*args, **kw)
  File "<string>", line 3, in index
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboGears-1.1b1-py2.5.egg/turbogears/controllers.py", line 345, in expose
    *args, **kw)
  File "<generated code>", line 0, in run_with_transaction
  File "build/bdist.macosx-10.3-fat/egg/peak/rules/core.py", line 153, in __call__
    return self.body(*args, **kw)
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboGears-1.1b1-py2.5.egg/turbogears/database.py", line 382, in so_rwt
    retval = func(*args, **kw)
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboGears-1.1b1-py2.5.egg/turbogears/controllers.py", line 231, in _expose
    @abstract()
  File "<generated code>", line 0, in _expose
  File "build/bdist.macosx-10.3-fat/egg/peak/rules/core.py", line 153, in __call__
    return self.body(*args, **kw)
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboGears-1.1b1-py2.5.egg/turbogears/controllers.py", line 358, in <lambda>
    mapping, fragment, args, kw)))
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboGears-1.1b1-py2.5.egg/turbogears/controllers.py", line 399, in _execute_func
    return _process_output(output, template, format, content_type, mapping, fragment)
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboGears-1.1b1-py2.5.egg/turbogears/controllers.py", line 87, in _process_output
    fragment=fragment)
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboGears-1.1b1-py2.5.egg/turbogears/view/base.py", line 111, in render
    return engine.render(**kw)
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboKid-1.0.4-py2.5.egg/turbokid/kidsupport.py", line 206, in render
    output=output, format=format)
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/__init__.py", line 301, in serialize
    raise_template_error(module=self.__module__)
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/__init__.py", line 299, in serialize
    return serializer.serialize(self, encoding, fragment, format)
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/serialization.py", line 107, in serialize
    text = ''.join(self.generate(stream, encoding, fragment, format))
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/serialization.py", line 629, in generate
    for ev, item in self.apply_filters(stream, format):
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/serialization.py", line 165, in format_stream
    for ev, item in stream:
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/parser.py", line 221, in _coalesce
    for ev, item in stream:
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/serialization.py", line 477, in inject_meta_tags
    for ev, item in stream:
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/parser.py", line 179, in _track
    for p in stream:
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/filter.py", line 26, in apply_matches
    for ev, item in stream:
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/parser.py", line 179, in _track
    for p in stream:
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/parser.py", line 221, in _coalesce
    for ev, item in stream:
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboGears-1.1b1-py2.5.egg/turbogears/toolbox/widgets.py", line 65, in _pull
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboGears-1.1b1-py2.5.egg/turbogears/widgets/meta.py", line 91, in lockwidget
    output = self.__class__.display(self, *args, **kw)
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboGears-1.1b1-py2.5.egg/turbogears/widgets/base.py", line 286, in display
    output = transform(params, self.template_c)
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboKid-1.0.4-py2.5.egg/turbokid/kidsupport.py", line 220, in transform
    return kid.ElementStream(t.transform()).expand()
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/parser.py", line 108, in expand
    for ev, item in self._iter:
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/parser.py", line 179, in _track
    for p in stream:
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/parser.py", line 179, in _track
    for p in stream:
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/filter.py", line 26, in apply_matches
    for ev, item in stream:
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/parser.py", line 179, in _track
    for p in stream:
  File "/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/kid-0.9.6-py2.5.egg/kid/parser.py", line 221, in _coalesce
    for ev, item in stream:
  File "<string>", line 28, in _pull
NameError: name 'javascripts' is not defined
Error location in template file '/Users/chris/lib/tg11b1py25/lib/python2.5/site-packages/TurboGears-1.1b1-py2.5.egg/turbogears/toolbox/widgets.kid'
between line 22, column 4 and line 23, column 4:
    </script>

comment:10 Changed 9 years ago by Chris Arndt

  • Milestone changed from 1.1 beta 1 to 1.1 beta 2

comment:11 Changed 9 years ago by chrisz

This is a result of r5365 which kind of reverts r5289 for reasons I don't understand since this issue was already fixed.

comment:12 Changed 9 years ago by droggisch

  • Status changed from reopened to new

To be honest - I have *no* idea why I did that partial removal. I just checked in r5473 which hopefully gets us finally over this.

comment:13 Changed 9 years ago by Chris Arndt

  • Status changed from new to closed
  • Resolution set to fixed

Seems to do the trick for me and code looks sensible. Checked the widget browser and a quickstarted project with different tg_mochikit.*options.

Note: See TracTickets for help on using tickets.